Updated recipe for Glslang to build it via Scons instead of CMake so it is compiled with the same options (e.g. safe iterators) as the main project.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
from SCons.Script import *
|
||||
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
@@ -14,10 +15,36 @@ def cook(env: Environment, remote: str = 'github', git_ref: str = '') -> dict:
|
||||
|
||||
# TODO: windows?
|
||||
subprocess.run(('/usr/bin/env', 'python3', 'update_glslang_sources.py'), cwd=checkout_root, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
||||
build_result = env.Cook('CMakeProject', project_root=checkout_root, generate_args = ['-DBUILD_TESTING=OFF'])
|
||||
# build_result = env.Cook('CMakeProject', project_root=checkout_root, generate_args = ['-DBUILD_TESTING=OFF'])
|
||||
|
||||
# generator_script = os.path.join(repo['checkout_root'], 'gen_extension_headers.py')
|
||||
# generator_script_input = os.path.join(repo['checkout_root'], 'glslang/ExtensionHeaders')
|
||||
# generator_script_output = os.path.join(repo['checkout_root'], 'glslang/glsl_intrinsic_header.h')
|
||||
# env.Command(
|
||||
# target = generator_script_output,
|
||||
# source = [generator_script, os.path.join(repo['checkout_root'], 'glslang/ExtensionHeaders/GL_EXT_shader_realtime_clock.glsl')],
|
||||
# action = f'"$PYTHON" "{generator_script}" -i "{generator_script_input}" -o "$TARGET"'
|
||||
# )
|
||||
|
||||
platform_source_dir = {
|
||||
'Linux': 'Unix',
|
||||
'Windows': 'Windows',
|
||||
'Darwin': 'Unix'
|
||||
}.get(platform.system(), 'Unix')
|
||||
glslang_source_files = env.RGlob(os.path.join(repo['checkout_root'], 'glslang/GenericCodeGen/'), '*.cpp') \
|
||||
+ env.RGlob(os.path.join(repo['checkout_root'], 'glslang/MachineIndependent/'), '*.cpp') \
|
||||
+ env.RGlob(os.path.join(repo['checkout_root'], 'glslang/OGLCompilersDLL/'), '*.cpp') \
|
||||
+ env.RGlob(os.path.join(repo['checkout_root'], 'glslang/ResourceLimits/'), '*.cpp') \
|
||||
+ env.RGlob(os.path.join(repo['checkout_root'], 'glslang/SPIRV/'), '*.cpp') \
|
||||
+ env.RGlob(os.path.join(repo['checkout_root'], f'glslang/OSDependent/{platform_source_dir}/'), '*.cpp')
|
||||
|
||||
env.StaticLibrary(
|
||||
CPPPATH = repo['checkout_root'],
|
||||
target = env['LIB_DIR'] + '/glslang_full',
|
||||
source = glslang_source_files
|
||||
)
|
||||
|
||||
return {
|
||||
'LIBPATH': [os.path.join(build_result['install_dir'], 'glslang')],
|
||||
'CPPPATH': build_result['CPPPATH'],
|
||||
'LIBS': ['glslang', 'glslang-default-resource-limits', 'MachineIndependent']
|
||||
'CPPPATH': [checkout_root],
|
||||
'LIBS': ['glslang_full']
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user