diff --git a/recipes/dxc/recipe.py b/recipes/dxc/recipe.py index 8b6a685..c6df686 100644 --- a/recipes/dxc/recipe.py +++ b/recipes/dxc/recipe.py @@ -1,6 +1,8 @@ +import os import re +import shutil from SCons.Script import * @@ -8,12 +10,20 @@ def _git_cook(env: Environment, repo: dict) -> dict: checkout_root = repo['checkout_root'] build_result = env.CMakeProject(checkout_root, generate_args = [ 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 = [] if env['COMPILER_FAMILY'] in ('gcc', 'clang') and env['BUILD_TYPE'] != 'release': 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 { 'CPPPATH': build_result['CPPPATH'], 'LIBS': [env.FindLib('dxcompiler', type='shared', paths=build_result['LIBPATH'])],