Added enable_hlsl option to glslang.

This commit is contained in:
2024-09-16 09:50:36 +02:00
parent c74fbb8798
commit b45fec7561
2 changed files with 18 additions and 2 deletions

View File

@@ -9,8 +9,9 @@ from SCons.Script import *
_SCRIPT_STAMPFILE = '.spp_script_run'
def _git_cook(env: Environment, repo) -> dict:
def _git_cook(env: Environment, repo, options: dict = {}) -> dict:
checkout_root = repo['checkout_root']
enable_hlsl = options.get('enable_hlsl', False)
# TODO: windows?
did_run_script = os.path.exists(os.path.join(repo['checkout_root'], _SCRIPT_STAMPFILE))
@@ -45,6 +46,8 @@ def _git_cook(env: Environment, repo) -> dict:
+ env.RGlob(os.path.join(repo['checkout_root'], 'glslang/ResourceLimits/'), '*.cpp') \
+ env.RGlob(os.path.join(repo['checkout_root'], 'SPIRV/'), '*.cpp') \
+ [os.path.join(repo['checkout_root'], f'glslang/OSDependent/{platform_source_dir}/ossource.cpp')]
if enable_hlsl:
glslang_source_files.extend(env.RGlob(os.path.join(repo['checkout_root'], 'glslang/HLSL/'), '*.cpp'))
# disable warnings
additional_cxx_flags = {
@@ -52,9 +55,15 @@ def _git_cook(env: Environment, repo) -> dict:
'gcc': ['-w'],
'cl': ['/w']
}.get(env['COMPILER_FAMILY'], [])
additional_cppdefines = []
if enable_hlsl:
additional_cppdefines.append('ENABLE_HLSL=1')
env.StaticLibrary(
CCFLAGS = env['CCFLAGS'] + additional_cxx_flags,
CPPPATH = repo['checkout_root'],
CPPDEFINES = list(env['CPPDEFINES']) + additional_cppdefines,
target = env['LIB_DIR'] + '/glslang_full',
source = glslang_source_files
)