|
|
|
|
@@ -257,7 +257,7 @@ if(ENABLE_OPENEXR_SUPPORT)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(BUILD_XBOX_EXTS_SCARLETT AND WIN32)
|
|
|
|
|
if (EXISTS "${GameDK_DIR}/GXDK/toolKit/include/gxdk.h")
|
|
|
|
|
if(EXISTS "${GameDK_DIR}/GXDK/toolKit/include/gxdk.h")
|
|
|
|
|
message(STATUS "Building Xbox extensions for Xbox Series X|S")
|
|
|
|
|
|
|
|
|
|
add_library(Xbox::GDKX SHARED IMPORTED)
|
|
|
|
|
@@ -275,7 +275,7 @@ if(BUILD_XBOX_EXTS_SCARLETT AND WIN32)
|
|
|
|
|
message(FATAL_ERROR "Building Xbox extensions requires GameDKLatest")
|
|
|
|
|
endif()
|
|
|
|
|
elseif(BUILD_XBOX_EXTS_XBOXONE AND WIN32)
|
|
|
|
|
if (EXISTS "${GameDK_DIR}/GXDK/toolKit/include/gxdk.h")
|
|
|
|
|
if(EXISTS "${GameDK_DIR}/GXDK/toolKit/include/gxdk.h")
|
|
|
|
|
message(STATUS "Building Xbox extensions for XboxOne using the Microsoft GDK")
|
|
|
|
|
|
|
|
|
|
add_library(Xbox::GDKX SHARED IMPORTED)
|
|
|
|
|
@@ -290,7 +290,7 @@ elseif(BUILD_XBOX_EXTS_XBOXONE AND WIN32)
|
|
|
|
|
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_XBOX_EXTS)
|
|
|
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC Xbox::GDKX)
|
|
|
|
|
|
|
|
|
|
elseif (EXISTS "${XboxOneXDK_DIR}/PC/include/xdk.h")
|
|
|
|
|
elseif(EXISTS "${XboxOneXDK_DIR}/PC/include/xdk.h")
|
|
|
|
|
message(STATUS "Building Xbox extensions for XboxOne using the Xbox One XDK")
|
|
|
|
|
|
|
|
|
|
add_library(Xbox::XDK SHARED IMPORTED)
|
|
|
|
|
@@ -456,6 +456,7 @@ if(BUILD_TOOLS AND WIN32)
|
|
|
|
|
Texassemble/texassemble.rc
|
|
|
|
|
Texassemble/settings.manifest
|
|
|
|
|
Texassemble/AnimatedGif.cpp)
|
|
|
|
|
target_compile_features(texassemble PRIVATE cxx_std_17)
|
|
|
|
|
target_link_libraries(texassemble PRIVATE ${PROJECT_NAME} ole32.lib version.lib)
|
|
|
|
|
source_group(texassemble REGULAR_EXPRESSION Texassemble/*.*)
|
|
|
|
|
list(APPEND TOOL_EXES texassemble)
|
|
|
|
|
@@ -468,6 +469,7 @@ if(BUILD_TOOLS AND BUILD_DX11 AND WIN32)
|
|
|
|
|
Texconv/settings.manifest
|
|
|
|
|
Texconv/ExtendedBMP.cpp
|
|
|
|
|
Texconv/PortablePixMap.cpp)
|
|
|
|
|
target_compile_features(texconv PRIVATE cxx_std_17)
|
|
|
|
|
target_link_libraries(texconv PRIVATE ${PROJECT_NAME} ole32.lib shell32.lib version.lib)
|
|
|
|
|
source_group(texconv REGULAR_EXPRESSION Texconv/*.*)
|
|
|
|
|
list(APPEND TOOL_EXES texconv)
|
|
|
|
|
@@ -478,6 +480,7 @@ if(BUILD_TOOLS AND WIN32)
|
|
|
|
|
Texdiag/texdiag.cpp
|
|
|
|
|
Texdiag/texdiag.rc
|
|
|
|
|
Texdiag/settings.manifest)
|
|
|
|
|
target_compile_features(texdiag PRIVATE cxx_std_17)
|
|
|
|
|
target_link_libraries(texdiag PRIVATE ${PROJECT_NAME} ole32.lib version.lib)
|
|
|
|
|
source_group(texdiag REGULAR_EXPRESSION Texdiag/*.*)
|
|
|
|
|
list(APPEND TOOL_EXES texdiag)
|
|
|
|
|
@@ -510,7 +513,7 @@ if(BUILD_TOOLS AND WIN32)
|
|
|
|
|
target_compile_definitions(texconv PRIVATE USE_XBOX_EXTS)
|
|
|
|
|
target_link_libraries(texconv PUBLIC $<TARGET_NAME_IF_EXISTS:Xbox::GDKX> $<TARGET_NAME_IF_EXISTS:Xbox::XDK>)
|
|
|
|
|
|
|
|
|
|
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.21")
|
|
|
|
|
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.21")
|
|
|
|
|
add_custom_command(TARGET texconv POST_BUILD
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
|
$<TARGET_RUNTIME_DLLS:texconv> $<TARGET_FILE_DIR:texconv>
|
|
|
|
|
@@ -573,32 +576,14 @@ if(MSVC)
|
|
|
|
|
endforeach()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(ENABLE_SPECTRE_MITIGATION
|
|
|
|
|
AND (MSVC_VERSION GREATER_EQUAL 1913)
|
|
|
|
|
AND (NOT WINDOWS_STORE)
|
|
|
|
|
AND (NOT ENABLE_OPENEXR_SUPPORT)
|
|
|
|
|
AND (NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang")))
|
|
|
|
|
message(STATUS "Building Spectre-mitigated libraries")
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_compile_options(${t} PRIVATE "/Qspectre")
|
|
|
|
|
endforeach()
|
|
|
|
|
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)))
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_compile_options(${t} PRIVATE /ZH:SHA_256)
|
|
|
|
|
endforeach()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if((MSVC_VERSION GREATER_EQUAL 1928)
|
|
|
|
|
AND (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
|
AND NOT ENABLE_OPENEXR_SUPPORT
|
|
|
|
|
AND ((NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)))
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_compile_options(${t} PRIVATE "$<$<NOT:$<CONFIG:DEBUG>>:/guard:ehcont>")
|
|
|
|
|
target_link_options(${t} PRIVATE "$<$<NOT:$<CONFIG:DEBUG>>:/guard:ehcont>")
|
|
|
|
|
endforeach()
|
|
|
|
|
AND ((NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM")) OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)))
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_compile_options(${t} PRIVATE "$<$<NOT:$<CONFIG:DEBUG>>:/guard:ehcont>")
|
|
|
|
|
target_link_options(${t} PRIVATE "$<$<NOT:$<CONFIG:DEBUG>>:/guard:ehcont>")
|
|
|
|
|
endforeach()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(NO_WCHAR_T)
|
|
|
|
|
@@ -619,9 +604,9 @@ elseif(XBOX_CONSOLE_TARGET MATCHES "(xboxone|durango)")
|
|
|
|
|
target_compile_options(${PROJECT_NAME} PRIVATE $<IF:$<CXX_COMPILER_ID:MSVC>,/favor:AMD64 /arch:AVX,-march=btver2>)
|
|
|
|
|
elseif(NOT (${DIRECTX_ARCH} MATCHES "^arm"))
|
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
|
|
|
set(ARCH_SSE2 $<$<CXX_COMPILER_ID:MSVC>:/arch:SSE2> $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-msse2>)
|
|
|
|
|
set(ARCH_SSE2 $<$<CXX_COMPILER_ID:MSVC,Intel>:/arch:SSE2> $<$<NOT:$<CXX_COMPILER_ID:MSVC,Intel>>:-msse2>)
|
|
|
|
|
else()
|
|
|
|
|
set(ARCH_SSE2 $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-msse2>)
|
|
|
|
|
set(ARCH_SSE2 $<$<NOT:$<CXX_COMPILER_ID:MSVC,Intel>>:-msse2>)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
@@ -635,7 +620,13 @@ if(MINGW)
|
|
|
|
|
endforeach()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM")
|
|
|
|
|
if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0))
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_compile_options(${t} PRIVATE /ZH:SHA_256)
|
|
|
|
|
endforeach()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
set(WarningsLib -Wall -Wpedantic -Wextra)
|
|
|
|
|
|
|
|
|
|
if((BUILD_XBOX_EXTS_XBOXONE OR BUILD_XBOX_EXTS_SCARLETT) AND WIN32)
|
|
|
|
|
@@ -657,6 +648,11 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_compile_options(${t} PRIVATE "-Wno-ignored-attributes" "-Walloc-size-larger-than=4GB")
|
|
|
|
|
endforeach()
|
|
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_compile_options(${t} PRIVATE /Zc:__cplusplus /Zc:inline /fp:fast /Qdiag-disable:161)
|
|
|
|
|
endforeach()
|
|
|
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14)
|
|
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_compile_options(${t} PRIVATE /sdl /permissive- /JMC- /Zc:__cplusplus /Zc:inline /fp:fast)
|
|
|
|
|
@@ -675,64 +671,82 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
|
|
|
endforeach()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26)
|
|
|
|
|
if(ENABLE_SPECTRE_MITIGATION
|
|
|
|
|
AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.13)
|
|
|
|
|
AND (NOT ENABLE_OPENEXR_SUPPORT)
|
|
|
|
|
AND (NOT WINDOWS_STORE))
|
|
|
|
|
message(STATUS "Building Spectre-mitigated libraries")
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_compile_options(${t} PRIVATE /Zc:preprocessor /wd5105)
|
|
|
|
|
target_compile_options(${t} PRIVATE "/Qspectre")
|
|
|
|
|
endforeach()
|
|
|
|
|
if(BUILD_XBOX_EXTS_XBOXONE)
|
|
|
|
|
target_compile_options(${PROJECT_NAME} PRIVATE /wd5104 /wd5204)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24)
|
|
|
|
|
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)
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_compile_options(${t} PRIVATE /Zc:preprocessor /wd5105)
|
|
|
|
|
endforeach()
|
|
|
|
|
if(BUILD_XBOX_EXTS_XBOXONE)
|
|
|
|
|
target_compile_options(${PROJECT_NAME} PRIVATE /wd5104 /wd5204)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm")))
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_link_options(${t} PRIVATE /CETCOMPAT)
|
|
|
|
|
endforeach()
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_link_options(${t} PRIVATE /CETCOMPAT)
|
|
|
|
|
endforeach()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.28)
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_compile_options(${t} PRIVATE /Zc:lambda)
|
|
|
|
|
endforeach()
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_compile_options(${t} PRIVATE /Zc:lambda)
|
|
|
|
|
endforeach()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
endforeach()
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
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()
|
|
|
|
|
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(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()
|
|
|
|
|
# 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")
|
|
|
|
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34)
|
|
|
|
|
list(APPEND WarningsEXE "/wd5262" "/wd5264")
|
|
|
|
|
list(APPEND WarningsEXE "/wd5262" "/wd5264")
|
|
|
|
|
endif()
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES)
|
|
|
|
|
target_compile_options(${t} PRIVATE ${WarningsEXE})
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
if (BUILD_FUZZING AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.32)
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_compile_options(${t} PRIVATE /fsanitize=address /fsanitize-coverage=inline-8bit-counters /fsanitize-coverage=edge /fsanitize-coverage=trace-cmp /fsanitize-coverage=trace-div)
|
|
|
|
|
target_link_libraries(${t} PRIVATE sancov.lib)
|
|
|
|
|
endforeach()
|
|
|
|
|
if(BUILD_FUZZING
|
|
|
|
|
AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.32)
|
|
|
|
|
AND (NOT WINDOWS_STORE))
|
|
|
|
|
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
|
|
|
|
target_compile_options(${t} PRIVATE /fsanitize=address /fsanitize-coverage=inline-8bit-counters /fsanitize-coverage=edge /fsanitize-coverage=trace-cmp /fsanitize-coverage=trace-div)
|
|
|
|
|
target_link_libraries(${t} PRIVATE sancov.lib)
|
|
|
|
|
endforeach()
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
|
if (XBOX_CONSOLE_TARGET STREQUAL "durango")
|
|
|
|
|
if(XBOX_CONSOLE_TARGET STREQUAL "durango")
|
|
|
|
|
set(WINVER 0x0602)
|
|
|
|
|
elseif(BUILD_DX12 OR (${DIRECTX_ARCH} MATCHES "^arm64"))
|
|
|
|
|
message(STATUS "Building with DirectX 12 Runtime support")
|
|
|
|
|
@@ -757,7 +771,7 @@ if(WIN32)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(BUILD_TOOLS AND BUILD_DX11 AND WIN32)
|
|
|
|
|
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT texconv)
|
|
|
|
|
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT texconv)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(BUILD_TOOLS AND (NOT VCPKG_TOOLCHAIN))
|
|
|
|
|
@@ -775,5 +789,5 @@ if(WIN32 AND (NOT WINDOWS_STORE) AND (NOT (DEFINED XBOX_CONSOLE_TARGET)))
|
|
|
|
|
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()
|
|
|
|
|
endif()
|
|
|
|
|
|