Fixed DXC recipe on Windows.

This commit is contained in:
Patrick 2025-07-08 18:37:57 +02:00
parent 1875e6fff5
commit ad79d0c9a5

View File

@ -1,6 +1,8 @@
import os
import re import re
import shutil
from SCons.Script import * from SCons.Script import *
@ -8,12 +10,20 @@ def _git_cook(env: Environment, repo: dict) -> dict:
checkout_root = repo['checkout_root'] checkout_root = repo['checkout_root']
build_result = env.CMakeProject(checkout_root, generate_args = [ build_result = env.CMakeProject(checkout_root, generate_args = [
f'-C{repo['checkout_root']}/cmake/caches/PredefinedParams.cmake', f'-C{repo['checkout_root']}/cmake/caches/PredefinedParams.cmake',
'-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON' '-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON', '-DHLSL_INCLUDE_TESTS=OFF', '-DLLVM_INCLUDE_TESTS=OFF',
'-DSPIRV_BUILD_TESTS=OFF'
]) ])
link_flags = [] link_flags = []
if env['COMPILER_FAMILY'] in ('gcc', 'clang') and env['BUILD_TYPE'] != 'release': if env['COMPILER_FAMILY'] in ('gcc', 'clang') and env['BUILD_TYPE'] != 'release':
link_flags.append(f'-Wl,-rpath,{build_result["LIBPATH"][0]}') link_flags.append(f'-Wl,-rpath,{build_result["LIBPATH"][0]}')
elif env['COMPILER_FAMILY'] == 'cl':
# for some reason CMake doesn't copy the .lib file
lib_src = os.path.join(build_result['build_dir'], 'lib/dxcompiler.lib')
lib_dst = os.path.join(build_result['LIBPATH'][0], 'dxcompiler.lib')
if not os.path.exists(lib_dst):
shutil.copy(lib_src, lib_dst)
return { return {
'CPPPATH': build_result['CPPPATH'], 'CPPPATH': build_result['CPPPATH'],
'LIBS': [env.FindLib('dxcompiler', type='shared', paths=build_result['LIBPATH'])], 'LIBS': [env.FindLib('dxcompiler', type='shared', paths=build_result['LIBPATH'])],