1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-21 20:10:05 +00:00

Minor review for CMake

This commit is contained in:
Chuck Walbourn 2021-01-13 23:10:06 -08:00
parent 47aabe15cb
commit 0490d4501a

View File

@ -179,22 +179,22 @@ install(FILES
DESTINATION cmake/) DESTINATION cmake/)
#--- Command-line tools #--- Command-line tools
if(BUILD_TOOLS AND WIN32) if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
add_executable(texassemble add_executable(texassemble
Texassemble/texassemble.cpp Texassemble/texassemble.cpp
Texassemble/AnimatedGif.cpp) Texassemble/AnimatedGif.cpp)
target_link_libraries(texassemble ${PROJECT_NAME} version.lib) target_link_libraries(texassemble ${PROJECT_NAME} ole32.lib version.lib)
source_group(texassemble REGULAR_EXPRESSION Texassemble/*.*) source_group(texassemble REGULAR_EXPRESSION Texassemble/*.*)
add_executable(texconv add_executable(texconv
Texconv/texconv.cpp Texconv/texconv.cpp
Texconv/ExtendedBMP.cpp Texconv/ExtendedBMP.cpp
Texconv/PortablePixMap.cpp) Texconv/PortablePixMap.cpp)
target_link_libraries(texconv ${PROJECT_NAME} version.lib) target_link_libraries(texconv ${PROJECT_NAME} ole32.lib shell32.lib version.lib)
source_group(texconv REGULAR_EXPRESSION Texconv/*.*) source_group(texconv REGULAR_EXPRESSION Texconv/*.*)
add_executable(texdiag Texdiag/texdiag.cpp) add_executable(texdiag Texdiag/texdiag.cpp)
target_link_libraries(texdiag ${PROJECT_NAME} version.lib) target_link_libraries(texdiag ${PROJECT_NAME} ole32.lib version.lib)
source_group(texdiag REGULAR_EXPRESSION Texdiag/*.*) source_group(texdiag REGULAR_EXPRESSION Texdiag/*.*)
if(ENABLE_OPENEXR_SUPPORT) if(ENABLE_OPENEXR_SUPPORT)
@ -210,15 +210,15 @@ endif()
if(MSVC) if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /fp:fast) target_compile_options(${PROJECT_NAME} PRIVATE /fp:fast)
if(BUILD_TOOLS AND WIN32) if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(texassemble PRIVATE /fp:fast) target_compile_options(texassemble PRIVATE /fp:fast)
target_compile_options(texconv PRIVATE /fp:fast) target_compile_options(texconv PRIVATE /fp:fast)
target_compile_options(texdiag PRIVATE /fp:fast) target_compile_options(texdiag PRIVATE /fp:fast)
endif() endif()
if (${CMAKE_SIZEOF_VOID_P} EQUAL "4") if ((${CMAKE_SIZEOF_VOID_P} EQUAL "4") AND (NOT ${CMAKE_VS_PLATFORM_NAME} MATCHES "arm"))
target_compile_options(${PROJECT_NAME} PRIVATE /arch:SSE2) target_compile_options(${PROJECT_NAME} PRIVATE /arch:SSE2)
if(BUILD_TOOLS AND WIN32) if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(texassemble PRIVATE /arch:SSE2) target_compile_options(texassemble PRIVATE /arch:SSE2)
target_compile_options(texconv PRIVATE /arch:SSE2) target_compile_options(texconv PRIVATE /arch:SSE2)
target_compile_options(texdiag PRIVATE /arch:SSE2) target_compile_options(texdiag PRIVATE /arch:SSE2)
@ -232,7 +232,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# OpenMP is not supported for clang for Windows by default # OpenMP is not supported for clang for Windows by default
if(BUILD_TOOLS AND WIN32) if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
set(WarningsEXE ${WarningsLib} "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" "-Wno-switch" "-Wno-switch-enum" "-Wno-language-extension-token" "-Wno-missing-prototypes") set(WarningsEXE ${WarningsLib} "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" "-Wno-switch" "-Wno-switch-enum" "-Wno-language-extension-token" "-Wno-missing-prototypes")
target_compile_options(texassemble PRIVATE ${WarningsEXE}) target_compile_options(texassemble PRIVATE ${WarningsEXE})
target_compile_options(texconv PRIVATE ${WarningsEXE} "-Wno-global-constructors") target_compile_options(texconv PRIVATE ${WarningsEXE} "-Wno-global-constructors")
@ -241,7 +241,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif() endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
target_compile_options(${PROJECT_NAME} PRIVATE /permissive- /JMC- /Zc:__cplusplus) target_compile_options(${PROJECT_NAME} PRIVATE /permissive- /JMC- /Zc:__cplusplus)
if(BUILD_TOOLS AND WIN32) if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(texassemble PRIVATE /permissive- /Zc:__cplusplus) target_compile_options(texassemble PRIVATE /permissive- /Zc:__cplusplus)
target_compile_options(texconv PRIVATE /permissive- /Zc:__cplusplus) target_compile_options(texconv PRIVATE /permissive- /Zc:__cplusplus)
target_compile_options(texdiag PRIVATE /permissive- /Zc:__cplusplus) target_compile_options(texdiag PRIVATE /permissive- /Zc:__cplusplus)
@ -249,7 +249,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if(ENABLE_CODE_ANALYSIS) if(ENABLE_CODE_ANALYSIS)
target_compile_options(${PROJECT_NAME} PRIVATE /analyze) target_compile_options(${PROJECT_NAME} PRIVATE /analyze)
if(BUILD_TOOLS AND WIN32) if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(texassemble PRIVATE /analyze) target_compile_options(texassemble PRIVATE /analyze)
target_compile_options(texconv PRIVATE /analyze) target_compile_options(texconv PRIVATE /analyze)
target_compile_options(texdiag PRIVATE /analyze) target_compile_options(texdiag PRIVATE /analyze)
@ -258,7 +258,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26)
target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105) target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105)
if(BUILD_TOOLS AND WIN32) if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(texassemble PRIVATE /Zc:preprocessor /wd5105) target_compile_options(texassemble PRIVATE /Zc:preprocessor /wd5105)
target_compile_options(texconv PRIVATE /Zc:preprocessor /wd5105) target_compile_options(texconv PRIVATE /Zc:preprocessor /wd5105)
target_compile_options(texdiag PRIVATE /Zc:preprocessor /wd5105) target_compile_options(texdiag PRIVATE /Zc:preprocessor /wd5105)
@ -267,13 +267,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if(BC_USE_OPENMP) if(BC_USE_OPENMP)
target_compile_options(${PROJECT_NAME} PRIVATE /openmp /Zc:twoPhase-) target_compile_options(${PROJECT_NAME} PRIVATE /openmp /Zc:twoPhase-)
if(BUILD_TOOLS AND WIN32) if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(texconv PRIVATE /openmp /Zc:twoPhase-) target_compile_options(texconv PRIVATE /openmp /Zc:twoPhase-)
endif() endif()
endif() endif()
if(BUILD_TOOLS AND WIN32) if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
set(WarningsEXE "/wd4061" "/wd4062" "/wd4365" "/wd4668" "/wd4710" "/wd4820" "/wd5039" "/wd5045" "/wd5219") set(WarningsEXE "/wd4061" "/wd4062" "/wd4365" "/wd4514" "/wd4625" "/wd4626" "/wd4627" "/wd4668" "/wd4710" "/wd4751" "/wd4820" "/wd5026" "/wd5027" "/wd5039" "/wd5045" "/wd5219")
target_compile_options(texassemble PRIVATE ${WarningsEXE}) target_compile_options(texassemble PRIVATE ${WarningsEXE})
target_compile_options(texconv PRIVATE ${WarningsEXE}) target_compile_options(texconv PRIVATE ${WarningsEXE})
target_compile_options(texdiag PRIVATE ${WarningsEXE}) target_compile_options(texdiag PRIVATE ${WarningsEXE})
@ -282,7 +282,7 @@ endif()
if(WIN32) if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE _UNICODE UNICODE) target_compile_definitions(${PROJECT_NAME} PRIVATE _UNICODE UNICODE)
if(BUILD_TOOLS) if(BUILD_TOOLS AND (NOT WINDOWS_STORE))
target_compile_definitions(texassemble PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601) target_compile_definitions(texassemble PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
target_compile_definitions(texconv PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601) target_compile_definitions(texconv PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
target_compile_definitions(texdiag PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601) target_compile_definitions(texdiag PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
@ -295,6 +295,6 @@ if(WIN32)
endif() endif()
endif() endif()
if(BUILD_TOOLS AND WIN32) if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT texconv) set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT texconv)
endif() endif()