Added DXC recipe.
This commit is contained in:
parent
bca2398828
commit
c883f3c1c7
@ -92,6 +92,7 @@ def _parse_lib_conf(env: Environment, lib_conf: dict) -> None:
|
|||||||
CPPDEFINES = lib_conf.get('CPPDEFINES', []),
|
CPPDEFINES = lib_conf.get('CPPDEFINES', []),
|
||||||
LIBPATH = lib_conf.get('LIBPATH', []),
|
LIBPATH = lib_conf.get('LIBPATH', []),
|
||||||
LIBS = lib_conf.get('LIBS', []),
|
LIBS = lib_conf.get('LIBS', []),
|
||||||
|
LINKFLAGS = lib_conf.get('LINKFLAGS', []),
|
||||||
JINJA_TEMPLATE_SEARCHPATH = lib_conf.get('JINJA_TEMPLATE_SEARCHPATH', []))
|
JINJA_TEMPLATE_SEARCHPATH = lib_conf.get('JINJA_TEMPLATE_SEARCHPATH', []))
|
||||||
|
|
||||||
def _inject_list(kwargs: dict, dependency: dict, list_name: str) -> None:
|
def _inject_list(kwargs: dict, dependency: dict, list_name: str) -> None:
|
||||||
@ -107,6 +108,7 @@ def _inject_dependency(dependency, kwargs: dict, add_sources: bool = True) -> No
|
|||||||
_inject_list(kwargs, dependency, 'CPPDEFINES')
|
_inject_list(kwargs, dependency, 'CPPDEFINES')
|
||||||
_inject_list(kwargs, dependency, 'LIBPATH')
|
_inject_list(kwargs, dependency, 'LIBPATH')
|
||||||
_inject_list(kwargs, dependency, 'LIBS')
|
_inject_list(kwargs, dependency, 'LIBS')
|
||||||
|
_inject_list(kwargs, dependency, 'LINKFLAGS')
|
||||||
if add_sources and 'ADDITIONAL_SOURCES' in dependency and hasattr(kwargs['source'], 'extend'):
|
if add_sources and 'ADDITIONAL_SOURCES' in dependency and hasattr(kwargs['source'], 'extend'):
|
||||||
kwargs['source'].extend(dependency['ADDITIONAL_SOURCES'])
|
kwargs['source'].extend(dependency['ADDITIONAL_SOURCES'])
|
||||||
if 'DEPENDENCIES' in dependency:
|
if 'DEPENDENCIES' in dependency:
|
||||||
@ -118,6 +120,7 @@ def _inject_dependency(dependency, kwargs: dict, add_sources: bool = True) -> No
|
|||||||
_inject_list(kwargs, dependency.cook_result, 'CPPDEFINES')
|
_inject_list(kwargs, dependency.cook_result, 'CPPDEFINES')
|
||||||
_inject_list(kwargs, dependency.cook_result, 'LIBPATH')
|
_inject_list(kwargs, dependency.cook_result, 'LIBPATH')
|
||||||
_inject_list(kwargs, dependency.cook_result, 'LIBS')
|
_inject_list(kwargs, dependency.cook_result, 'LIBS')
|
||||||
|
_inject_list(kwargs, dependency.cook_result, 'LINKFLAGS')
|
||||||
for depdep in dependency.depdeps:
|
for depdep in dependency.depdeps:
|
||||||
_inject_dependency(depdep, kwargs)
|
_inject_dependency(depdep, kwargs)
|
||||||
elif isinstance(dependency, _Target):
|
elif isinstance(dependency, _Target):
|
||||||
@ -126,6 +129,7 @@ def _inject_dependency(dependency, kwargs: dict, add_sources: bool = True) -> No
|
|||||||
_inject_list(kwargs, dependency.kwargs, 'LIBPATH')
|
_inject_list(kwargs, dependency.kwargs, 'LIBPATH')
|
||||||
_inject_list(kwargs, dependency.kwargs, 'LIBS')
|
_inject_list(kwargs, dependency.kwargs, 'LIBS')
|
||||||
_inject_list(kwargs, {'LIBS': [dependency]}, 'LIBS')
|
_inject_list(kwargs, {'LIBS': [dependency]}, 'LIBS')
|
||||||
|
_inject_list(kwargs, dependency.kwargs, 'LINKFLAGS')
|
||||||
for depdep in dependency.dependencies:
|
for depdep in dependency.dependencies:
|
||||||
_inject_dependency(depdep, kwargs)
|
_inject_dependency(depdep, kwargs)
|
||||||
|
|
||||||
|
31
recipes/dxc/recipe.py
Normal file
31
recipes/dxc/recipe.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import re
|
||||||
|
from SCons.Script import *
|
||||||
|
|
||||||
|
|
||||||
|
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'
|
||||||
|
])
|
||||||
|
|
||||||
|
link_flags = []
|
||||||
|
if env['COMPILER_FAMILY'] in ('gcc', 'clang') and env['BUILD_TYPE'] != 'release':
|
||||||
|
link_flags.append(f'-Wl,-rpath,{build_result["LIBPATH"][0]}')
|
||||||
|
return {
|
||||||
|
'CPPPATH': build_result['CPPPATH'],
|
||||||
|
'LIBS': [env.FindLib('dxcompiler', type='shared', paths=build_result['LIBPATH'])],
|
||||||
|
'LINKFLAGS': link_flags
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
env.GitRecipe(
|
||||||
|
globals = globals(),
|
||||||
|
repo_name = 'dxc',
|
||||||
|
repo_url = 'https://github.com/microsoft/DirectXShaderCompiler.git',
|
||||||
|
tag_pattern = re.compile(r'^v([0-9]+)\.([0-9]+)\.([0-9]+)$'),
|
||||||
|
tag_fn = lambda version: f'v{version[0]}.{version[1]}.{version[2]}',
|
||||||
|
cook_fn = _git_cook
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user