24 lines
1.0 KiB
Python
24 lines
1.0 KiB
Python
|
|
from SCons.Script import *
|
|
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
def cook(env: Environment, remote: str = 'github', git_ref: str = '') -> dict:
|
|
if remote == 'mewin':
|
|
repo = env.Cook('GitBranch', repo_name = 'glslang_mewin', remote_url = 'https://git.mewin.de/mewin/glslang.git', git_ref = git_ref or 'master')
|
|
else:
|
|
repo = env.Cook('GitBranch', repo_name = 'glslang', remote_url = 'https://github.com/KhronosGroup/glslang.git', git_ref = git_ref or 'main')
|
|
checkout_root = repo['checkout_root']
|
|
|
|
# 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'])
|
|
|
|
return {
|
|
'LIBPATH': [os.path.join(build_result['install_dir'], 'glslang')],
|
|
'CPPPATH': build_result['CPPPATH'],
|
|
'LIBS': ['glslang', 'glslang-default-resource-limits', 'MachineIndependent']
|
|
}
|