From fa22a4ec53dcc67505e66eca0c788ad8feed6b34 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Fri, 5 Apr 2024 14:37:53 -0700 Subject: [PATCH] Update compiler build settings for CMake (#458) --- CMakeLists.txt | 8 ++++++++ build/CompilerAndLinker.cmake | 4 ++++ build/DirectXTex-GitHub-CMake-Xbox-Dev17.yml | 13 ++++++++++++- build/DirectXTex-GitHub-Dev17.yml | 10 +++++++++- build/DirectXTex-GitHub-GDK-Dev17.yml | 10 +++++++++- build/DirectXTex-GitHub-Test-Dev17.yml | 10 +++++++++- build/DirectXTex-GitHub-WSL-11.yml | 13 ++++++++++++- 7 files changed, 63 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2063c00..e5d97b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -560,6 +560,14 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14) elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.37) + AND (NOT (${DIRECTX_ARCH} MATCHES "^arm")) + AND ((${DIRECTX_ARCH} MATCHES "x64") OR (CMAKE_SIZEOF_VOID_P EQUAL 8))) + # Enable since DirectXTex library has a lot of large switch statements + target_compile_options(${PROJECT_NAME} PRIVATE /jumptablerdata) + endif() + if(ENABLE_CODE_ANALYSIS) foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME}) target_compile_options(${t} PRIVATE /analyze) diff --git a/build/CompilerAndLinker.cmake b/build/CompilerAndLinker.cmake index ee290fc..759491f 100644 --- a/build/CompilerAndLinker.cmake +++ b/build/CompilerAndLinker.cmake @@ -66,6 +66,10 @@ elseif(NOT (${DIRECTX_ARCH} MATCHES "^arm")) 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() diff --git a/build/DirectXTex-GitHub-CMake-Xbox-Dev17.yml b/build/DirectXTex-GitHub-CMake-Xbox-Dev17.yml index cdc4fef..29fed48 100644 --- a/build/DirectXTex-GitHub-CMake-Xbox-Dev17.yml +++ b/build/DirectXTex-GitHub-CMake-Xbox-Dev17.yml @@ -13,13 +13,24 @@ schedules: - main trigger: none -pr: none + +pr: + branches: + include: + - main + paths: + include: + - CMake* + - build/*.cmake + - build/*.in + - build/DirectXTex-GitHub-CMake-Xbox-Dev17.yml resources: repositories: - repository: self type: git ref: refs/heads/main + trigger: none name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) diff --git a/build/DirectXTex-GitHub-Dev17.yml b/build/DirectXTex-GitHub-Dev17.yml index e5e5ab5..162dc29 100644 --- a/build/DirectXTex-GitHub-Dev17.yml +++ b/build/DirectXTex-GitHub-Dev17.yml @@ -13,13 +13,21 @@ schedules: - main trigger: none -pr: none + +pr: + branches: + include: + - main + paths: + include: + - build/DirectXTex-GitHub-Dev17.yml resources: repositories: - repository: self type: git ref: refs/heads/main + trigger: none name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) diff --git a/build/DirectXTex-GitHub-GDK-Dev17.yml b/build/DirectXTex-GitHub-GDK-Dev17.yml index 5da13f5..3f196e4 100644 --- a/build/DirectXTex-GitHub-GDK-Dev17.yml +++ b/build/DirectXTex-GitHub-GDK-Dev17.yml @@ -13,13 +13,21 @@ schedules: - main trigger: none -pr: none + +pr: + branches: + include: + - main + paths: + include: + - build/DirectXTex-GitHub-GDK-Dev17.yml resources: repositories: - repository: self type: git ref: refs/heads/main + trigger: none name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) diff --git a/build/DirectXTex-GitHub-Test-Dev17.yml b/build/DirectXTex-GitHub-Test-Dev17.yml index 0ae59d4..e521f1c 100644 --- a/build/DirectXTex-GitHub-Test-Dev17.yml +++ b/build/DirectXTex-GitHub-Test-Dev17.yml @@ -13,13 +13,21 @@ schedules: - main trigger: none -pr: none + +pr: + branches: + include: + - main + paths: + include: + - build/DirectXTex-GitHub-Test-Dev17.yml resources: repositories: - repository: self type: git ref: refs/heads/main + trigger: none name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) diff --git a/build/DirectXTex-GitHub-WSL-11.yml b/build/DirectXTex-GitHub-WSL-11.yml index d321a7e..60dc476 100644 --- a/build/DirectXTex-GitHub-WSL-11.yml +++ b/build/DirectXTex-GitHub-WSL-11.yml @@ -13,13 +13,24 @@ schedules: - main trigger: none -pr: none + +pr: + branches: + include: + - main + paths: + include: + - CMake* + - build/*.cmake + - build/*.in + - build/DirectXTex-GitHub-WSL-11.yml resources: repositories: - repository: self type: git ref: refs/heads/main + trigger: none name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)