mirror of
https://github.com/microsoft/DirectXTex
synced 2024-11-24 21:30:14 +00:00
More Cmake updates
This commit is contained in:
parent
ef39abc38d
commit
18b17e2248
119
CMakeLists.txt
119
CMakeLists.txt
@ -40,6 +40,14 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/CMake")
|
||||
|
||||
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)
|
||||
endif()
|
||||
|
||||
#--- Library
|
||||
@ -203,6 +211,8 @@ install(FILES
|
||||
|
||||
#--- Command-line tools
|
||||
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
|
||||
set(TOOL_EXES texassemble texconv texdiag)
|
||||
|
||||
add_executable(texassemble
|
||||
Texassemble/texassemble.cpp
|
||||
Texassemble/AnimatedGif.cpp)
|
||||
@ -221,37 +231,29 @@ if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
|
||||
source_group(texdiag REGULAR_EXPRESSION Texdiag/*.*)
|
||||
|
||||
if(ENABLE_OPENEXR_SUPPORT)
|
||||
target_link_libraries(texassemble ${OPENEXR_ILMIMF_LIBRARY})
|
||||
target_link_libraries(texconv ${OPENEXR_ILMIMF_LIBRARY})
|
||||
target_link_libraries(texdiag ${OPENEXR_ILMIMF_LIBRARY})
|
||||
|
||||
target_compile_options(texassemble PRIVATE -DUSE_OPENEXR)
|
||||
target_compile_options(texconv PRIVATE -DUSE_OPENEXR)
|
||||
target_compile_options(texdiag PRIVATE -DUSE_OPENEXR)
|
||||
foreach(t IN LISTS TOOL_EXES)
|
||||
target_link_libraries(${t} ${OPENEXR_ILMIMF_LIBRARY})
|
||||
target_compile_options(${t} PRIVATE -DUSE_OPENEXR)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if (VCPKG_TOOLCHAIN)
|
||||
target_link_libraries(texassemble Microsoft::DirectXMath)
|
||||
target_link_libraries(texconv Microsoft::DirectXMath)
|
||||
target_link_libraries(texdiag Microsoft::DirectXMath)
|
||||
foreach(t IN LISTS TOOL_EXES)
|
||||
target_link_libraries(${t} Microsoft::DirectXMath)
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /fp:fast)
|
||||
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
|
||||
target_compile_options(texassemble PRIVATE /fp:fast)
|
||||
target_compile_options(texconv PRIVATE /fp:fast)
|
||||
target_compile_options(texdiag PRIVATE /fp:fast)
|
||||
endif()
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
target_compile_options(${t} PRIVATE /fp:fast "$<$<NOT:$<CONFIG:DEBUG>>:/guard:cf>")
|
||||
endforeach()
|
||||
|
||||
if((${CMAKE_SIZEOF_VOID_P} EQUAL 4) AND (NOT ${DIRECTX_ARCH} MATCHES "arm"))
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /arch:SSE2)
|
||||
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
|
||||
target_compile_options(texassemble PRIVATE /arch:SSE2)
|
||||
target_compile_options(texconv PRIVATE /arch:SSE2)
|
||||
target_compile_options(texdiag PRIVATE /arch:SSE2)
|
||||
endif()
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
target_compile_options(${t} PRIVATE /arch:SSE2)
|
||||
target_link_options(${t} PRIVATE /SAFESEH)
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -261,54 +263,38 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
|
||||
# OpenMP is not supported for clang for Windows by default
|
||||
|
||||
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")
|
||||
target_compile_options(texassemble PRIVATE ${WarningsEXE})
|
||||
target_compile_options(texconv PRIVATE ${WarningsEXE} "-Wno-global-constructors")
|
||||
target_compile_options(texdiag PRIVATE ${WarningsEXE} "-Wno-double-promotion")
|
||||
endif()
|
||||
set(WarningsEXE ${WarningsLib} "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" "-Wno-switch" "-Wno-switch-enum" "-Wno-language-extension-token" "-Wno-missing-prototypes" "-Wno-global-constructors" "-Wno-double-promotion")
|
||||
foreach(t IN LISTS TOOL_EXES)
|
||||
target_compile_options(${t} PRIVATE ${WarningsEXE})
|
||||
endforeach()
|
||||
endif()
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /permissive- /JMC- /Zc:__cplusplus)
|
||||
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
|
||||
target_compile_options(texassemble PRIVATE /permissive- /Zc:__cplusplus)
|
||||
target_compile_options(texconv PRIVATE /permissive- /Zc:__cplusplus)
|
||||
target_compile_options(texdiag PRIVATE /permissive- /Zc:__cplusplus)
|
||||
endif()
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
target_compile_options(${t} PRIVATE /sdl /permissive- /Zc:__cplusplus)
|
||||
endforeach()
|
||||
|
||||
if(ENABLE_CODE_ANALYSIS)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /analyze)
|
||||
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
|
||||
target_compile_options(texassemble PRIVATE /analyze)
|
||||
target_compile_options(texconv PRIVATE /analyze)
|
||||
target_compile_options(texdiag PRIVATE /analyze)
|
||||
endif()
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
target_compile_options(${t} PRIVATE /analyze)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /ZH:SHA_256)
|
||||
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
|
||||
target_compile_options(texassemble PRIVATE /ZH:SHA_256)
|
||||
target_compile_options(texconv PRIVATE /ZH:SHA_256)
|
||||
target_compile_options(texdiag PRIVATE /ZH:SHA_256)
|
||||
endif()
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
target_compile_options(${t} PRIVATE /ZH:SHA_256)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105)
|
||||
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
|
||||
target_compile_options(texassemble PRIVATE /Zc:preprocessor /wd5105)
|
||||
target_compile_options(texconv PRIVATE /Zc:preprocessor /wd5105)
|
||||
target_compile_options(texdiag PRIVATE /Zc:preprocessor /wd5105)
|
||||
endif()
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
target_compile_options(${t} PRIVATE /Zc:preprocessor /wd5105)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "arm(64)?")))
|
||||
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
|
||||
target_link_options(texassemble PRIVATE /CETCOMPAT)
|
||||
target_link_options(texconv PRIVATE /CETCOMPAT)
|
||||
target_link_options(texdiag PRIVATE /CETCOMPAT)
|
||||
endif()
|
||||
foreach(t IN LISTS TOOL_EXES)
|
||||
target_link_options(${t} PRIVATE /CETCOMPAT)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(BC_USE_OPENMP)
|
||||
@ -318,21 +304,16 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
|
||||
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(texconv PRIVATE ${WarningsEXE})
|
||||
target_compile_options(texdiag PRIVATE ${WarningsEXE})
|
||||
endif()
|
||||
set(WarningsEXE "/wd4061" "/wd4062" "/wd4365" "/wd4514" "/wd4625" "/wd4626" "/wd4627" "/wd4668" "/wd4710" "/wd4751" "/wd4820" "/wd5026" "/wd5027" "/wd5039" "/wd5045" "/wd5219")
|
||||
foreach(t IN LISTS TOOL_EXES)
|
||||
target_compile_options(${t} PRIVATE ${WarningsEXE})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE _UNICODE UNICODE)
|
||||
if(BUILD_TOOLS AND (NOT WINDOWS_STORE))
|
||||
target_compile_definitions(texassemble 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)
|
||||
endif()
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
target_compile_definitions(${t} PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
|
||||
endforeach()
|
||||
|
||||
if(WINDOWS_STORE)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE WINAPI_FAMILY=WINAPI_FAMILY_APP)
|
||||
|
Loading…
Reference in New Issue
Block a user