summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3DBase
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-09-19 21:25:10 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-09-19 21:25:10 +0000
commit20754bda7bad36d42c37971935a51e9a64f350f8 (patch)
tree3e341f9d704aed2ec053a2aca4b267668fcdb63e /Graphics/GraphicsEngineD3DBase
parentSwitched to using dynamic versions of engine libraries on UWP (diff)
downloadDiligentCore-20754bda7bad36d42c37971935a51e9a64f350f8.tar.gz
DiligentCore-20754bda7bad36d42c37971935a51e9a64f350f8.zip
CMake utils: added package_required_dlls to enable packaging shader compiler DLLs into UWP bundle
Diffstat (limited to 'Graphics/GraphicsEngineD3DBase')
-rw-r--r--Graphics/GraphicsEngineD3DBase/CMakeLists.txt34
1 files changed, 33 insertions, 1 deletions
diff --git a/Graphics/GraphicsEngineD3DBase/CMakeLists.txt b/Graphics/GraphicsEngineD3DBase/CMakeLists.txt
index 81a48c3d..0e116368 100644
--- a/Graphics/GraphicsEngineD3DBase/CMakeLists.txt
+++ b/Graphics/GraphicsEngineD3DBase/CMakeLists.txt
@@ -81,4 +81,36 @@ set_target_properties(Diligent-GraphicsEngineD3DBase PROPERTIES
if(DILIGENT_INSTALL_CORE)
install_core_lib(Diligent-GraphicsEngineD3DBase)
-endif() \ No newline at end of file
+endif()
+
+# Set paths to D3Dcompiler_47.dll, dxcompiler.dll, and dxil.dll
+if(MSVC)
+ if (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
+ set(ARCH_SUFFIX "x64")
+ else()
+ set(ARCH_SUFFIX "x86")
+ endif()
+
+ # Note that CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION is stated to be defined when targeting Windows 10
+ # and above, however it is also defined when targeting 8.1 and Visual Studio 2019 (but not VS2017)
+ if(CMAKE_SYSTEM_VERSION VERSION_GREATER_EQUAL "10.0")
+ if (DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION)
+ # Note that VS_WINDOWS_SDK_BIN_DIR as well as all derived paths can only be used in Visual Studio
+ # commands and are not valid paths during CMake configuration
+ set(VS_WINDOWS_SDK_BIN_DIR "$(WindowsSdkDir)\\bin\\${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}\\${ARCH_SUFFIX}")
+
+ set(VS_D3D_COMPILER_PATH "\"${VS_WINDOWS_SDK_BIN_DIR}\\D3Dcompiler_47.dll\"" CACHE INTERNAL "D3Dcompiler_47.dll path")
+
+ # DXC is only present in Windows SDK starting with version 10.0.17763.0
+ if(${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION} VERSION_GREATER_EQUAL "10.0.17763.0")
+ set(VS_DXC_COMPILER_PATH "\"${VS_WINDOWS_SDK_BIN_DIR}\\dxcompiler.dll\"" CACHE INTERNAL "dxcompiler.dll path")
+ set(VS_DXIL_SIGNER_PATH "\"${VS_WINDOWS_SDK_BIN_DIR}\\dxil.dll\"" CACHE INTERNAL "dxil.dll path")
+ endif()
+ endif()
+ elseif(CMAKE_SYSTEM_VERSION VERSION_EQUAL "8.1")
+ # D3Dcompiler_47.dll from Win8.1 SDK is ancient (from 2013) and fails to
+ # compile a number of test shaders. Use the compiler from Visual Studio
+ # executable path instead
+ set(VS_D3D_COMPILER_PATH "\"$(VC_ExecutablePath_x64_${ARCH_SUFFIX})\\D3Dcompiler_47.dll\"" CACHE INTERNAL "D3Dcompiler_47.dll path")
+ endif()
+endif()