Skip to content

Commit

Permalink
CMake updates
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Dec 3, 2024
1 parent 3114a31 commit 134747f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,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)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
Expand Down
20 changes: 20 additions & 0 deletions build/CompilerAndLinker.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$<$<NOT:$<CONFIG:DEBUG>>:/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)
Expand Down Expand Up @@ -95,11 +104,18 @@ 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 $<$<NOT:$<CONFIG:Debug>>:/Gy /Gw>)
Expand Down Expand Up @@ -159,6 +175,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
list(APPEND COMPILER_SWITCHES /Zc:static_assert-)
endif()

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.35)
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
list(APPEND COMPILER_SWITCHES $<$<NOT:$<CONFIG:Debug>>:/Zc:checkGwOdr>)
Expand Down

0 comments on commit 134747f

Please sign in to comment.