diff --git a/.github/workflows/build-targets.yml b/.github/workflows/build-targets.yml index 6ca28b6f7..aa5394ecc 100644 --- a/.github/workflows/build-targets.yml +++ b/.github/workflows/build-targets.yml @@ -6,7 +6,14 @@ jobs: strategy: fail-fast: false matrix: - target: [windows-multi-x64] + configurePreset: [ninja-msvc-x64, msbuild-x64] + include: + - configurePreset: ninja-msvc-x64 + buildPreset: ninja-msvc-x64-release + should_upload: true + - configurePreset: msbuild-x64 + buildPreset: msbuild-x64-release + should_upload: false steps: - name: Check out code @@ -15,21 +22,25 @@ jobs: submodules: true fetch-tags: true - - name: Setup vcpkg (it does not install any package yet) + - name: Fetch cmake & ninja + uses: lukka/get-cmake@latest + + - name: Bootstrap VCPKG uses: lukka/run-vcpkg@v11 - - name: Run CMake + - name: Build uses: lukka/run-cmake@v10 with: - configurePreset: "msbuild-vcpkg-x64" - buildPreset: "msbuild-vcpkg-x64-release" + configurePreset: ${{ matrix.configurePreset }} + 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.configurePreset }} + path: "cmake-build-presets/${{ matrix.configurePreset }}/Release/ezquake.exe" compression-level: 9 + if: ${{ matrix.should_upload }} macos-build: runs-on: macos-13 @@ -48,18 +59,20 @@ jobs: - name: Install build system dependencies run: brew install autoconf automake libtool + - uses: lukka/get-cmake@latest + - name: Setup vcpkg uses: lukka/run-vcpkg@v11 - name: Run CMake uses: lukka/run-cmake@v10 with: - configurePreset: "xcode-vcpkg-${{ matrix.arch }}-${{ matrix.variant }}-ci" - buildPreset: "xcode-vcpkg-${{ matrix.arch }}-${{ matrix.variant }}-ci" + configurePreset: "xcode-${{ matrix.arch }}-${{ matrix.variant }}-ci" + buildPreset: "xcode-${{ matrix.arch }}-${{ matrix.variant }}-ci" - name: Prepare upload run: zip -r ../../../ezQuake.zip ezQuake.app - working-directory: "cmake-build-presets/xcode-vcpkg-${{ matrix.arch }}-${{ matrix.variant }}-ci/${{ matrix.variant }}" + working-directory: "cmake-build-presets/xcode-${{ matrix.arch }}-${{ matrix.variant }}-ci/${{ matrix.variant }}" - name: Upload Build Artifact uses: actions/upload-artifact@v4 diff --git a/.gitignore b/.gitignore index fa7337094..ae7c4a718 100644 --- a/.gitignore +++ b/.gitignore @@ -12,5 +12,6 @@ SysPrintf.log *.glsl.c vcpkg_installed/ src/.msversion.h +cmake-build-presets !.gitignore diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c55e0648..3e7844df9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.19) +cmake_minimum_required(VERSION 3.28) if (APPLE) project(ezquake C CXX OBJC) @@ -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) @@ -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 @@ -50,14 +53,134 @@ 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 () +include (CheckCCompilerFlag) + +if (MSVC) + add_compile_definitions( + WIN32 + _WINDOWS + ) + add_compile_options( + /W3 + /nologo + /diagnostics:column + /sdl + /W3 + /WX- + ) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT $<$:ProgramDatabase>) +else() + add_compile_options( + $<$:-g> + $<$:-O2> + + -Wall + -Wno-strict-aliasing + -fvisibility=hidden + -Wno-deprecated-declarations + + $<$:-Wno-pointer-to-int-cast> + $<$:-Werror=strict-prototypes> + $<$:-Werror=old-style-definition> + ) + + # clang specific warning auto-enabled on macOS by Xcode + check_c_compiler_flag("-Wshorten-64-to-32" HAS_CFLAG_SHORTEN_64_TO_32) + if (HAS_CFLAG_SHORTEN_64_TO_32) + add_compile_options(-Wno-shorten-64-to-32) + endif() +endif() + +find_library(MATH m) +find_package(OpenGL REQUIRED) +find_package(Threads REQUIRED) + +if (SYSTEM_LIBS) + find_package(PkgConfig) + pkg_check_modules(cURL REQUIRED IMPORTED_TARGET libcurl) + pkg_check_modules(Expat REQUIRED IMPORTED_TARGET expat) + pkg_check_modules(FreeType REQUIRED IMPORTED_TARGET freetype2) + pkg_check_modules(JPEG REQUIRED IMPORTED_TARGET libjpeg) + pkg_check_modules(Jansson REQUIRED IMPORTED_TARGET jansson) + pkg_check_modules(MiniZip REQUIRED IMPORTED_TARGET minizip) + pkg_check_modules(PCRE2 REQUIRED IMPORTED_TARGET libpcre2-8) + pkg_check_modules(PNG REQUIRED IMPORTED_TARGET libpng) + pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2) + pkg_check_modules(SndFile REQUIRED IMPORTED_TARGET sndfile) + pkg_check_modules(Speex REQUIRED IMPORTED_TARGET speex) + pkg_check_modules(SpeexDSP REQUIRED IMPORTED_TARGET speexdsp) + pkg_check_modules(zlib REQUIRED IMPORTED_TARGET zlib) +else() + # Due to a limitation in vcpkg pkg-config always returns debug libs + # if used for static builds. Hopefully this branch can be removed + # later on. + find_package(ZLIB REQUIRED) + find_package(CURL CONFIG REQUIRED) + find_package(EXPAT CONFIG REQUIRED) + find_package(Freetype REQUIRED) + find_package(jansson CONFIG REQUIRED) + find_package(JPEG REQUIRED) + find_package(PNG REQUIRED) + find_package(PCRE2 CONFIG REQUIRED) + find_package(unofficial-minizip CONFIG REQUIRED) + find_package(SDL2 REQUIRED) + find_package(SndFile CONFIG REQUIRED) + + # speex and speexdsp currently lack a cmake wrapper, vcpkg#37412 + set(VCPKG_ARCH_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") + find_path(SPEEX_INCLUDE_DIR NAMES speex/speex.h PATHS "${VCPKG_ARCH_DIR}/include" NO_DEFAULT_PATH REQUIRED) + find_library(SPEEX_LIB_RELEASE NAMES speex PATHS "${VCPKG_ARCH_DIR}/lib" NO_DEFAULT_PATH) + find_library(SPEEX_LIB_DEBUG NAMES speex PATHS "${VCPKG_ARCH_DIR}/debug/lib" NO_DEFAULT_PATH) + if(NOT SPEEX_LIB_RELEASE AND NOT SPEEX_LIB_DEBUG) + message(FATAL_ERROR "Speex library not found") + endif() + add_library(SPEEX::SPEEX STATIC IMPORTED) + set_target_properties(SPEEX::SPEEX PROPERTIES + IMPORTED_CONFIGURATIONS "Debug;Release" + IMPORTED_LOCATION_RELEASE "${SPEEX_LIB_RELEASE}" + IMPORTED_LOCATION_DEBUG "${SPEEX_LIB_DEBUG}" + INTERFACE_INCLUDE_DIRECTORIES "${SPEEX_INCLUDE_DIR}" + ) + find_path(SPEEXDSP_INCLUDE_DIR NAMES speex/speexdsp_types.h PATHS "${VCPKG_ARCH_DIR}/include" NO_DEFAULT_PATH REQUIRED) + find_library(SPEEXDSP_LIB_RELEASE NAMES speexdsp PATHS "${VCPKG_ARCH_DIR}/lib" NO_DEFAULT_PATH) + find_library(SPEEXDSP_LIB_DEBUG NAMES speexdsp PATHS "${VCPKG_ARCH_DIR}/debug/lib" NO_DEFAULT_PATH) + if(NOT SPEEXDSP_LIB_RELEASE AND NOT SPEEXDSP_LIB_DEBUG) + message(FATAL_ERROR "SpeexDSP library not found") + endif() + add_library(SPEEX::SPEEXDSP STATIC IMPORTED) + set_target_properties(SPEEX::SPEEXDSP PROPERTIES + IMPORTED_CONFIGURATIONS "Debug;Release" + IMPORTED_LOCATION_RELEASE "${SPEEXDSP_LIB_RELEASE}" + IMPORTED_LOCATION_DEBUG "${SPEEXDSP_LIB_DEBUG}" + INTERFACE_INCLUDE_DIRECTORIES "${SPEEXDSP_INCLUDE_DIR}" + ) +endif() + +if (APPLE) + find_library(FRAMEWORK_IOKIT IOKit REQUIRED) + find_library(FRAMEWORK_FOUNDATION Foundation REQUIRED) + find_library(FRAMEWORK_QUARTZCORE QuartzCore REQUIRED) + find_library(FRAMEWORK_CORESERVICES CoreServices REQUIRED) +endif() + add_executable(resource_compiler "misc/vstudio/txt2c/txt2c.cpp") -set_target_properties(resource_compiler PROPERTIES - OSX_ARCHITECTURES "x86_64;arm64" +if (CMAKE_CROSSCOMPILING_EMULATOR) + # No way to build the resource compiler host native in one go + # so statically linking to let wine run without dll path issues. + target_link_options(resource_compiler PRIVATE -static-libgcc) +elseif (MSVC) + # Not relevant, and better to be cross-platform. + target_compile_definitions(resource_compiler PRIVATE _CRT_SECURE_NO_DEPRECATE) +elseif (APPLE) + # Universal binary needed when cross-compiling. + set_target_properties(resource_compiler PROPERTIES + OSX_ARCHITECTURES "x86_64;arm64" ) +endif() macro(add_resources target_var) add_library(${target_var} OBJECT) @@ -71,6 +194,7 @@ macro(add_resources target_var) get_filename_component(source_file_dir_relative "${source_file_relative}" DIRECTORY) set(generated_directory "${generated_base_directory}/${source_file_dir_relative}") + file(MAKE_DIRECTORY ${generated_directory}) file(MAKE_DIRECTORY ${generated_directory}) get_filename_component(source_file_name "${source_file}" NAME) @@ -78,7 +202,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} $ ${source_file_name} ${generated_file_name} WORKING_DIRECTORY "${source_file_dir}" DEPENDS ${source_file} resource_compiler COMMENT "Generating C file from ${source_file_relative}" @@ -93,69 +217,6 @@ macro(add_resources target_var) endforeach () endmacro() -find_package(ZLIB REQUIRED) -find_package(CURL CONFIG REQUIRED) -find_package(EXPAT CONFIG REQUIRED) -find_package(Freetype REQUIRED) -find_package(jansson CONFIG REQUIRED) -find_package(JPEG REQUIRED) -find_package(PNG REQUIRED) -find_package(PCRE2 CONFIG REQUIRED) -find_package(unofficial-minizip CONFIG REQUIRED) -find_package(SDL2 REQUIRED) -find_package(SndFile CONFIG REQUIRED) -find_library(MATH m) -find_package(OpenGL REQUIRED) -find_package(Threads REQUIRED) - -# remove once speex and speexdsp gains a cmake wrapper -set(VCPKG_ARCH_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") -find_path(SPEEX_INCLUDE_DIR NAMES speex/speex.h PATHS "${VCPKG_ARCH_DIR}/include" NO_DEFAULT_PATH REQUIRED) -find_library(SPEEX_LIB_RELEASE NAMES speex PATHS "${VCPKG_ARCH_DIR}/lib" NO_DEFAULT_PATH) -find_library(SPEEX_LIB_DEBUG NAMES speex PATHS "${VCPKG_ARCH_DIR}/debug/lib" NO_DEFAULT_PATH) -if(NOT SPEEX_LIB_RELEASE AND NOT SPEEX_LIB_DEBUG) - message(FATAL_ERROR "Speex library not found") -endif() -add_library(SPEEX::SPEEX STATIC IMPORTED) -set_target_properties(SPEEX::SPEEX PROPERTIES - IMPORTED_CONFIGURATIONS "Debug;Release" - IMPORTED_LOCATION_RELEASE "${SPEEX_LIB_RELEASE}" - IMPORTED_LOCATION_DEBUG "${SPEEX_LIB_DEBUG}" - INTERFACE_INCLUDE_DIRECTORIES "${SPEEX_INCLUDE_DIR}" -) -find_path(SPEEXDSP_INCLUDE_DIR NAMES speex/speexdsp_types.h PATHS "${VCPKG_ARCH_DIR}/include" NO_DEFAULT_PATH REQUIRED) -find_library(SPEEXDSP_LIB_RELEASE NAMES speexdsp PATHS "${VCPKG_ARCH_DIR}/lib" NO_DEFAULT_PATH) -find_library(SPEEXDSP_LIB_DEBUG NAMES speexdsp PATHS "${VCPKG_ARCH_DIR}/debug/lib" NO_DEFAULT_PATH) -if(NOT SPEEXDSP_LIB_RELEASE AND NOT SPEEXDSP_LIB_DEBUG) - message(FATAL_ERROR "SpeexDSP library not found") -endif() -add_library(SPEEXDSP::SPEEXDSP STATIC IMPORTED) -set_target_properties(SPEEXDSP::SPEEXDSP PROPERTIES - IMPORTED_CONFIGURATIONS "Debug;Release" - IMPORTED_LOCATION_RELEASE "${SPEEXDSP_LIB_RELEASE}" - IMPORTED_LOCATION_DEBUG "${SPEEXDSP_LIB_DEBUG}" - INTERFACE_INCLUDE_DIRECTORIES "${SPEEXDSP_INCLUDE_DIR}" -) - -if (APPLE) - find_library(FRAMEWORK_IOKIT IOKit REQUIRED) - find_library(FRAMEWORK_FOUNDATION Foundation REQUIRED) - find_library(FRAMEWORK_QUARTZCORE QuartzCore REQUIRED) - 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 @@ -747,7 +808,6 @@ else() set(sys_glue ${SOURCE_DIR}/localtime_win.c ) - endif() source_group(TREE ${SOURCE_DIR} PREFIX "Source Files/sys_glue" FILES ${sys_glue}) source_group(TREE ${SOURCE_DIR} PREFIX "Header Files/sys_glue" FILES ${sys_headers}) @@ -788,14 +848,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) @@ -807,11 +859,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} @@ -833,6 +893,12 @@ add_executable(ezquake ${TARGET_TYPE} $,${windows_icon},> ) +#[[ +set_target_properties(ezquake PROPERTIES + INTERPROCEDURAL_OPTIMIZATION TRUE +) +]] + target_include_directories(ezquake PRIVATE ${SOURCE_DIR}/qwprot/src ) @@ -850,7 +916,9 @@ target_compile_definitions(ezquake PRIVATE $<$:DEBUG_MEMORY_ALLOCATIONS> $<$:WITH_RENDERING_TRACE> + $<$:GL_SILENCE_DEPRECATION> RENDERER_OPTION_CLASSIC_OPENGL + $<$>:RENDERER_OPTION_MODERN_OPENGL> WITH_PNG @@ -868,19 +936,19 @@ target_link_libraries(ezquake PRIVATE shaders_classic documentation - ZLIB::ZLIB - CURL::libcurl - Freetype::Freetype - jansson::jansson - JPEG::JPEG - PNG::PNG - expat::expat - SndFile::sndfile - unofficial::minizip::minizip - pcre2::pcre2-8-static - SDL2::SDL2-static - SPEEX::SPEEX - SPEEXDSP::SPEEXDSP + $,PkgConfig::zlib,ZLIB::ZLIB> + $,PkgConfig::cURL,CURL::libcurl> + $,PkgConfig::Expat,expat::expat> + $,PkgConfig::JPEG,JPEG::JPEG> + $,PkgConfig::PCRE2,pcre2::pcre2-8-static> + $,PkgConfig::SDL2,SDL2::SDL2-static> + $,PkgConfig::Jansson,jansson::jansson> + $,PkgConfig::SndFile,SndFile::sndfile> + $,PkgConfig::PNG,PNG::PNG> + $,PkgConfig::FreeType,Freetype::Freetype> + $,PkgConfig::MiniZip,unofficial::minizip::minizip> + $,PkgConfig::Speex,SPEEX::SPEEX> + $,PkgConfig::SpeexDSP,SPEEX::SPEEXDSP> OpenGL::GL Threads::Threads diff --git a/CMakePresets.json b/CMakePresets.json index 36469e325..cb6fc9276 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -2,7 +2,7 @@ "version": 6, "cmakeMinimumRequired": { "major": 3, - "minor": 19, + "minor": 28, "patch": 0 }, "configurePresets": [ @@ -11,20 +11,64 @@ "hidden": true, "binaryDir": "${sourceDir}/cmake-build-presets/${presetName}", "cacheVariables": { + "CMAKE_VERBOSE_MAKEFILE": "ON", "CMAKE_TOOLCHAIN_FILE": { "type": "FILEPATH", "value": "vcpkg/scripts/buildsystems/vcpkg.cmake" }, "VCPKG_LIBRARY_LINKAGE": "static", - "VCPKG_CRT_LINKAGE": "dynamic" + "VCPKG_CRT_LINKAGE": "dynamic", + "VCPKG_ENABLE_METRICS": "0" } }, { - "name": "msbuild-vcpkg-x64", - "description": "Configure with vcpkg toolchain and Visual Studio project files for all configurations", + "name": "template-msvc", + "hidden": true, + "inherits": "template-vcpkg", + "cacheVariables": { + "CMAKE_C_FLAGS": "/DWIN32 /D_WINDOWS /W3 /nologo /diagnostics:column /sdl /W3 /WX-", + "CMAKE_C_FLAGS_DEBUG": "/MDd /Zi /Ob0 /Od /RTC1", + "CMAKE_C_FLAGS_RELEASE": "/MD /O2 /Ob2 /DNDEBUG", + "CMAKE_EXE_LINKER_FLAGS_DEBUG": "/debug", + "CMAKE_EXE_LINKER_FLAGS_RELEASE": "" + } + }, + { + "name": "template-gcc-mingw-cross", + "hidden": true, + "cacheVariables": { + "CMAKE_SYSTEM_NAME": "Windows", + "CMAKE_CROSSCOMPILING_EMULATOR": "wine", + "VCPKG_APPLOCAL_DEPS": "OFF" + } + }, + { + "name": "template-gcc-mingw-i686", + "hidden": true, + "inherits": "template-vcpkg", + "cacheVariables": { + "CMAKE_C_COMPILER": "i686-w64-mingw32-gcc", + "CMAKE_CXX_COMPILER": "i686-w64-mingw32-g++", + "CMAKE_RC_COMPILER": "i686-w64-mingw32-windres" + } + }, + { + "name": "template-gcc-mingw-x64", + "hidden": true, + "inherits": "template-vcpkg", + "cacheVariables": { + "CMAKE_C_COMPILER": "x86_64-w64-mingw32-gcc", + "CMAKE_CXX_COMPILER": "x86_64-w64-mingw32-g++", + "CMAKE_RC_COMPILER": "x86_64-w64-mingw32-windres" + } + }, + { + "name": "msbuild-x64", + "description": "Configure as Visual Studio project", "generator": "Visual Studio 17 2022", "inherits": "template-vcpkg", "cacheVariables": { + "CMAKE_CONFIGURATION_TYPES": "Debug;Release", "VCPKG_TARGET_TRIPLET": "x64-windows-static" }, "condition": { @@ -34,11 +78,12 @@ } }, { - "name": "ninja-msvc-vcpkg-x64", - "description": "Configure with vcpkg toolchain and Windows Subsystem for Linux for all configurations", - "generator": "Ninja", + "name": "ninja-msvc-x64", + "description": "Configure using Ninja to build with msvc", + "generator": "Ninja Multi-Config", "inherits": "template-vcpkg", "cacheVariables": { + "CMAKE_CONFIGURATION_TYPES": "Debug;Release", "VCPKG_TARGET_TRIPLET": "x64-windows-static" }, "condition": { @@ -48,21 +93,23 @@ } }, { - "name": "ninja-clang-vcpkg-x64", + "name": "ninja-mingw64-x64-shared", "hidden": true, - "description": "Configure with vcpkg toolchain clang for all configurations", - "generator": "Ninja", - "inherits": "template-vcpkg", + "description": "Configure using Ninja to build with mingw64 for x64", + "generator": "Ninja Multi-Config", + "inherits": "template-gcc-mingw-x64", "architecture": { "value": "x64", "strategy": "external" }, "cacheVariables": { - "CMAKE_VERBOSE_MAKEFILE": "YES", - "CMAKE_C_COMPILER": "clang", - "CMAKE_CXX_COMPILER": "clang++", - "VCPKG_TARGET_TRIPLET": "x64-windows-static" - }, + "CMAKE_CONFIGURATION_TYPES": "Debug;Release", + "VCPKG_TARGET_TRIPLET": "x64-mingw-static" + } + }, + { + "name": "ninja-mingw64-x64", + "inherits": ["ninja-mingw64-x64-shared"], "condition": { "type": "equals", "lhs": "${hostSystemName}", @@ -70,41 +117,32 @@ } }, { - "name": "ninja-clang-vcpkg-x64-debug", - "inherits": "ninja-clang-vcpkg-x64", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "VCPKG_BUILD_TYPE": "Debug", - "CMAKE_C_FLAGS": "/DWIN32 /D_WINDOWS /W3 /GR /EHsc /arch:AVX2", - "CMAKE_CXX_FLAGS": "/DWIN32 /D_WINDOWS /W3 /GR /EHsc /arch:AVX2", - "CMAKE_EXE_LINKER_FLAGS": "/machine:x64" - } - }, - { - "name": "ninja-clang-vcpkg-x64-release", - "inherits": "ninja-clang-vcpkg-x64", - "cacheVariables": { - "VCPKG_C_FLAGS": "/arch:AVX2 -m64", - "VCPKG_CXX_FLAGS": "/arch:AVX2 -m64", - "CMAKE_BUILD_TYPE": "Release", - "VCPKG_BUILD_TYPE": "Release" + "name": "ninja-mingw64-x64-cross", + "inherits": ["ninja-mingw64-x64-shared", "template-gcc-mingw-cross"], + "condition": { + "type": "notEquals", + "lhs": "${hostSystemName}", + "rhs": "Windows" } }, { - "name": "ninja-mingw64-vcpkg-x64", + "name": "ninja-mingw64-i686-shared", "hidden": true, - "description": "Configure with vcpkg toolchain clang for all configurations", - "generator": "Ninja", - "inherits": "template-vcpkg", + "description": "Configure with Ninja to build with mingw64 for i686", + "generator": "Ninja Multi-Config", + "inherits": "template-gcc-mingw-i686", "architecture": { - "value": "x64", + "value": "x86", "strategy": "external" }, "cacheVariables": { - "CMAKE_VERBOSE_MAKEFILE": "YES", - "VCPKG_CMAKE_SYSTEM_NAME": "MinGW", - "VCPKG_TARGET_TRIPLET": "x64-mingw-static" - }, + "VCPKG_TARGET_ARCHITECTURE": "x86", + "VCPKG_TARGET_TRIPLET": "x86-mingw-static" + } + }, + { + "name": "ninja-mingw64-i686", + "inherits": ["ninja-mingw64-i686-shared"], "condition": { "type": "equals", "lhs": "${hostSystemName}", @@ -112,25 +150,25 @@ } }, { - "name": "ninja-mingw64-vcpkg-x64-debug", - "inherits": "ninja-mingw64-vcpkg-x64", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "VCPKG_BUILD_TYPE": "Debug" - } - }, - { - "name": "ninja-mingw64-vcpkg-x64-release", - "inherits": "ninja-mingw64-vcpkg-x64", + "name": "ninja-mingw64-i686-cross", + "inherits": ["ninja-mingw64-i686-shared", "template-gcc-mingw-cross"], "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release", - "VCPKG_BUILD_TYPE": "Release" + "CMAKE_SYSTEM_PROCESSOR": "i686" + }, + "environment": { + "WINEARCH": "win32", + "WINEPREFIX": "${sourceDir}/cmake-build-presets/ninja-mingw64-i686-cross/" + }, + "condition": { + "type": "notEquals", + "lhs": "${hostSystemName}", + "rhs": "Windows" } }, { - "name": "xcode-vcpkg", + "name": "xcode", "hidden": true, - "description": "Configure with vcpkg toolchain and XCode project files for all configurations", + "description": "Configure XCode project file", "generator": "Xcode", "inherits": "template-vcpkg", "condition": { @@ -140,9 +178,9 @@ } }, { - "name": "xcode-vcpkg-arm64", - "displayName": "XCode (vcpkg-arm64)", - "inherits": "xcode-vcpkg", + "name": "xcode-arm64", + "displayName": "XCode (arm64)", + "inherits": "xcode", "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64-osx", "CMAKE_OSX_ARCHITECTURES": "arm64", @@ -152,16 +190,16 @@ } }, { - "name": "xcode-vcpkg-arm64-release-ci", - "inherits": "xcode-vcpkg-arm64", + "name": "xcode-arm64-release-ci", + "inherits": "xcode-arm64", "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64-osx-release" } }, { - "name": "xcode-vcpkg-x64", - "displayName": "XCode (vcpkg-x64)", - "inherits": "xcode-vcpkg", + "name": "xcode-x64", + "displayName": "XCode (x64)", + "inherits": "xcode", "cacheVariables": { "VCPKG_TARGET_TRIPLET": "x64-osx", "CMAKE_OSX_ARCHITECTURES": "x86_64", @@ -171,8 +209,8 @@ } }, { - "name": "xcode-vcpkg-x64-release-ci", - "inherits": "xcode-vcpkg-x64", + "name": "xcode-x64-release-ci", + "inherits": "xcode-x64", "cacheVariables": { "VCPKG_TARGET_TRIPLET": "x64-osx-release" } @@ -180,100 +218,128 @@ ], "buildPresets": [ { - "name": "msbuild-vcpkg-x64-debug", - "configurePreset": "msbuild-vcpkg-x64", - "displayName": "Build msbuild-vcpkg-x64-debug", + "name": "msbuild-x64-debug", + "configurePreset": "msbuild-x64", + "displayName": "Build msbuild-x64 debug", "description": "Build Visual Studio Debug configuration", "configuration": "Debug" }, { - "name": "msbuild-vcpkg-x64-release", - "configurePreset": "msbuild-vcpkg-x64", - "displayName": "Build msbuild-vcpkg-x64 release", + "name": "msbuild-x64-release", + "configurePreset": "msbuild-x64", + "displayName": "Build msbuild-x64 release", "description": "Build Visual Studio Release configuration", "configuration": "Release" }, { - "name": "ninja-msvc-vcpkg-x64-debug", - "configurePreset": "ninja-msvc-vcpkg-x64", - "displayName": "Build wsl-vcpkg-x64-debug", + "name": "ninja-msvc-x64-debug", + "configurePreset": "ninja-msvc-x64", + "displayName": "Build ninja-msvc-x64 debug", "description": "Build Windows Subsystem for Linux Debug configuration", "configuration": "Debug" }, { - "name": "ninja-msvc-vcpkg-x64-release", - "configurePreset": "ninja-msvc-vcpkg-x64", - "displayName": "Build wsl-vcpkg-x64-release", + "name": "ninja-msvc-x64-release", + "configurePreset": "ninja-msvc-x64", + "displayName": "Build wsl-vcpkg-x64 release", "description": "Build Windows Subsystem for Linux Debug configuration", "configuration": "Release" }, { - "name": "ninja-clang-vcpkg-x64-debug", - "configurePreset": "ninja-clang-vcpkg-x64-debug", - "displayName": "Build ninja-clang-vcpkg-x64-debug", + "name": "ninja-mingw64-x64-debug", + "configurePreset": "ninja-mingw64-x64", + "displayName": "Build ninja-mingw64-x64 debug", + "description": "Build Windows Subsystem for Linux Debug configuration", + "configuration": "Debug" + }, + { + "name": "ninja-mingw64-x64-cross-debug", + "configurePreset": "ninja-mingw64-x64-cross", + "displayName": "Build ninja-mingw64-x64 debug", "description": "Build Windows Subsystem for Linux Debug configuration", "configuration": "Debug" }, { - "name": "ninja-clang-vcpkg-x64-release", - "configurePreset": "ninja-clang-vcpkg-x64-release", - "displayName": "Build ninja-clang-vcpkg-x64-release", + "name": "ninja-mingw64-x64-release", + "configurePreset": "ninja-mingw64-x64", + "displayName": "Build ninja-mingw64-x64 release", + "description": "Build Windows Subsystem for Linux Debug configuration", + "configuration": "Release" + }, + { + "name": "ninja-mingw64-x64-cross-release", + "configurePreset": "ninja-mingw64-x64-cross", + "displayName": "Build ninja-mingw64-x64 release", "description": "Build Windows Subsystem for Linux Debug configuration", "configuration": "Release" }, { - "name": "ninja-mingw64-vcpkg-x64-debug", - "configurePreset": "ninja-mingw64-vcpkg-x64-debug", - "displayName": "Build ninja-mingw64-vcpkg-x64-debug", + "name": "ninja-mingw64-i686-debug", + "configurePreset": "ninja-mingw64-i686", + "displayName": "Build ninja-mingw64-i686 debug", "description": "Build Windows Subsystem for Linux Debug configuration", "configuration": "Debug" }, { - "name": "ninja-mingw64-vcpkg-x64-release", - "configurePreset": "ninja-mingw64-vcpkg-x64-release", - "displayName": "Build ninja-mingw64-vcpkg-x64-release", + "name": "ninja-mingw64-i686-cross-debug", + "configurePreset": "ninja-mingw64-i686-cross", + "displayName": "Build ninja-mingw64-i686 debug", + "description": "Build Windows Subsystem for Linux Debug configuration", + "configuration": "Debug" + }, + { + "name": "ninja-mingw64-i686-release", + "configurePreset": "ninja-mingw64-i686", + "displayName": "Build ninja-mingw64-i686 release", + "description": "Build Windows Subsystem for Linux Debug configuration", + "configuration": "Release" + }, + { + "name": "ninja-mingw64-i686-cross-release", + "configurePreset": "ninja-mingw64-i686-cross", + "displayName": "Build ninja-mingw64-i686 release", "description": "Build Windows Subsystem for Linux Debug configuration", "configuration": "Release" }, { - "name": "xcode-vcpkg-arm64-debug", - "configurePreset": "xcode-vcpkg-arm64", - "displayName": "Build xcode-vcpkg-debug", - "description": "Build xcode-vcpkg Debug configuration", + "name": "xcode-arm64-debug", + "configurePreset": "xcode-arm64", + "displayName": "Build Xcode debug", + "description": "Build Xcode Debug configuration", "configuration": "Debug" }, { - "name": "xcode-vcpkg-arm64-release", - "configurePreset": "xcode-vcpkg-arm64", - "displayName": "Build xcode-vcpkg-release", - "description": "Build xcode-vcpkg Release configuration", + "name": "xcode-arm64-release", + "configurePreset": "xcode-arm64", + "displayName": "Build Xcode release", + "description": "Build Xcode Release configuration", "configuration": "Release" }, { - "name": "xcode-vcpkg-arm64-release-ci", - "configurePreset": "xcode-vcpkg-arm64-release-ci", - "displayName": "Build xcode-vcpkg-release", + "name": "xcode-arm64-release-ci", + "configurePreset": "xcode-arm64-release-ci", + "displayName": "Build Xcode release", "description": "Build with community release triplet", "configuration": "Release" }, { - "name": "xcode-vcpkg-x64-debug", - "configurePreset": "xcode-vcpkg-x64", - "displayName": "Build xcode-vcpkg-debug", - "description": "Build xcode-vcpkg Debug configuration", + "name": "xcode-x64-debug", + "configurePreset": "xcode-x64", + "displayName": "Build Xcode debug", + "description": "Build Xcode Debug configuration", "configuration": "Debug" }, { - "name": "xcode-vcpkg-x64-release", - "configurePreset": "xcode-vcpkg-x64", - "displayName": "Build xcode-vcpkg-release", - "description": "Build xcode-vcpkg Release configuration", + "name": "xcode-x64-release", + "configurePreset": "xcode-x64", + "displayName": "Build Xcode release", + "description": "Build Xcode Release configuration", "configuration": "Release" }, { - "name": "xcode-vcpkg-x64-release-ci", - "configurePreset": "xcode-vcpkg-x64-release-ci", - "displayName": "Build xcode-vcpkg-release", + "name": "xcode-x64-release-ci", + "configurePreset": "xcode-x64-release-ci", + "displayName": "Build Xcode release", "description": "Build with community release triplet", "configuration": "Release" } diff --git a/vcpkg.json b/vcpkg.json index 74adf911c..0e934ba9c 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -3,7 +3,7 @@ "name": "ezquake", "version": "1.0.0", "dependencies": [ - { "name": "pkgconf", "default-features": false, "platform": "osx" }, + { "name": "pkgconf", "default-features": false, "platform": "osx", "host": true }, { "name": "zlib", "default-features": false }, { "name": "pcre2", "default-features": false }, { "name": "minizip", "default-features": false }, @@ -21,4 +21,4 @@ { "name": "sdl2", "default-features": false, "platform": "windows, osx" }, { "name": "sdl2", "default-features": false, "features": ["wayland", "x11", "alsa"], "platform": "linux" } ] -} \ No newline at end of file +}