32 lines
		
	
	
		
			995 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			995 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
 | |
| 
 | |
| 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
 | |
| )
 |