mirror of
https://github.com/microsoft/DirectXTex
synced 2024-11-21 12:00:06 +00:00
CMake code review (#445)
This commit is contained in:
parent
154bb7c3bb
commit
4efb955122
@ -88,7 +88,7 @@ if(WINDOWS_STORE OR (DEFINED XBOX_CONSOLE_TARGET))
|
||||
set(BUILD_SAMPLE OFF)
|
||||
endif()
|
||||
|
||||
if(DEFINED XBOX_CONSOLE_TARGET)
|
||||
if((DEFINED XBOX_CONSOLE_TARGET) AND (NOT (XBOX_CONSOLE_TARGET STREQUAL "durango")))
|
||||
set(BUILD_DX11 OFF)
|
||||
endif()
|
||||
|
||||
@ -471,10 +471,6 @@ if(BUILD_TOOLS AND BUILD_DX11 AND WIN32)
|
||||
target_link_libraries(texconv PRIVATE ${PROJECT_NAME} ole32.lib shell32.lib version.lib)
|
||||
source_group(texconv REGULAR_EXPRESSION Texconv/*.*)
|
||||
list(APPEND TOOL_EXES texconv)
|
||||
|
||||
if(BC_USE_OPENMP)
|
||||
target_link_libraries(texconv PRIVATE OpenMP::OpenMP_CXX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_TOOLS AND WIN32)
|
||||
@ -648,12 +644,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
list(APPEND WarningsLib "-Wno-reserved-identifier")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
|
||||
list(APPEND WarningsLib "-Wno-unsafe-buffer-usage")
|
||||
endif()
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE ${WarningsLib})
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
|
||||
list(APPEND WarningsLib "-Wno-unsafe-buffer-usage")
|
||||
endif()
|
||||
@ -708,16 +698,21 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.35)
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
target_compile_options(${t} PRIVATE /Zc:checkGwOdr $<$<VERSION_GREATER_EQUAL:${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION},10.0.22000>:/Zc:templateScope>)
|
||||
target_compile_options(${t} PRIVATE /Zc:checkGwOdr)
|
||||
endforeach()
|
||||
|
||||
if(NOT (DEFINED XBOX_CONSOLE_TARGET))
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
target_compile_options(${t} PRIVATE $<$<VERSION_GREATER_EQUAL:${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION},10.0.22000>:/Zc:templateScope>)
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BC_USE_OPENMP)
|
||||
# OpenMP in MSVC is not compatible with /permissive unless you disable two-phase lookup
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /Zc:twoPhase-)
|
||||
if(BUILD_TOOLS AND BUILD_DX11 AND WIN32)
|
||||
target_compile_options(texconv PRIVATE /Zc:twoPhase-)
|
||||
endif()
|
||||
if(OpenMP_CXX_FOUND)
|
||||
# OpenMP in MSVC is not compatible with /permissive- unless you disable two-phase lookup
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
target_compile_options(${t} PRIVATE /Zc:twoPhase-)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
set(WarningsEXE "/wd4061" "/wd4062" "/wd4365" "/wd4514" "/wd4625" "/wd4626" "/wd4627" "/wd4668" "/wd4710" "/wd4711" "/wd4751" "/wd4820" "/wd5026" "/wd5027" "/wd5039" "/wd5045" "/wd5219")
|
||||
@ -767,19 +762,18 @@ endif()
|
||||
|
||||
if(BUILD_TOOLS AND (NOT VCPKG_TOOLCHAIN))
|
||||
foreach(t IN LISTS TOOL_EXES)
|
||||
install(TARGETS ${t}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(TARGETS ${t} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
#--- Test suite
|
||||
include(CTest)
|
||||
if(BUILD_TESTING AND WIN32 AND (NOT WINDOWS_STORE) AND (NOT (DEFINED XBOX_CONSOLE_TARGET))
|
||||
AND (EXISTS "${CMAKE_CURRENT_LIST_DIR}/Tests/CMakeLists.txt"))
|
||||
enable_testing()
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/Tests)
|
||||
elseif(BUILD_FUZZING AND WIN32 AND (NOT WINDOWS_STORE) AND (NOT (DEFINED XBOX_CONSOLE_TARGET))
|
||||
AND (EXISTS "${CMAKE_CURRENT_LIST_DIR}/Tests/fuzzloaders/CMakeLists.txt"))
|
||||
message(STATUS "Building for fuzzing")
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/Tests/fuzzloaders)
|
||||
if(WIN32 AND (NOT WINDOWS_STORE) AND (NOT (DEFINED XBOX_CONSOLE_TARGET)))
|
||||
include(CTest)
|
||||
if(BUILD_TESTING AND (EXISTS "${CMAKE_CURRENT_LIST_DIR}/Tests/CMakeLists.txt"))
|
||||
enable_testing()
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/Tests)
|
||||
elseif(BUILD_FUZZING AND (EXISTS "${CMAKE_CURRENT_LIST_DIR}/Tests/fuzzloaders/CMakeLists.txt"))
|
||||
message(STATUS "Building for fuzzing")
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/Tests/fuzzloaders)
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user