Skip to content

Commit

Permalink
meh
Browse files Browse the repository at this point in the history
  • Loading branch information
dsvensson committed Mar 20, 2024
1 parent bb0ddc3 commit f0465da
Show file tree
Hide file tree
Showing 4 changed files with 217 additions and 145 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/build-targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ jobs:
strategy:
fail-fast: false
matrix:
target: [windows-multi-x64]
configurePreset: [ninja-msvc-x64, ninja-mingw64-x64-cross]
include:
- configurePreset: ninja-msvc-x64
buildPreset: ninja-msvc-x64-release
- configurePreset: ninja-mingw64-x64-cross
buildPreset: ninja-mingw64-x64-cross-release

steps:
- name: Check out code
Expand All @@ -21,14 +26,14 @@ jobs:
- name: Run CMake
uses: lukka/run-cmake@v10
with:
configurePreset: "msbuild-vcpkg-x64"
buildPreset: "msbuild-vcpkg-x64-release"
configurePreset: ${{ matrix.configPreset }}
buildPreset: ${{ matrix.buildPreset }}

- name: Archive client
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: "cmake-build-presets/msbuild-vcpkg-x64/Release/ezquake.exe"
name: ${{ matrix.configPreset }}
path: "cmake-build-presets/${{ matrix.configPreset }}/Release/ezquake.exe"
compression-level: 9

macos-build:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ SysPrintf.log
*.glsl.c
vcpkg_installed/
src/.msversion.h
cmake-build-presets

!.gitignore
44 changes: 19 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19)
cmake_minimum_required(VERSION 3.28)

if (APPLE)
project(ezquake C CXX OBJC)
Expand All @@ -12,6 +12,9 @@ set(COMMIT_DESC "0.0.0-0-g00000000")
set(VERSION "Unknown")
set(REVISION "Unknown")

include(CheckIPOSupported)
check_ipo_supported(RESULT LTO_SUPPORTED)

find_package(Git QUIET)
if (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
option(GIT_SUBMODULE "Check submodules during build" ON)
Expand Down Expand Up @@ -40,7 +43,7 @@ if (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
)

execute_process(
COMMAND ${GIT_EXECUTABLE} describe foo
COMMAND ${GIT_EXECUTABLE} describe --tags
OUTPUT_VARIABLE GIT_DESC
RESULT_VARIABLE GIT_DESC_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand All @@ -50,7 +53,6 @@ if (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
set(COMMIT_DESC "${GIT_DESC}")
endif()

message("desc: ${COMMIT_DESC}")
set(VERSION "${REVISION}~${COMMIT_HASH}")
endif ()

Expand Down Expand Up @@ -78,7 +80,7 @@ macro(add_resources target_var)

add_custom_command(
OUTPUT ${generated_file_name}
COMMAND resource_compiler ${source_file_name} ${generated_file_name}
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:resource_compiler> ${source_file_name} ${generated_file_name}
WORKING_DIRECTORY "${source_file_dir}"
DEPENDS ${source_file} resource_compiler
COMMENT "Generating C file from ${source_file_relative}"
Expand Down Expand Up @@ -144,18 +146,6 @@ if (APPLE)
find_library(FRAMEWORK_CORESERVICES CoreServices REQUIRED)
endif()

#if (APPLE)
add_compile_options(
-Wall
-Wno-pointer-to-int-cast
-Wno-int-to-pointer-cast
-Wno-strict-aliasing
-Werror=strict-prototypes
-Werror=old-style-definition
-fno-optimize-sibling-calls
)
#endif()

set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)

set(common_headers
Expand Down Expand Up @@ -788,14 +778,6 @@ if (APPLE)
set_source_files_properties(${macos_icon} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
endif()

if(WIN32)
set(TARGET_TYPE WIN32)
elseif(APPLE)
set(TARGET_TYPE MACOSX_BUNDLE)
else()
set(TARGET_TYPE "")
endif()

if (WIN32)
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)-([0-9]+)-g[0-9a-fA-F]+$" "\\1;\\2;\\3;\\4" VERSION_COMPONENTS "${COMMIT_DESC}")
list(GET VERSION_COMPONENTS 0 VERSION_MAJOR)
Expand All @@ -807,11 +789,19 @@ if (WIN32)
set(EZQUAKE_RESOURCE_AUTHOR "QW-Group")
set(EZQUAKE_RESOURCE_NAME "ezQuake")
set(EZQUAKE_RESOURCE_DESCRIPTION "ezQuake - a QuakeWorld client")
set(EZQUAKE_RESOURCE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/ezQuake.ico")
set(EZQUAKE_RESOURCE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/ezquake.ico")
set(EZQUAKE_RESOURCE_VERSION "${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_BUILD}")
configure_file("${CMAKE_SOURCE_DIR}/ezQuake.rc.in" ${windows_icon} @ONLY)
endif()

if(WIN32)
set(TARGET_TYPE WIN32)
elseif(APPLE)
set(TARGET_TYPE MACOSX_BUNDLE)
else()
set(TARGET_TYPE "")
endif()

add_executable(ezquake ${TARGET_TYPE}
${main}
${sys_glue}
Expand All @@ -833,6 +823,10 @@ add_executable(ezquake ${TARGET_TYPE}
$<IF:$<PLATFORM_ID:Windows>,${windows_icon},>
)

set_target_properties(ezquake PROPERTIES
INTERPROCEDURAL_OPTIMIZATION TRUE
)

target_include_directories(ezquake PRIVATE
${SOURCE_DIR}/qwprot/src
)
Expand Down
Loading

0 comments on commit f0465da

Please sign in to comment.