summaryrefslogtreecommitdiffstats
path: root/BuildUtils.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'BuildUtils.cmake')
-rw-r--r--BuildUtils.cmake23
1 files changed, 19 insertions, 4 deletions
diff --git a/BuildUtils.cmake b/BuildUtils.cmake
index 25d482fa..ee583daa 100644
--- a/BuildUtils.cmake
+++ b/BuildUtils.cmake
@@ -24,17 +24,32 @@ if(PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS)
"\"$<TARGET_FILE_DIR:${TARGET_NAME}>\"")
endforeach(DLL)
- # Copy D3Dcompiler_47.dll
+ # Copy D3Dcompiler_47.dll and dxcompiler.dll
if(MSVC)
- if(WIN64)
- set(D3D_COMPILER_PATH "\"$(VC_ExecutablePath_x64_x64)\\D3Dcompiler_47.dll\"")
+ if (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
+ set(D3D_COMPILER_PATH "\"$(WindowsSdkDir)\\bin\\${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}\\x64\\D3Dcompiler_47.dll\"")
+ set(DXC_COMPILER_PATH "\"$(WindowsSdkDir)\\bin\\${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}\\x64\\dxcompiler.dll\"")
+ set(DXIL_PATH "\"$(WindowsSdkDir)\\bin\\${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}\\x64\\dxil.dll\"")
else()
- set(D3D_COMPILER_PATH "\"$(VC_ExecutablePath_x86_x86)\\D3Dcompiler_47.dll\"")
+ set(D3D_COMPILER_PATH "\"$(WindowsSdkDir)\\bin\\${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}\\x86\\D3Dcompiler_47.dll\"")
+ set(DXC_COMPILER_PATH "\"$(WindowsSdkDir)\\bin\\${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}\\x86\\dxcompiler.dll\"")
+ set(DXIL_PATH "\"$(WindowsSdkDir)\\bin\\${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}\\x86\\dxil.dll\"")
endif()
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${D3D_COMPILER_PATH}
"\"$<TARGET_FILE_DIR:${TARGET_NAME}>\"")
+
+ if (${HAS_DXIL_COMPILER})
+ # For the compiler to sign the bytecode, you have to have a copy of dxil.dll in the same folder as the dxcompiler.dll at runtime.
+ add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${DXC_COMPILER_PATH}
+ "\"$<TARGET_FILE_DIR:${TARGET_NAME}>\""
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${DXIL_PATH}
+ "\"$<TARGET_FILE_DIR:${TARGET_NAME}>\"")
+ endif ()
endif()
endfunction()