1- if (PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS)
2-
1+ if (PLATFORM_WIN32)
2+
3+ # Copies required dlls to the target's output directory
4+ #
5+ # The following dlls are copied:
6+ # - Engine dlls (GraphicsEngine*.dll)
7+ # - Archiver dll (Archiver*.dll)
8+ # - D3Dcompiler_47.dll
9+ # - Optional DXC dlls (dxcompiler.dll, dxil.dll, spv_dxcompiler.dll)
10+ #
11+ # Arguments:
12+ # TARGET_NAME - name of the target to copy dlls for
13+ # DXC_REQUIRED - Indicates that the target requires DXC compiler dlls
14+ # (dxcompiler.dll, dxil.dll and spv_dxcompiler.dll)
15+ #
16+ # Example:
17+ # copy_required_dlls(MyTarget DXC_REQUIRED YES)
18+ #
319 function (copy_required_dlls TARGET_NAME)
20+ set (options )
21+ set (oneValueArgs DXC_REQUIRED)
22+ set (multiValueArgs)
23+ cmake_parse_arguments (PARSE_ARGV 1 arg "${options} " "${oneValueArgs} " "${multiValueArgs} " )
24+
425 if (D3D11_SUPPORTED)
526 list (APPEND ENGINE_DLLS Diligent-GraphicsEngineD3D11-shared)
627 endif ()
@@ -36,7 +57,7 @@ if(PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS)
3657 list (APPEND SHADER_COMPILER_DLLS "${D3D_COMPILER_PATH} " )
3758 endif ()
3859
39- if (D3D12_SUPPORTED AND DXC_COMPILER_PATH AND DXIL_SIGNER_PATH)
60+ if (arg_DXC_REQUIRED AND D3D12_SUPPORTED AND DXC_COMPILER_PATH AND DXIL_SIGNER_PATH)
4061 # For the compiler to sign the bytecode, you have to have a copy of dxil.dll in
4162 # the same folder as the dxcompiler.dll at runtime.
4263
@@ -58,7 +79,7 @@ if(PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS)
5879 "\" $<TARGET_FILE_DIR:${TARGET_NAME} >\" " )
5980 endif ()
6081
61- if (VULKAN_SUPPORTED)
82+ if (arg_DXC_REQUIRED AND VULKAN_SUPPORTED)
6283 if (NOT DEFINED DILIGENT_DXCOMPILER_FOR_SPIRV_PATH)
6384 message (FATAL_ERROR "DILIGENT_DXCOMPILER_FOR_SPIRV_PATH is undefined, check order of cmake includes" )
6485 endif ()
@@ -72,8 +93,18 @@ if(PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS)
7293 endif ()
7394 endfunction ()
7495
96+ elseif (PLATFORM_UNIVERSAL_WINDOWS)
97+
98+ # Adds commands to package required DLLs into the appx package
99+ # Example:
100+ # package_required_dlls(MyTarget DXC_REQUIRED YES)
75101 function (package_required_dlls TARGET_NAME)
76- if (D3D12_SUPPORTED AND DXC_COMPILER_PATH AND DXIL_SIGNER_PATH)
102+ set (options )
103+ set (oneValueArgs DXC_REQUIRED)
104+ set (multiValueArgs)
105+ cmake_parse_arguments (PARSE_ARGV 1 arg "${options} " "${oneValueArgs} " "${multiValueArgs} " )
106+
107+ if (arg_DXC_REQUIRED AND D3D12_SUPPORTED AND DXC_COMPILER_PATH AND DXIL_SIGNER_PATH)
77108 # Copy the dlls to the project's CMake binary dir
78109
79110 add_custom_command (TARGET ${TARGET_NAME} PRE_BUILD
@@ -96,6 +127,10 @@ if(PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS)
96127 endif ()
97128 endfunction ()
98129
130+ endif ()
131+
132+ if (PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS)
133+
99134 # Set dll output name by adding _{32|64}{r|d} suffix
100135 function (set_dll_output_name TARGET_NAME OUTPUT_NAME_WITHOUT_SUFFIX )
101136 foreach (DBG_CONFIG ${DEBUG_CONFIGURATIONS} )
@@ -111,7 +146,7 @@ if(PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS)
111146 endforeach ()
112147 endfunction ()
113148
114- endif (PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS )
149+ endif ()
115150
116151
117152function (set_common_target_properties TARGET )
0 commit comments