This commit is contained in:
Chuck Walbourn 2024-02-12 13:06:47 -08:00 коммит произвёл GitHub
Родитель 7fbe35ff34
Коммит a48c1c1a73
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
15 изменённых файлов: 210 добавлений и 178 удалений

Просмотреть файл

@ -62,26 +62,6 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
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)
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Ww][Ii][Nn]32$")
set(DIRECTX_ARCH x86)
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Xx]64$")
set(DIRECTX_ARCH x64)
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]$")
set(DIRECTX_ARCH arm)
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]64$")
set(DIRECTX_ARCH arm64)
endif()
if(WINDOWS_STORE OR (DEFINED XBOX_CONSOLE_TARGET))
set(BUILD_DX12 ON)
set(BUILD_TOOLS OFF)
@ -341,43 +321,6 @@ if(directx-headers_FOUND)
target_compile_definitions(${PROJECT_NAME} PUBLIC USING_DIRECTX_HEADERS)
endif()
include(CheckIncludeFileCXX)
if(DEFINED XBOX_CONSOLE_TARGET)
message(STATUS "Building for Xbox Console Target: ${XBOX_CONSOLE_TARGET}")
set(CMAKE_REQUIRED_QUIET ON)
if(XBOX_CONSOLE_TARGET STREQUAL "durango")
CHECK_INCLUDE_FILE_CXX(xdk.h XDKLegacy_HEADER)
if(NOT XDKLegacy_HEADER)
message(FATAL_ERROR "Legacy Xbox One XDK required to build for Durango.")
endif()
target_compile_definitions(${PROJECT_NAME} PUBLIC WINAPI_FAMILY=WINAPI_FAMILY_TV_TITLE _XBOX_ONE _TITLE MONOLITHIC=1)
else()
CHECK_INCLUDE_FILE_CXX(gxdk.h GXDK_HEADER)
if(NOT GXDK_HEADER)
message(FATAL_ERROR "Microsoft GDK with Xbox Extensions required to build for Xbox. See https://aka.ms/gdkx")
endif()
target_compile_definitions(${PROJECT_NAME} PUBLIC WINAPI_FAMILY=WINAPI_FAMILY_GAMES)
if(XBOX_CONSOLE_TARGET STREQUAL "scarlett")
CHECK_INCLUDE_FILE_CXX(d3d12_xs.h D3D12XS_HEADER)
if(NOT D3D12XS_HEADER)
message(FATAL_ERROR "Microsoft GDK with Xbox Extensions environment needs to be set for Xbox Series X|S.")
endif()
target_compile_definitions(${PROJECT_NAME} PUBLIC _GAMING_XBOX _GAMING_XBOX_SCARLETT)
elseif(XBOX_CONSOLE_TARGET STREQUAL "xboxone")
CHECK_INCLUDE_FILE_CXX(d3d12_x.h D3D12X_HEADER)
if(NOT D3D12X_HEADER)
message(FATAL_ERROR "Microsoft GDK with Xbox Extensions environment needs to be set for Xbox One.")
endif()
target_compile_definitions(${PROJECT_NAME} PUBLIC _GAMING_XBOX _GAMING_XBOX_XBOXONE)
else()
message(FATAL_ERROR "Unknown XBOX_CONSOLE_TARGET")
endif()
endif()
elseif(WINDOWS_STORE)
target_compile_definitions(${PROJECT_NAME} PUBLIC WINAPI_FAMILY=WINAPI_FAMILY_APP)
endif()
#--- Package
include(CMakePackageConfigHelpers)
@ -566,67 +509,32 @@ endif()
if(MSVC)
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE /Wall /GR- "$<$<NOT:$<CONFIG:DEBUG>>:/guard:cf>")
target_link_options(${t} PRIVATE /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO)
target_compile_options(${t} PRIVATE /Wall /GR-)
endforeach()
if((CMAKE_SIZEOF_VOID_P EQUAL 4) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm")))
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_link_options(${t} PRIVATE /SAFESEH)
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|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)
message(STATUS "Using non-native wchar_t as unsigned short")
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE "/Zc:wchar_t-")
endforeach()
endif()
else()
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_definitions(${t} PRIVATE $<IF:$<CONFIG:DEBUG>,_DEBUG,NDEBUG>)
endforeach()
endif()
if(XBOX_CONSOLE_TARGET STREQUAL "scarlett")
target_compile_options(${PROJECT_NAME} PRIVATE $<IF:$<CXX_COMPILER_ID:MSVC>,/favor:AMD64 /arch:AVX2,-march=znver2>)
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,Intel>:/arch:SSE2> $<$<NOT:$<CXX_COMPILER_ID:MSVC,Intel>>:-msse2>)
else()
set(ARCH_SSE2 $<$<NOT:$<CXX_COMPILER_ID:MSVC,Intel>>:-msse2>)
endif()
include(build/CompilerAndLinker.cmake)
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE ${ARCH_SSE2})
endforeach()
endif()
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_definitions(${t} PRIVATE ${COMPILER_DEFINES})
target_compile_options(${t} PRIVATE ${COMPILER_SWITCHES})
target_link_options(${t} PRIVATE ${LINKER_SWITCHES})
endforeach()
if(MINGW)
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
foreach(t IN LISTS TOOL_EXES)
target_link_options(${t} PRIVATE -municode)
endforeach()
endif()
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)
@ -635,6 +543,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM")
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()
@ -649,28 +558,14 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
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)
endforeach()
if(ENABLE_CODE_ANALYSIS)
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE /analyze)
endforeach()
endif()
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
message(STATUS "Building using Whole Program Optimization")
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE /Gy /Gw)
endforeach()
endif()
if(ENABLE_SPECTRE_MITIGATION
AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.13)
AND (NOT ENABLE_OPENEXR_SUPPORT)
@ -681,50 +576,11 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
endforeach()
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()
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()
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()
if(NOT (DEFINED XBOX_CONSOLE_TARGET))
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26)
AND BUILD_XBOX_EXTS_XBOXONE)
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>)
target_compile_options(${t} PRIVATE /wd5104 /wd5204)
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()
endif()
set(WarningsEXE "/wd4061" "/wd4062" "/wd4365" "/wd4514" "/wd4625" "/wd4626" "/wd4627" "/wd4668" "/wd4710" "/wd4711" "/wd4751" "/wd4820" "/wd5026" "/wd5027" "/wd5039" "/wd5045" "/wd5219")
@ -739,8 +595,8 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
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)
target_compile_options(${t} PRIVATE ${ASAN_SWITCHES})
target_link_libraries(${t} PRIVATE ${ASAN_LIBS})
endforeach()
endif()
endif()
@ -760,7 +616,7 @@ if(WIN32)
endif()
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_definitions(${t} PRIVATE _UNICODE UNICODE _WIN32_WINNT=${WINVER})
target_compile_definitions(${t} PRIVATE _WIN32_WINNT=${WINVER})
endforeach()
if(DISABLE_MSVC_ITERATOR_DEBUGGING)

Просмотреть файл

@ -295,7 +295,7 @@
<_ATGFXCPath>$(_ATGFXCPath.Replace("x64",""))</_ATGFXCPath>
<_ATGFXCPath Condition="'$(_ATGFXCPath)' != '' and !HasTrailingSlash('$(_ATGFXCPath)')">$(_ATGFXCPath)\</_ATGFXCPath>
</PropertyGroup>
<Exec Condition="!Exists('Shaders/ddsview_vs.inc')" WorkingDirectory="$(ProjectDir)" Command="hlsl" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" />
<Exec Condition="!Exists('Shaders/ddsview_vs.inc')" WorkingDirectory="$(ProjectDir)" Command="hlsl" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" LogStandardErrorAsError="true" />
<PropertyGroup>
<_ATGFXCPath />
</PropertyGroup>

Просмотреть файл

@ -301,7 +301,7 @@
<_ATGFXCPath>$(_ATGFXCPath.Replace("x64",""))</_ATGFXCPath>
<_ATGFXCPath Condition="'$(_ATGFXCPath)' != '' and !HasTrailingSlash('$(_ATGFXCPath)')">$(_ATGFXCPath)\</_ATGFXCPath>
</PropertyGroup>
<Exec Condition="!Exists('Shaders/ddsview_vs.inc')" WorkingDirectory="$(ProjectDir)" Command="hlsl" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" />
<Exec Condition="!Exists('Shaders/ddsview_vs.inc')" WorkingDirectory="$(ProjectDir)" Command="hlsl" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" LogStandardErrorAsError="true" />
<PropertyGroup>
<_ATGFXCPath />
</PropertyGroup>

Просмотреть файл

@ -40,17 +40,24 @@
// C5264 'const' variable is not used
// 26812: The enum type 'x' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).
// Windows 8.1 SDK related Off by default warnings
#pragma warning(disable : 4471 4917 4986 5029)
#if defined(_XBOX_ONE) && defined(_TITLE)
// Xbox One XDK related Off by default warnings
#pragma warning(disable : 4471 4643 4917 4986 5029 5038 5040 5043 5204 5246 5256 5262 5267)
// C4471 forward declaration of an unscoped enumeration must have an underlying type
// C4643 Forward declaring in namespace std is not permitted by the C++ Standard
// C4917 a GUID can only be associated with a class, interface or namespace
// C4986 exception specification does not match previous declaration
// C5029 nonstandard extension used
// Xbox One XDK related Off by default warnings
#pragma warning(disable : 4643)
// C4643 Forward declaring in namespace std is not permitted by the C++ Standard
#endif
// C5038 data member 'X' will be initialized after data member 'Y'
// C5040 dynamic exception specifications are valid only in C++14 and earlier; treating as noexcept(false)
// C5043 exception specification does not match previous declaration
// C5204 class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly
// C5246 'anonymous struct or union': the initialization of a subobject should be wrapped in braces
// C5256 a non-defining declaration of an enumeration with a fixed underlying type is only permitted as a standalone declaration
// C5262 implicit fall-through occurs here; are you missing a break statement?
// C5267 definition of implicit copy constructor for 'X' is deprecated because it has a user-provided assignment operator
#endif // _XBOX_ONE && _TITLE
#endif // _MSC_VER
#ifdef __INTEL_COMPILER
#pragma warning(disable : 161)

Просмотреть файл

@ -348,7 +348,7 @@
<_ATGFXCPath>$(_ATGFXCPath.Replace("x64",""))</_ATGFXCPath>
<_ATGFXCPath Condition="'$(_ATGFXCPath)' != '' and !HasTrailingSlash('$(_ATGFXCPath)')">$(_ATGFXCPath)\</_ATGFXCPath>
</PropertyGroup>
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" />
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" LogStandardErrorAsError="true" />
<PropertyGroup>
<_ATGFXCPath />
</PropertyGroup>

Просмотреть файл

@ -489,7 +489,7 @@
<_ATGFXCPath>$(_ATGFXCPath.Replace("x64",""))</_ATGFXCPath>
<_ATGFXCPath Condition="'$(_ATGFXCPath)' != '' and !HasTrailingSlash('$(_ATGFXCPath)')">$(_ATGFXCPath)\</_ATGFXCPath>
</PropertyGroup>
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" />
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" LogStandardErrorAsError="true" />
<PropertyGroup>
<_ATGFXCPath />
</PropertyGroup>

Просмотреть файл

@ -348,7 +348,7 @@
<_ATGFXCPath>$(_ATGFXCPath.Replace("x64",""))</_ATGFXCPath>
<_ATGFXCPath Condition="'$(_ATGFXCPath)' != '' and !HasTrailingSlash('$(_ATGFXCPath)')">$(_ATGFXCPath)\</_ATGFXCPath>
</PropertyGroup>
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" />
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" LogStandardErrorAsError="true" />
<PropertyGroup>
<_ATGFXCPath />
</PropertyGroup>

Просмотреть файл

@ -489,7 +489,7 @@
<_ATGFXCPath>$(_ATGFXCPath.Replace("x64",""))</_ATGFXCPath>
<_ATGFXCPath Condition="'$(_ATGFXCPath)' != '' and !HasTrailingSlash('$(_ATGFXCPath)')">$(_ATGFXCPath)\</_ATGFXCPath>
</PropertyGroup>
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" />
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" LogStandardErrorAsError="true" />
<PropertyGroup>
<_ATGFXCPath />
</PropertyGroup>

Просмотреть файл

@ -558,7 +558,7 @@
<_ATGFXCPath>$(_ATGFXCPath.Replace("x64",""))</_ATGFXCPath>
<_ATGFXCPath Condition="'$(_ATGFXCPath)' != '' and !HasTrailingSlash('$(_ATGFXCPath)')">$(_ATGFXCPath)\</_ATGFXCPath>
</PropertyGroup>
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" />
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" LogStandardErrorAsError="true" />
<PropertyGroup>
<_ATGFXCPath />
</PropertyGroup>

Просмотреть файл

@ -558,7 +558,7 @@
<_ATGFXCPath>$(_ATGFXCPath.Replace("x64",""))</_ATGFXCPath>
<_ATGFXCPath Condition="'$(_ATGFXCPath)' != '' and !HasTrailingSlash('$(_ATGFXCPath)')">$(_ATGFXCPath)\</_ATGFXCPath>
</PropertyGroup>
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" />
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" LogStandardErrorAsError="true" />
<PropertyGroup>
<_ATGFXCPath />
</PropertyGroup>

Просмотреть файл

@ -269,7 +269,7 @@
<_ATGFXCPath>$(_ATGFXCPath.Replace("x64",""))</_ATGFXCPath>
<_ATGFXCPath Condition="'$(_ATGFXCPath)' != '' and !HasTrailingSlash('$(_ATGFXCPath)')">$(_ATGFXCPath)\</_ATGFXCPath>
</PropertyGroup>
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" />
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" LogStandardErrorAsError="true" />
<PropertyGroup>
<_ATGFXCPath />
</PropertyGroup>

Просмотреть файл

@ -269,7 +269,7 @@
<_ATGFXCPath>$(_ATGFXCPath.Replace("x64",""))</_ATGFXCPath>
<_ATGFXCPath Condition="'$(_ATGFXCPath)' != '' and !HasTrailingSlash('$(_ATGFXCPath)')">$(_ATGFXCPath)\</_ATGFXCPath>
</PropertyGroup>
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" />
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" LogStandardErrorAsError="true" />
<PropertyGroup>
<_ATGFXCPath />
</PropertyGroup>

Просмотреть файл

@ -343,7 +343,7 @@
<_ATGFXCPath>$(_ATGFXCPath.Replace("x64",""))</_ATGFXCPath>
<_ATGFXCPath Condition="'$(_ATGFXCPath)' != '' and !HasTrailingSlash('$(_ATGFXCPath)')">$(_ATGFXCPath)\</_ATGFXCPath>
</PropertyGroup>
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" />
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" LogStandardErrorAsError="true" />
<PropertyGroup>
<_ATGFXCPath />
</PropertyGroup>

Просмотреть файл

@ -343,7 +343,7 @@
<_ATGFXCPath>$(_ATGFXCPath.Replace("x64",""))</_ATGFXCPath>
<_ATGFXCPath Condition="'$(_ATGFXCPath)' != '' and !HasTrailingSlash('$(_ATGFXCPath)')">$(_ATGFXCPath)\</_ATGFXCPath>
</PropertyGroup>
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" />
<Exec Condition="!Exists('Shaders/Compiled/BC6HEncode_EncodeBlockCS.inc')" WorkingDirectory="$(ProjectDir)Shaders" Command="CompileShaders" EnvironmentVariables="WindowsSdkVerBinPath=$(_ATGFXCPath)" LogStandardErrorAsError="true" />
<PropertyGroup>
<_ATGFXCPath />
</PropertyGroup>

Просмотреть файл

@ -0,0 +1,169 @@
# This modules provides variables with recommended Compiler and Linker switches
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
set(COMPILER_DEFINES "")
set(COMPILER_SWITCHES "")
set(LINKER_SWITCHES "")
#--- Determines target architecture if not explicitly set
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)
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Ww][Ii][Nn]32$")
set(DIRECTX_ARCH x86)
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Xx]64$")
set(DIRECTX_ARCH x64)
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]$")
set(DIRECTX_ARCH arm)
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]64$")
set(DIRECTX_ARCH arm64)
endif()
#--- Build with Unicode Win32 APIs per "UTF-8 Everywhere"
if(WIN32)
list(APPEND COMPILER_DEFINES _UNICODE UNICODE)
endif()
#--- General MSVC-like SDL options
if(MSVC)
list(APPEND COMPILER_SWITCHES "$<$<NOT:$<CONFIG:DEBUG>>:/guard:cf>")
list(APPEND LINKER_SWITCHES /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO)
if((${DIRECTX_ARCH} MATCHES "x86")
OR ((CMAKE_SIZEOF_VOID_P EQUAL 4) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))))
list(APPEND LINKER_SWITCHES /SAFESEH)
endif()
if((MSVC_VERSION GREATER_EQUAL 1928)
AND (CMAKE_SIZEOF_VOID_P EQUAL 8)
AND ((NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM")) OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)))
list(APPEND COMPILER_SWITCHES "$<$<NOT:$<CONFIG:DEBUG>>:/guard:ehcont>")
list(APPEND LINKER_SWITCHES "$<$<NOT:$<CONFIG:DEBUG>>:/guard:ehcont>")
endif()
else()
list(APPEND COMPILER_DEFINES $<IF:$<CONFIG:DEBUG>,_DEBUG,NDEBUG>)
endif()
#--- Target architecture switches
if(XBOX_CONSOLE_TARGET STREQUAL "scarlett")
list(APPEND COMPILER_SWITCHES $<IF:$<CXX_COMPILER_ID:MSVC>,/favor:AMD64 /arch:AVX2,-march=znver2>)
elseif(XBOX_CONSOLE_TARGET STREQUAL "xboxone|durago")
list(APPEND COMPILER_SWITCHES $<IF:$<CXX_COMPILER_ID:MSVC>,/favor:AMD64 /arch:AVX,-march=btver2>)
elseif(NOT (${DIRECTX_ARCH} MATCHES "^arm"))
if((${DIRECTX_ARCH} MATCHES "x86") OR (CMAKE_SIZEOF_VOID_P EQUAL 4))
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,Intel>>:-msse2>)
endif()
list(APPEND COMPILER_SWITCHES ${ARCH_SSE2})
endif()
#--- Compiler-specific switches
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM")
if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0))
list(APPEND COMPILER_SWITCHES /ZH:SHA_256)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
list(APPEND COMPILER_SWITCHES /Zc:__cplusplus /Zc:inline /fp:fast /Qdiag-disable:161)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
list(APPEND COMPILER_SWITCHES /sdl /permissive- /JMC- /Zc:__cplusplus /Zc:inline /fp:fast)
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
message(STATUS "Building using Whole Program Optimization")
list(APPEND /Gy /Gw)
endif()
if(OpenMP_CXX_FOUND)
# OpenMP in MSVC is not compatible with /permissive- unless you disable two-phase lookup
list(APPEND /Zc:twoPhase-)
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24)
list(APPEND COMPILER_SWITCHES /ZH:SHA_256)
endif()
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26)
AND (NOT (XBOX_CONSOLE_TARGET STREQUAL "durango")))
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE /Zc:preprocessor /wd5104 /wd5105)
endforeach()
endif()
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm")))
list(APPEND LINKER_SWITCHES /CETCOMPAT)
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.28)
list(APPEND COMPILER_SWITCHES /Zc:lambda)
endif()
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.31)
AND (XBOX_CONSOLE_TARGET STREQUAL "durango"))
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE /Zc:static_assert-)
endforeach()
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.35)
list(APPEND COMPILER_SWITCHES /Zc:checkGwOdr)
if(NOT (DEFINED XBOX_CONSOLE_TARGET))
list(APPEND COMPILER_SWITCHES $<$<VERSION_GREATER_EQUAL:${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION},10.0.22000>:/Zc:templateScope>)
endif()
endif()
endif()
#--- Windows API Family
include(CheckIncludeFileCXX)
if(DEFINED XBOX_CONSOLE_TARGET)
message(STATUS "Building for Xbox Console Target: ${XBOX_CONSOLE_TARGET}")
set(CMAKE_REQUIRED_QUIET ON)
if(XBOX_CONSOLE_TARGET STREQUAL "durango")
CHECK_INCLUDE_FILE_CXX(xdk.h XDKLegacy_HEADER)
if(NOT XDKLegacy_HEADER)
message(FATAL_ERROR "Legacy Xbox One XDK required to build for Durango.")
endif()
list(APPEND COMPILER_DEFINES WINAPI_FAMILY=WINAPI_FAMILY_TV_TITLE _XBOX_ONE _TITLE MONOLITHIC=1)
else()
CHECK_INCLUDE_FILE_CXX(gxdk.h GXDK_HEADER)
if(NOT GXDK_HEADER)
message(FATAL_ERROR "Microsoft GDK with Xbox Extensions required to build for Xbox. See https://aka.ms/gdkx")
endif()
list(APPEND COMPILER_DEFINES WINAPI_FAMILY=WINAPI_FAMILY_GAMES)
if(XBOX_CONSOLE_TARGET STREQUAL "scarlett")
CHECK_INCLUDE_FILE_CXX(d3d12_xs.h D3D12XS_HEADER)
if(NOT D3D12XS_HEADER)
message(FATAL_ERROR "Microsoft GDK with Xbox Extensions environment needs to be set for Xbox Series X|S.")
endif()
list(APPEND COMPILER_DEFINES _GAMING_XBOX _GAMING_XBOX_SCARLETT)
elseif(XBOX_CONSOLE_TARGET STREQUAL "xboxone")
CHECK_INCLUDE_FILE_CXX(d3d12_x.h D3D12X_HEADER)
if(NOT D3D12X_HEADER)
message(FATAL_ERROR "Microsoft GDK with Xbox Extensions environment needs to be set for Xbox One.")
endif()
list(APPEND COMPILER_DEFINES _GAMING_XBOX _GAMING_XBOX_XBOXONE)
else()
message(FATAL_ERROR "Unknown XBOX_CONSOLE_TARGET")
endif()
endif()
elseif(WINDOWS_STORE)
list(APPEND COMPILER_DEFINES WINAPI_FAMILY=WINAPI_FAMILY_APP)
endif()
#--- Address Sanitizer switches
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(ASAN_SWITCHES /fsanitize=address /fsanitize-coverage=inline-8bit-counters /fsanitize-coverage=edge /fsanitize-coverage=trace-cmp /fsanitize-coverage=trace-div)
set(ASAN_LIBS sancov.lib)
endif()