From 34dd2795fb6c83b4b17edfb720330a31391f9eac Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 17 Dec 2024 11:42:45 -0800 Subject: [PATCH 1/3] Update CMake project --- CMakeLists.txt | 46 ++++++++++++++++++++++------------------------ CMakePresets.json | 25 +++++++++++-------------- build/vcpkg.json | 11 ++++++----- 3 files changed, 39 insertions(+), 43 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ad835c..4492d06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,6 @@ option(BUILD_WITH_NEW_WARP "Use the WARP package on NuGet" OFF) set(DIRECTX_WARP_VERSION 1.0.13) option(BUILD_WITH_NEW_DX12 "Use the DirectX 12 Agility SDK Binaries" OFF) -set(DIRECTX_DX12_VERSION 1.614.1) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -68,6 +67,12 @@ if(directx-headers_FOUND) target_compile_definitions(${PROJECT_NAME} PRIVATE USING_DIRECTX_HEADERS) endif() +if(BUILD_WITH_NEW_DX12) + message(STATUS "Using DirectX 12 Agility SDK") + find_package(directx12-agility CONFIG REQUIRED) + target_compile_definitions(${PROJECT_NAME} PRIVATE USING_D3D12_AGILITY_SDK) +endif() + if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE /W4 /GR- "$<$>:/guard:cf>") target_link_options(${PROJECT_NAME} PRIVATE /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO) @@ -177,28 +182,21 @@ if(WIN32) file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/temp") endif() +endif() - if (BUILD_WITH_NEW_DX12) - target_compile_definitions(${PROJECT_NAME} PRIVATE USING_D3D12_AGILITY_SDK) - - message(STATUS "Downloading Microsoft.Direct3D.D3D12...") - set(DIRECTX_DX12_ARCHIVE "${CMAKE_BINARY_DIR}/Microsoft.Direct3D.D3D12.${DIRECTX_DX12_VERSION}.zip") - file(DOWNLOAD "https://www.nuget.org/api/v2/package/Microsoft.Direct3D.D3D12/${DIRECTX_DX12_VERSION}/" - ${DIRECTX_DX12_ARCHIVE} - EXPECTED_HASH SHA512=05baa55231684ab10a3e905c9b85ce78f04ade9360f7de84a06bbae3bfc3123bcccaa563647a25e151cc759106bc19e37740ef78563592d28e3a723fd744b42f - ) - - file(ARCHIVE_EXTRACT INPUT ${DIRECTX_DX12_ARCHIVE} DESTINATION "${CMAKE_BINARY_DIR}/temp" PATTERNS *${NUGET_ARCH}*dll *${NUGET_ARCH}*exe *${NUGET_ARCH}*pdb) - - file(GLOB_RECURSE DXBINS "${CMAKE_BINARY_DIR}/temp/*.dll" "${CMAKE_BINARY_DIR}/temp/*.exe" $,"${CMAKE_BINARY_DIR}/temp/*.pdb">) - - file(MAKE_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/D3D12") - - foreach(FILE ${DXBINS}) - get_filename_component(FILENAME ${FILE} NAME) - file(COPY_FILE ${FILE} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/D3D12//${FILENAME}") - endforeach(FILE) - - file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/temp") - endif() +add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E $>,copy,true> + $ $ + COMMAND_EXPAND_LISTS + ) + +if(TARGET Microsoft::DirectX12-Agility) + file(MAKE_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/D3D12") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ $/D3D12 + COMMAND ${CMAKE_COMMAND} -E copy $ $/D3D12 + COMMAND ${CMAKE_COMMAND} -E rm -f $/D3D12Core.dll + COMMAND ${CMAKE_COMMAND} -E rm -f $/d3d12SDKLayers.dll + COMMAND_EXPAND_LISTS + ) endif() diff --git a/CMakePresets.json b/CMakePresets.json index c9bdb25..df3179d 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,5 +1,5 @@ { - "version": 2, + "version": 3, "configurePresets": [ { "name": "base", @@ -8,7 +8,7 @@ "generator": "Ninja", "hidden": true, "binaryDir": "${sourceDir}/out/build/${presetName}", - "cacheVariables": { "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}" } + "installDir": "${sourceDir}/out/install/${presetName}" }, { @@ -103,20 +103,17 @@ }, { - "name": "NuGet", + "name": "WARP", "cacheVariables": { - "BUILD_WITH_NEW_WARP": true, - "BUILD_WITH_NEW_DX12": true + "BUILD_WITH_NEW_WARP": true }, "hidden": true }, { "name": "VCPKG", + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": { - "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", - "type": "FILEPATH" - } + "BUILD_WITH_NEW_DX12": true }, "hidden": true }, @@ -130,11 +127,11 @@ { "name": "arm64ec-Debug" , "description": "MSVC for ARM64EC (Debug)", "inherits": [ "base", "ARM64EC", "Debug", "MSVC" ] }, { "name": "arm64ec-Release", "description": "MSVC for ARM64EC (Release)", "inherits": [ "base", "ARM64EC", "Release", "MSVC" ] }, - { "name": "x64-Debug-VCPKG" , "description": "MSVC for x64 (Debug)", "inherits": [ "base", "x64", "Debug", "MSVC", "VCPKG", "NuGet" ] }, - { "name": "x64-Release-VCPKG" , "description": "MSVC for x64 (Release)", "inherits": [ "base", "x64", "Release", "MSVC", "VCPKG", "NuGet" ] }, - { "name": "x86-Debug-VCPKG" , "description": "MSVC for x86 (Debug)", "inherits": [ "base", "x86", "Debug", "MSVC", "VCPKG", "NuGet" ] }, - { "name": "x86-Release-VCPKG" , "description": "MSVC for x86 (Release)", "inherits": [ "base", "x86", "Release", "MSVC", "VCPKG", "NuGet" ] }, - { "name": "arm64-Debug-VCPKG" , "description": "MSVC for ARM64 (Debug)", "inherits": [ "base", "ARM64", "Debug", "MSVC", "VCPKG", "NuGet" ] }, + { "name": "x64-Debug-VCPKG" , "description": "MSVC for x64 (Debug)", "inherits": [ "base", "x64", "Debug", "MSVC", "VCPKG", "WARP" ] }, + { "name": "x64-Release-VCPKG" , "description": "MSVC for x64 (Release)", "inherits": [ "base", "x64", "Release", "MSVC", "VCPKG", "WARP" ] }, + { "name": "x86-Debug-VCPKG" , "description": "MSVC for x86 (Debug)", "inherits": [ "base", "x86", "Debug", "MSVC", "VCPKG", "WARP" ] }, + { "name": "x86-Release-VCPKG" , "description": "MSVC for x86 (Release)", "inherits": [ "base", "x86", "Release", "MSVC", "VCPKG", "WARP" ] }, + { "name": "arm64-Debug-VCPKG" , "description": "MSVC for ARM64 (Debug)", "inherits": [ "base", "ARM64", "Debug", "MSVC", "VCPKG", "WARP" ] }, { "name": "arm64-Release-VCPKG", "description": "MSVC for ARM64 (Release)", "inherits": [ "base", "ARM64", "Release", "MSVC", "VCPKG" ] }, { "name": "arm64ec-Debug-VCPKG" , "description": "MSVC for ARM64EC (Debug)", "inherits": [ "base", "ARM64EC", "Debug", "MSVC", "VCPKG" ], "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } }, { "name": "arm64ec-Release-VCPKG", "description": "MSVC for ARM64EC (Release)", "inherits": [ "base", "ARM64EC", "Release", "MSVC", "VCPKG" ], "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } }, diff --git a/build/vcpkg.json b/build/vcpkg.json index dc7377c..d85e766 100644 --- a/build/vcpkg.json +++ b/build/vcpkg.json @@ -1,6 +1,7 @@ { - "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", - "dependencies": [ - "directx-headers" - ] - } \ No newline at end of file + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "dependencies": [ + "directx-headers", + "directx12-agility" + ] +} From a5956aecb9a1ad9ec0ec7a4a4f991575578420f0 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 17 Dec 2024 11:58:54 -0800 Subject: [PATCH 2/3] Fix up cmake --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4492d06..79ab67c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,7 @@ if(BUILD_WITH_NEW_DX12) message(STATUS "Using DirectX 12 Agility SDK") find_package(directx12-agility CONFIG REQUIRED) target_compile_definitions(${PROJECT_NAME} PRIVATE USING_D3D12_AGILITY_SDK) + target_link_libraries(${PROJECT_NAME} PRIVATE Microsoft::DirectX12-Agility) endif() if(MSVC) From d61ac21d871bc38840d48b02bd61a4fa00f8d4f4 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 17 Dec 2024 12:19:36 -0800 Subject: [PATCH 3/3] Refactored CMake --- CMakeLists.txt | 82 ++----------------- build/CompilerAndLinker.cmake | 144 ++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+), 74 deletions(-) create mode 100644 build/CompilerAndLinker.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 79ab67c..98a85df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,29 +23,7 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") -if(DEFINED VCPKG_TARGET_ARCHITECTURE) - set(DIRECTX_ARCH ${VCPKG_TARGET_ARCHITECTURE}) -elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") - set(DIRECTX_ARCH x86) -elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Xx]64$") - set(DIRECTX_ARCH x64) -elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$") - set(DIRECTX_ARCH arm) -elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$") - set(DIRECTX_ARCH arm64) -elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64EC$") - set(DIRECTX_ARCH arm64ec) -elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Ww][Ii][Nn]32$") - set(DIRECTX_ARCH x86) -elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Xx]64$") - set(DIRECTX_ARCH x64) -elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]$") - set(DIRECTX_ARCH arm) -elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]64$") - set(DIRECTX_ARCH arm64) -elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]64EC$") - set(DIRECTX_ARCH arm64ec) -endif() +include(build/CompilerAndLinker.cmake) add_executable(${PROJECT_NAME} WIN32 ddraw.cpp @@ -75,39 +53,14 @@ if(BUILD_WITH_NEW_DX12) endif() if(MSVC) - target_compile_options(${PROJECT_NAME} PRIVATE /W4 /GR- "$<$>:/guard:cf>") - target_link_options(${PROJECT_NAME} PRIVATE /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO) - - if((CMAKE_SIZEOF_VOID_P EQUAL 4) AND (NOT ${DIRECTX_ARCH} MATCHES "^arm")) - target_link_options(${PROJECT_NAME} PRIVATE /SAFESEH) - endif() - - if((MSVC_VERSION GREATER_EQUAL 1924) - AND ((NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0))) - target_compile_options(${PROJECT_NAME} PRIVATE /ZH:SHA_256) - endif() - - if((MSVC_VERSION GREATER_EQUAL 1928) - AND (CMAKE_SIZEOF_VOID_P EQUAL 8) - AND ((NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0))) - target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") - target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") - endif() -else() - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) + target_compile_options(${PROJECT_NAME} PRIVATE /W4 /GR-) endif() -if(NOT ${DIRECTX_ARCH} MATCHES "^arm") - if(${CMAKE_SIZEOF_VOID_P} EQUAL "4") - set(ARCH_SSE2 $<$:/arch:SSE2> $<$>:-msse2>) - else() - set(ARCH_SSE2 $<$>:-msse2>) - endif() - - target_compile_options(${PROJECT_NAME} PRIVATE ${ARCH_SSE2}) -endif() +target_compile_definitions(${PROJECT_NAME} PRIVATE ${COMPILER_DEFINES}) +target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILER_SWITCHES}) +target_link_options(${PROJECT_NAME} PRIVATE ${LINKER_SWITCHES}) -if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) +if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM" ) target_compile_options(${PROJECT_NAME} PRIVATE "-Wpedantic" "-Wextra" "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" @@ -115,26 +68,8 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-field-initializers") target_compile_options(${PROJECT_NAME} PRIVATE ${WarningsEXE}) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) - target_compile_options(${PROJECT_NAME} PRIVATE /sdl /permissive- /JMC- /Zc:__cplusplus /Zc:inline) - if(ENABLE_CODE_ANALYSIS) - target_compile_options(${PROJECT_NAME} PRIVATE /analyze) - endif() - - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) - target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105) - endif() - - if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) - target_link_options(${PROJECT_NAME} PRIVATE /CETCOMPAT) - endif() - - if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.28) - target_compile_options(${PROJECT_NAME} PRIVATE /Zc:lambda) - endif() - - if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.35) - target_compile_options(${PROJECT_NAME} PRIVATE /Zc:checkGwOdr $<$:/Zc:templateScope>) + target_compile_options(${PROJECT_NAME} PRIVATE /analyze /WX) endif() endif() @@ -147,14 +82,13 @@ if(WIN32) set(WINVER 0x0601) endif() - target_compile_definitions(${PROJECT_NAME} PRIVATE _MBCS _WIN32_WINNT=${WINVER}) + target_compile_definitions(${PROJECT_NAME} PRIVATE _WIN32_WINNT=${WINVER}) endif() set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME}) install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - if(WIN32) if(${DIRECTX_ARCH} STREQUAL "x86") set(NUGET_ARCH win32) diff --git a/build/CompilerAndLinker.cmake b/build/CompilerAndLinker.cmake new file mode 100644 index 0000000..166ea84 --- /dev/null +++ b/build/CompilerAndLinker.cmake @@ -0,0 +1,144 @@ +# This modules provides variables with recommended Compiler and Linker switches +# +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +set(COMPILER_DEFINES "") +set(COMPILER_SWITCHES "") +set(LINKER_SWITCHES "") + +#--- Determines target architecture if not explicitly set +if(DEFINED VCPKG_TARGET_ARCHITECTURE) + set(DIRECTX_ARCH ${VCPKG_TARGET_ARCHITECTURE}) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") + set(DIRECTX_ARCH x86) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Xx]64$") + set(DIRECTX_ARCH x64) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$") + set(DIRECTX_ARCH arm) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$") + set(DIRECTX_ARCH arm64) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64EC$") + set(DIRECTX_ARCH arm64ec) +elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Ww][Ii][Nn]32$") + set(DIRECTX_ARCH x86) +elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Xx]64$") + set(DIRECTX_ARCH x64) +elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]$") + set(DIRECTX_ARCH arm) +elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]64$") + set(DIRECTX_ARCH arm64) +elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]64EC$") + set(DIRECTX_ARCH arm64ec) +endif() + +#--- Determines host architecture +if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "[Aa][Rr][Mm]64|aarch64|arm64") + set(DIRECTX_HOST_ARCH arm64) +else() + set(DIRECTX_HOST_ARCH x64) +endif() + +#--- This legacy tool still uses MB instead of UNICODE +if(WIN32) + list(APPEND COMPILER_DEFINES _MBCS) +endif() + +#--- General MSVC-like SDL options +if(MSVC) + list(APPEND COMPILER_SWITCHES "$<$>:/guard:cf>") + list(APPEND LINKER_SWITCHES /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO) + + if((${DIRECTX_ARCH} STREQUAL "x86") + OR ((CMAKE_SIZEOF_VOID_P EQUAL 4) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm")))) + list(APPEND LINKER_SWITCHES /SAFESEH) + endif() + + if((MSVC_VERSION GREATER_EQUAL 1928) + AND (CMAKE_SIZEOF_VOID_P EQUAL 8) + AND (NOT (TARGET OpenEXR::OpenEXR)) + AND ((NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM")) OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0))) + list(APPEND COMPILER_SWITCHES "$<$>:/guard:ehcont>") + list(APPEND LINKER_SWITCHES "$<$>:/guard:ehcont>") + endif() +else() + list(APPEND COMPILER_DEFINES $,_DEBUG,NDEBUG>) +endif() + +#--- Target architecture switches +if(NOT (${DIRECTX_ARCH} MATCHES "^arm")) + if((${DIRECTX_ARCH} STREQUAL "x86") OR (CMAKE_SIZEOF_VOID_P EQUAL 4)) + set(ARCH_SSE2 $<$:/arch:SSE2> $<$>:-msse2>) + else() + set(ARCH_SSE2 $<$>:-msse2>) + endif() + + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + list(APPEND ARCH_SSE2 -mfpmath=sse) + endif() + + list(APPEND COMPILER_SWITCHES ${ARCH_SSE2}) +endif() + +#--- Compiler-specific switches +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() +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(CMAKE_INTERPROCEDURAL_OPTIMIZATION) + message(STATUS "Building using Whole Program Optimization") + list(APPEND COMPILER_SWITCHES $<$>:/Gy /Gw>) + endif() + + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.10) + list(APPEND COMPILER_SWITCHES /permissive-) + endif() + + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.11) + AND OpenMP_CXX_FOUND) + # OpenMP in MSVC is not compatible with /permissive- unless you disable two-phase lookup + list(APPEND COMPILER_SWITCHES /Zc:twoPhase-) + endif() + + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.14) + list(APPEND COMPILER_SWITCHES /Zc:__cplusplus) + endif() + + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.15) + list(APPEND COMPILER_SWITCHES /JMC-) + endif() + + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) + list(APPEND COMPILER_SWITCHES /ZH:SHA_256) + endif() + + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) + list(APPEND COMPILER_SWITCHES /Zc:preprocessor /wd5104 /wd5105) + endif() + + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) + list(APPEND LINKER_SWITCHES /CETCOMPAT) + endif() + + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.28) + 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) + endif() + + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.35) + if(CMAKE_INTERPROCEDURAL_OPTIMIZATION) + list(APPEND COMPILER_SWITCHES $<$>:/Zc:checkGwOdr>) + endif() + + list(APPEND COMPILER_SWITCHES $<$:/Zc:templateScope>) + endif() +endif()