From be8d642c52f51ff3d13d9ba407fd43d9988592a9 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 3 Dec 2024 13:41:49 -0800 Subject: [PATCH] CMake updates --- CMakeLists.txt | 6 ------ build/CompilerAndLinker.cmake | 24 +++++++++++++++++++++--- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 796648c4..b4b8054a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -544,12 +544,6 @@ foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME}) target_link_options(${t} PRIVATE ${LINKER_SWITCHES}) endforeach() -if(MINGW) - foreach(t IN LISTS TOOL_EXES) - target_link_options(${t} PRIVATE -municode) - endforeach() -endif() - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM") set(WarningsLib -Wall -Wpedantic -Wextra) diff --git a/build/CompilerAndLinker.cmake b/build/CompilerAndLinker.cmake index a78ada24..c245ef49 100644 --- a/build/CompilerAndLinker.cmake +++ b/build/CompilerAndLinker.cmake @@ -50,11 +50,20 @@ if(WIN32) list(APPEND COMPILER_DEFINES _UNICODE UNICODE) endif() +if(MINGW) + list(APPEND LINKER_SWITCHES -municode) +endif() + #--- General MSVC-like SDL options if(MSVC) list(APPEND COMPILER_SWITCHES "$<$>:/guard:cf>") list(APPEND LINKER_SWITCHES /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO) + if(WINDOWS_STORE) + list(APPEND COMPILER_SWITCHES /bigobj) + list(APPEND LINKER_SWITCHES /APPCONTAINER /MANIFEST:NO) + endif() + if((${DIRECTX_ARCH} STREQUAL "x86") OR ((CMAKE_SIZEOF_VOID_P EQUAL 4) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm")))) list(APPEND LINKER_SWITCHES /SAFESEH) @@ -95,11 +104,19 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM") if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)) list(APPEND COMPILER_SWITCHES /ZH:SHA_256) endif() + + if(WINDOWS_STORE) + list(APPEND COMPILER_DEFINES _SILENCE_CLANG_COROUTINE_MESSAGE) + endif() elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") list(APPEND COMPILER_SWITCHES /Zc:__cplusplus /Zc:inline /fp:fast /Qdiag-disable:161) elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") list(APPEND COMPILER_SWITCHES /sdl /Zc:inline /fp:fast) + if(WINDOWS_STORE) + list(APPEND COMPILER_SWITCHES /await) + endif() + if(CMAKE_INTERPROCEDURAL_OPTIMIZATION) message(STATUS "Building using Whole Program Optimization") list(APPEND COMPILER_SWITCHES $<$>:/Gy /Gw>) @@ -149,9 +166,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") list(APPEND COMPILER_SWITCHES /Zc:lambda) endif() - if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29) - AND (NOT VCPKG_TOOLCHAIN)) - list(APPEND COMPILER_SWITCHES /external:W4) + # GDKX scenarios can't use external:W4 + + if(WINDOWS_STORE AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.32)) + list(APPEND COMPILER_SWITCHES "/wd5246") endif() if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.31)