Added enable_hlsl option to glslang.
This commit is contained in:
parent
c74fbb8798
commit
b45fec7561
@ -2,6 +2,7 @@
|
|||||||
from git import Repo
|
from git import Repo
|
||||||
from git.exc import GitError
|
from git.exc import GitError
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import inspect
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
Import('env')
|
Import('env')
|
||||||
@ -86,7 +87,13 @@ def _git_recipe(env: Environment, globals: dict, repo_name, repo_url, cook_fn, v
|
|||||||
assert ref_fn
|
assert ref_fn
|
||||||
git_ref = ref_fn(env, version)
|
git_ref = ref_fn(env, version)
|
||||||
repo = env.GitBranch(repo_name = _repo_name(env), remote_url = _repo_url(env), git_ref = git_ref)
|
repo = env.GitBranch(repo_name = _repo_name(env), remote_url = _repo_url(env), git_ref = git_ref)
|
||||||
return cook_fn(env, repo)
|
|
||||||
|
cook_signature = inspect.signature(cook_fn)
|
||||||
|
kwargs = {}
|
||||||
|
if 'options' in cook_signature.parameters:
|
||||||
|
kwargs['options'] = options
|
||||||
|
|
||||||
|
return cook_fn(env, repo, **kwargs)
|
||||||
|
|
||||||
globals['versions'] = _versions
|
globals['versions'] = _versions
|
||||||
globals['dependencies'] = _dependencies
|
globals['dependencies'] = _dependencies
|
||||||
|
@ -9,8 +9,9 @@ from SCons.Script import *
|
|||||||
_SCRIPT_STAMPFILE = '.spp_script_run'
|
_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']
|
checkout_root = repo['checkout_root']
|
||||||
|
enable_hlsl = options.get('enable_hlsl', False)
|
||||||
|
|
||||||
# TODO: windows?
|
# TODO: windows?
|
||||||
did_run_script = os.path.exists(os.path.join(repo['checkout_root'], _SCRIPT_STAMPFILE))
|
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'], 'glslang/ResourceLimits/'), '*.cpp') \
|
||||||
+ env.RGlob(os.path.join(repo['checkout_root'], 'SPIRV/'), '*.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')]
|
+ [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
|
# disable warnings
|
||||||
additional_cxx_flags = {
|
additional_cxx_flags = {
|
||||||
@ -52,9 +55,15 @@ def _git_cook(env: Environment, repo) -> dict:
|
|||||||
'gcc': ['-w'],
|
'gcc': ['-w'],
|
||||||
'cl': ['/w']
|
'cl': ['/w']
|
||||||
}.get(env['COMPILER_FAMILY'], [])
|
}.get(env['COMPILER_FAMILY'], [])
|
||||||
|
additional_cppdefines = []
|
||||||
|
|
||||||
|
if enable_hlsl:
|
||||||
|
additional_cppdefines.append('ENABLE_HLSL=1')
|
||||||
|
|
||||||
env.StaticLibrary(
|
env.StaticLibrary(
|
||||||
CCFLAGS = env['CCFLAGS'] + additional_cxx_flags,
|
CCFLAGS = env['CCFLAGS'] + additional_cxx_flags,
|
||||||
CPPPATH = repo['checkout_root'],
|
CPPPATH = repo['checkout_root'],
|
||||||
|
CPPDEFINES = list(env['CPPDEFINES']) + additional_cppdefines,
|
||||||
target = env['LIB_DIR'] + '/glslang_full',
|
target = env['LIB_DIR'] + '/glslang_full',
|
||||||
source = glslang_source_files
|
source = glslang_source_files
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user