Update to new recipe system (S++ 2.0).
This commit is contained in:
@@ -1,20 +1,15 @@
|
||||
|
||||
from SCons.Script import *
|
||||
|
||||
import glob
|
||||
import os
|
||||
import pathlib
|
||||
import platform
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
from SCons.Script import *
|
||||
|
||||
_SCRIPT_STAMPFILE = '.spp_script_run'
|
||||
|
||||
def cook(env: Environment, remote: str = 'github', git_ref: str = '') -> dict:
|
||||
if remote == 'mewin':
|
||||
repo = env.GitBranch(repo_name = 'glslang_mewin', remote_url = 'https://git.mewin.de/mewin/glslang.git', git_ref = git_ref or 'master')
|
||||
else:
|
||||
repo = env.GitBranch(repo_name = 'glslang', remote_url = 'https://github.com/KhronosGroup/glslang.git', git_ref = git_ref or 'main')
|
||||
|
||||
def _git_cook(env: Environment, repo) -> dict:
|
||||
checkout_root = repo['checkout_root']
|
||||
|
||||
# TODO: windows?
|
||||
@@ -51,10 +46,11 @@ def cook(env: Environment, remote: str = 'github', git_ref: str = '') -> dict:
|
||||
+ env.RGlob(os.path.join(repo['checkout_root'], 'SPIRV/'), '*.cpp') \
|
||||
+ [os.path.join(repo['checkout_root'], f'glslang/OSDependent/{platform_source_dir}/ossource.cpp')]
|
||||
|
||||
# disable a few warnings when compiling with clang
|
||||
# disable warnings
|
||||
additional_cxx_flags = {
|
||||
'clang': ['-Wno-deprecated-copy', '-Wno-missing-field-initializers', '-Wno-gnu-redeclared-enum',
|
||||
'-Wno-unused-but-set-variable', '-Wno-deprecated-enum-enum-conversion']
|
||||
'clang': ['-w'],
|
||||
'gcc': ['-w'],
|
||||
'cl': ['/w']
|
||||
}.get(env['COMPILER_FAMILY'], [])
|
||||
env.StaticLibrary(
|
||||
CCFLAGS = env['CCFLAGS'] + additional_cxx_flags,
|
||||
@@ -79,5 +75,37 @@ def cook(env: Environment, remote: str = 'github', git_ref: str = '') -> dict:
|
||||
|
||||
return {
|
||||
'CPPPATH': [include_dir],
|
||||
'LIBS': ['glslang_full']
|
||||
'LIBS': [os.path.join(env['LIB_DIR'], env.LibFilename('glslang_full'))]
|
||||
}
|
||||
|
||||
|
||||
|
||||
_REPO_NAMES = {
|
||||
'default': 'glslang',
|
||||
'mewin': 'glslang_mewin'
|
||||
}
|
||||
_REPO_URLS = {
|
||||
'default': 'https://github.com/KhronosGroup/glslang.git',
|
||||
'mewin': 'https://git.mewin.de/mewin/glslang.git'
|
||||
}
|
||||
_TAG_PATTERNS = {
|
||||
'default': re.compile(r'^([0-9]+)\.([0-9]+)\.([0-9]+)$'),
|
||||
'mewin': None
|
||||
}
|
||||
def _ref_fn(env: Environment, version) -> str:
|
||||
remote = env.get('GLSLANG_REMOTE', 'default')
|
||||
if remote == 'default':
|
||||
return f'refs/tags/{version[0]}.{version[1]}.{version[2]}'
|
||||
elif remote == 'mewin':
|
||||
return 'master'
|
||||
else:
|
||||
raise Exception('invalid glslang remote')
|
||||
|
||||
env.GitRecipe(
|
||||
globals = globals(),
|
||||
repo_name = lambda env: _REPO_NAMES[env.get('GLSLANG_REMOTE', 'default')],
|
||||
repo_url = lambda env: _REPO_URLS[env.get('GLSLANG_REMOTE', 'default')],
|
||||
tag_pattern = lambda env: _TAG_PATTERNS[env.get('GLSLANG_REMOTE', 'default')],
|
||||
cook_fn = _git_cook,
|
||||
ref_fn = _ref_fn
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user