Update to new recipe system (S++ 2.0).
This commit is contained in:
parent
35b38b8b6e
commit
0c82036300
96
SConscript
96
SConscript
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
import enum
|
import json
|
||||||
import os
|
import os
|
||||||
import psutil
|
import psutil
|
||||||
import sys
|
import sys
|
||||||
@ -24,6 +24,7 @@ class _Dependency:
|
|||||||
version_spec: _VersionSpec
|
version_spec: _VersionSpec
|
||||||
recipe = None
|
recipe = None
|
||||||
depdeps: list = []
|
depdeps: list = []
|
||||||
|
cook_result: dict = {}
|
||||||
|
|
||||||
class _Target:
|
class _Target:
|
||||||
builder = None
|
builder = None
|
||||||
@ -46,13 +47,18 @@ def _find_recipe(env: Environment, recipe_name: str):
|
|||||||
raise Exception(f'Could not find recipe {recipe_name}.')
|
raise Exception(f'Could not find recipe {recipe_name}.')
|
||||||
spec = importlib.util.spec_from_file_location(recipe_name, source_file)
|
spec = importlib.util.spec_from_file_location(recipe_name, source_file)
|
||||||
recipe = importlib.util.module_from_spec(spec)
|
recipe = importlib.util.module_from_spec(spec)
|
||||||
|
recipe.env = env
|
||||||
spec.loader.exec_module(recipe)
|
spec.loader.exec_module(recipe)
|
||||||
env['SPP_RECIPES'][recipe_name] = recipe
|
env['SPP_RECIPES'][recipe_name] = recipe
|
||||||
return recipe
|
return recipe
|
||||||
|
|
||||||
def _cook(env: Environment, recipe_name: str, *args, **kwargs):
|
def _cook(env: Environment, recipe_name: str):
|
||||||
recipe = _find_recipe(env, recipe_name)
|
dependency = env['SPP_DEPENDENCIES'].get(recipe_name)
|
||||||
return recipe.cook(env, *args, **kwargs)
|
if not dependency:
|
||||||
|
raise Exception(f'Cannot cook {recipe_name} as it was not listed as a dependency.')
|
||||||
|
if not dependency.cook_result:
|
||||||
|
dependency.cook_result = dependency.recipe.cook(env, dependency.version)
|
||||||
|
return dependency.cook_result
|
||||||
|
|
||||||
def _module(env: Environment, file: str):
|
def _module(env: Environment, file: str):
|
||||||
return SConscript(file, exports = 'env', variant_dir = env['VARIANT_DIR'], src_dir = '.')
|
return SConscript(file, exports = 'env', variant_dir = env['VARIANT_DIR'], src_dir = '.')
|
||||||
@ -83,7 +89,14 @@ def _inject_dependency(dependency, kwargs: dict, add_sources: bool = True) -> No
|
|||||||
for inner_dependency in dependency['DEPENDENCIES']:
|
for inner_dependency in dependency['DEPENDENCIES']:
|
||||||
_inject_dependency(inner_dependency, kwargs, False)
|
_inject_dependency(inner_dependency, kwargs, False)
|
||||||
elif isinstance(dependency, _Dependency):
|
elif isinstance(dependency, _Dependency):
|
||||||
pass
|
if not dependency.cook_result:
|
||||||
|
dependency.cook_result = dependency.recipe.cook(env, dependency.version)
|
||||||
|
_inject_list(kwargs, dependency.cook_result, 'CPPPATH')
|
||||||
|
_inject_list(kwargs, dependency.cook_result, 'CPPDEFINES')
|
||||||
|
_inject_list(kwargs, dependency.cook_result, 'LIBPATH')
|
||||||
|
_inject_list(kwargs, dependency.cook_result, 'LIBS')
|
||||||
|
for depdep in dependency.depdeps:
|
||||||
|
_inject_dependency(depdep, kwargs)
|
||||||
|
|
||||||
def _rglob(env: Environment, root_path: str, pattern: str, **kwargs):
|
def _rglob(env: Environment, root_path: str, pattern: str, **kwargs):
|
||||||
result_nodes = []
|
result_nodes = []
|
||||||
@ -95,6 +108,14 @@ def _rglob(env: Environment, root_path: str, pattern: str, **kwargs):
|
|||||||
result_nodes.extend(env.Glob(f'{path}/{pattern}', **kwargs))
|
result_nodes.extend(env.Glob(f'{path}/{pattern}', **kwargs))
|
||||||
return sorted(result_nodes)
|
return sorted(result_nodes)
|
||||||
|
|
||||||
|
def _deps_from_json(env: Environment, deps: dict) -> dict:
|
||||||
|
for _, dep in deps.items():
|
||||||
|
if 'min' in dep and isinstance(dep['min'], list):
|
||||||
|
dep['min'] = tuple(dep['min'])
|
||||||
|
if 'max' in dep and isinstance(dep['max'], list):
|
||||||
|
dep['max'] = tuple(dep['max'])
|
||||||
|
return deps
|
||||||
|
|
||||||
def _make_interface(env: Environment, dependencies: list = []):
|
def _make_interface(env: Environment, dependencies: list = []):
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
for dependency in dependencies:
|
for dependency in dependencies:
|
||||||
@ -104,7 +125,7 @@ def _make_interface(env: Environment, dependencies: list = []):
|
|||||||
'CPPDEFINES': kwargs.get('CPPDEFINES', [])
|
'CPPDEFINES': kwargs.get('CPPDEFINES', [])
|
||||||
}
|
}
|
||||||
|
|
||||||
def _lib_filename(name: str, type: str = 'static') -> str:
|
def _lib_filename(env: Environment, name: str, type: str = 'static') -> str:
|
||||||
# TODO: windows
|
# TODO: windows
|
||||||
ext = {
|
ext = {
|
||||||
'static': 'a',
|
'static': 'a',
|
||||||
@ -112,12 +133,14 @@ def _lib_filename(name: str, type: str = 'static') -> str:
|
|||||||
}[type]
|
}[type]
|
||||||
return f'lib{name}.{ext}'
|
return f'lib{name}.{ext}'
|
||||||
|
|
||||||
def _find_lib(env: Environment, name: str, paths: 'list[str]', type : str = 'static'):
|
def _find_lib(env: Environment, name: str, paths: 'list[str]', type : str = 'static', allow_fail: bool = False):
|
||||||
for path in paths:
|
for path in paths:
|
||||||
lib_path = os.path.join(path, _lib_filename(name, type))
|
lib_path = os.path.join(path, _lib_filename(env, name, type))
|
||||||
if os.path.exists(lib_path):
|
if os.path.exists(lib_path):
|
||||||
return lib_path
|
return lib_path
|
||||||
|
if allow_fail:
|
||||||
return None
|
return None
|
||||||
|
raise Exception(f'Could not find library with name {name} in paths: "{",".join(paths)}".')
|
||||||
|
|
||||||
def _error(env: Environment, message: str):
|
def _error(env: Environment, message: str):
|
||||||
print(message, file=sys.stderr)
|
print(message, file=sys.stderr)
|
||||||
@ -177,12 +200,12 @@ def _add_dependency(env: Environment, name: str, version_spec: _VersionSpec) ->
|
|||||||
def _sort_versions(versions: list) -> None:
|
def _sort_versions(versions: list) -> None:
|
||||||
import functools
|
import functools
|
||||||
def _compare(left, right):
|
def _compare(left, right):
|
||||||
if left[0] != right[0]:
|
if left < right:
|
||||||
return right[0] - left[0]
|
return 1
|
||||||
elif left[1] != right[1]:
|
elif left == right:
|
||||||
return right[1] - left[1]
|
return 0
|
||||||
else:
|
else:
|
||||||
return right[2] - left[2]
|
return -1
|
||||||
versions.sort(key=functools.cmp_to_key(_compare))
|
versions.sort(key=functools.cmp_to_key(_compare))
|
||||||
|
|
||||||
def _version_matches(version, version_spec: _VersionSpec) -> bool:
|
def _version_matches(version, version_spec: _VersionSpec) -> bool:
|
||||||
@ -225,12 +248,6 @@ def _wrap_builder(builder, is_lib: bool = False):
|
|||||||
kwargs['LIBPATH'] = copy.copy(env['LIBPATH'])
|
kwargs['LIBPATH'] = copy.copy(env['LIBPATH'])
|
||||||
if 'LIBS' not in kwargs and 'LIBS' in env:
|
if 'LIBS' not in kwargs and 'LIBS' in env:
|
||||||
kwargs['LIBS'] = copy.copy(env['LIBS'])
|
kwargs['LIBS'] = copy.copy(env['LIBS'])
|
||||||
if 'LIBS' in kwargs:
|
|
||||||
libs_copy = list(kwargs['LIBS'])
|
|
||||||
for lib in libs_copy:
|
|
||||||
if isinstance(lib, str) and os.path.isabs(lib):
|
|
||||||
kwargs['LIBS'].remove(lib)
|
|
||||||
kwargs['source'].append(lib)
|
|
||||||
if 'source' in kwargs:
|
if 'source' in kwargs:
|
||||||
source = kwargs['source']
|
source = kwargs['source']
|
||||||
if not isinstance(source, list):
|
if not isinstance(source, list):
|
||||||
@ -249,6 +266,8 @@ def _wrap_builder(builder, is_lib: bool = False):
|
|||||||
target.kwargs = kwargs
|
target.kwargs = kwargs
|
||||||
target.dependencies = target_dependencies
|
target.dependencies = target_dependencies
|
||||||
env.Append(SPP_TARGETS = [target])
|
env.Append(SPP_TARGETS = [target])
|
||||||
|
if not target.dependencies:
|
||||||
|
_build_target(target)
|
||||||
return target
|
return target
|
||||||
return _wrapped
|
return _wrapped
|
||||||
|
|
||||||
@ -273,16 +292,47 @@ def _wrap_depends(depends):
|
|||||||
depends(dependant, dependency)
|
depends(dependant, dependency)
|
||||||
return _wrapped
|
return _wrapped
|
||||||
|
|
||||||
|
def _build_target(target: _Target):
|
||||||
|
for dependency in target.dependencies:
|
||||||
|
_inject_dependency(dependency, target.kwargs)
|
||||||
|
if 'LIBS' in target.kwargs:
|
||||||
|
libs_copy = list(target.kwargs['LIBS'])
|
||||||
|
for lib in libs_copy:
|
||||||
|
if isinstance(lib, str) and os.path.isabs(lib):
|
||||||
|
target.kwargs['LIBS'].remove(lib)
|
||||||
|
target.kwargs['source'].append(lib)
|
||||||
|
elif isinstance(lib, _Target):
|
||||||
|
if not lib.target:
|
||||||
|
_build_target(lib)
|
||||||
|
target.kwargs['LIBS'].remove(lib)
|
||||||
|
target.kwargs['LIBS'].append(lib.target)
|
||||||
|
target.target = target.builder(*target.args, **target.kwargs)
|
||||||
|
|
||||||
|
def _version_to_string(version) -> str:
|
||||||
|
return '.'.join([str(v) for v in version])
|
||||||
|
|
||||||
def _finalize(env: Environment):
|
def _finalize(env: Environment):
|
||||||
|
version_requirements = {dep.name: {
|
||||||
|
'min': dep.version_spec.minimum_version and _version_to_string(dep.version_spec.minimum_version),
|
||||||
|
'max': dep.version_spec.maximum_version and _version_to_string(dep.version_spec.maximum_version),
|
||||||
|
} for dep in env['SPP_DEPENDENCIES'].values()}
|
||||||
env['_SPP_DEPENDENCIES_OKAY'] = False
|
env['_SPP_DEPENDENCIES_OKAY'] = False
|
||||||
while not env['_SPP_DEPENDENCIES_OKAY']:
|
while not env['_SPP_DEPENDENCIES_OKAY']:
|
||||||
env['_SPP_DEPENDENCIES_OKAY'] = True
|
env['_SPP_DEPENDENCIES_OKAY'] = True
|
||||||
for dependency in list(env['SPP_DEPENDENCIES'].values()):
|
for dependency in list(env['SPP_DEPENDENCIES'].values()):
|
||||||
|
if not dependency.version:
|
||||||
_find_version(env, dependency)
|
_find_version(env, dependency)
|
||||||
|
with open('cache/versions.json', 'w') as f:
|
||||||
|
json.dump({
|
||||||
|
'requirements': version_requirements,
|
||||||
|
'selected': {
|
||||||
|
dep.name: _version_to_string(dep.version) for dep in env['SPP_DEPENDENCIES'].values()
|
||||||
|
}
|
||||||
|
}, f)
|
||||||
|
|
||||||
|
|
||||||
for target in env['SPP_TARGETS']:
|
for target in env['SPP_TARGETS']:
|
||||||
for dependency in target.dependencies:
|
_build_target(target)
|
||||||
_inject_dependency(dependency, target.kwargs)
|
|
||||||
target.target = target.builder(*target.args, **target.kwargs)
|
|
||||||
for target in env['SPP_DEFAULT_TARGETS']:
|
for target in env['SPP_DEFAULT_TARGETS']:
|
||||||
env.Default(target.target)
|
env.Default(target.target)
|
||||||
|
|
||||||
@ -575,7 +625,9 @@ elif env['COMPILER_FAMILY'] == 'clang':
|
|||||||
env.AddMethod(_cook, 'Cook')
|
env.AddMethod(_cook, 'Cook')
|
||||||
env.AddMethod(_parse_lib_conf, 'ParseLibConf')
|
env.AddMethod(_parse_lib_conf, 'ParseLibConf')
|
||||||
env.AddMethod(_rglob, 'RGlob')
|
env.AddMethod(_rglob, 'RGlob')
|
||||||
|
env.AddMethod(_deps_from_json, 'DepsFromJson')
|
||||||
env.AddMethod(_make_interface, 'MakeInterface')
|
env.AddMethod(_make_interface, 'MakeInterface')
|
||||||
|
env.AddMethod(_lib_filename, 'LibFilename')
|
||||||
env.AddMethod(_find_lib, 'FindLib')
|
env.AddMethod(_find_lib, 'FindLib')
|
||||||
env.AddMethod(_error, 'Error')
|
env.AddMethod(_error, 'Error')
|
||||||
env.AddMethod(_wrap_builder(env.Library, is_lib = True), 'Library')
|
env.AddMethod(_wrap_builder(env.Library, is_lib = True), 'Library')
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
|
|
||||||
import os
|
import json
|
||||||
import pathlib
|
import pathlib
|
||||||
|
import shutil
|
||||||
|
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
_BUILT_STAMPFILE = '.spp_built'
|
_BUILT_STAMPFILE = '.spp_built'
|
||||||
|
_VERSION = 0 # bump if you change how the projects are build to trigger a clean build
|
||||||
|
|
||||||
Import('env')
|
Import('env')
|
||||||
|
|
||||||
@ -11,11 +14,45 @@ def cmd_quote(s: str) -> str:
|
|||||||
escaped = s.replace('\\', '\\\\')
|
escaped = s.replace('\\', '\\\\')
|
||||||
return f'"{escaped}"'
|
return f'"{escaped}"'
|
||||||
|
|
||||||
def _cmake_project(env: Environment, project_root: str, generate_args: 'list[str]' = [], build_args : 'list[str]' = [], install_args : 'list[str]' = []) -> dict:
|
def _generate_cmake_c_flags(dependencies: 'list[dict]') -> str:
|
||||||
|
parts = []
|
||||||
|
for dependency in dependencies:
|
||||||
|
for path in dependency.get('CPPPATH', []):
|
||||||
|
parts.append(cmd_quote(f'-I{path}'))
|
||||||
|
return ' '.join(parts)
|
||||||
|
|
||||||
|
def _generate_cmake_cxx_flags(dependencies: 'list[dict]') -> str:
|
||||||
|
parts = []
|
||||||
|
for dependency in dependencies:
|
||||||
|
for path in dependency.get('CPPPATH', []):
|
||||||
|
parts.append(cmd_quote(f'-I{path}'))
|
||||||
|
return ' '.join(parts)
|
||||||
|
|
||||||
|
def _calc_version_hash(dependencies: 'list[dict]') -> str:
|
||||||
|
return json.dumps({
|
||||||
|
'version': _VERSION,
|
||||||
|
'dependencies': dependencies
|
||||||
|
})
|
||||||
|
|
||||||
|
def _cmake_project(env: Environment, project_root: str, generate_args: 'list[str]' = [], build_args : 'list[str]' = [], install_args : 'list[str]' = [], dependencies: 'list[dict]' = []) -> dict:
|
||||||
config = env['BUILD_TYPE']
|
config = env['BUILD_TYPE']
|
||||||
build_dir = os.path.join(project_root, f'build_{config}')
|
build_dir = os.path.join(project_root, f'build_{config}')
|
||||||
install_dir = os.path.join(project_root, f'install_{config}')
|
install_dir = os.path.join(project_root, f'install_{config}')
|
||||||
is_built = os.path.exists(os.path.join(install_dir, _BUILT_STAMPFILE))
|
|
||||||
|
version_hash = _calc_version_hash(dependencies)
|
||||||
|
stamp_file = pathlib.Path(install_dir, _BUILT_STAMPFILE)
|
||||||
|
is_built = stamp_file.exists()
|
||||||
|
|
||||||
|
if is_built:
|
||||||
|
with stamp_file.open('r') as f:
|
||||||
|
build_version = f.read()
|
||||||
|
if build_version != version_hash:
|
||||||
|
print(f'Rebuilding CMake project at {project_root} as the script version changed.')
|
||||||
|
is_built = False
|
||||||
|
if not is_built:
|
||||||
|
shutil.rmtree(build_dir)
|
||||||
|
shutil.rmtree(install_dir)
|
||||||
|
|
||||||
if not is_built or env['UPDATE_REPOSITORIES']:
|
if not is_built or env['UPDATE_REPOSITORIES']:
|
||||||
print(f'Building {project_root}, config {config}')
|
print(f'Building {project_root}, config {config}')
|
||||||
os.makedirs(build_dir, exist_ok=True)
|
os.makedirs(build_dir, exist_ok=True)
|
||||||
@ -30,10 +67,15 @@ def _cmake_project(env: Environment, project_root: str, generate_args: 'list[str
|
|||||||
# TODO: is this a problem?
|
# TODO: is this a problem?
|
||||||
# environ = os.environ.copy()
|
# environ = os.environ.copy()
|
||||||
# environ['CXXFLAGS'] = ' '.join(f'-D{define}' for define in env['CPPDEFINES']) # TODO: who cares about windows?
|
# environ['CXXFLAGS'] = ' '.join(f'-D{define}' for define in env['CPPDEFINES']) # TODO: who cares about windows?
|
||||||
run_cmd(['cmake', '-G', 'Ninja', '-B', build_dir, f'-DCMAKE_BUILD_TYPE={build_type}', f'-DCMAKE_INSTALL_PREFIX={cmd_quote(install_dir)}', '-DBUILD_TESTING=OFF', *generate_args, project_root])
|
run_cmd(['cmake', '-G', 'Ninja', '-B', build_dir, f'-DCMAKE_BUILD_TYPE={build_type}',
|
||||||
|
f'-DCMAKE_INSTALL_PREFIX={cmd_quote(install_dir)}', '-DBUILD_TESTING=OFF',
|
||||||
|
f'-DCMAKE_C_FLAGS={_generate_cmake_c_flags(dependencies)}',
|
||||||
|
f'-DCMAKE_CXX_FLAGS={_generate_cmake_cxx_flags(dependencies)}', *generate_args, project_root])
|
||||||
run_cmd(['cmake', '--build', *build_args, cmd_quote(build_dir)])
|
run_cmd(['cmake', '--build', *build_args, cmd_quote(build_dir)])
|
||||||
run_cmd(['cmake', '--install', *install_args, cmd_quote(build_dir)])
|
run_cmd(['cmake', '--install', *install_args, cmd_quote(build_dir)])
|
||||||
pathlib.Path(install_dir, _BUILT_STAMPFILE).touch()
|
|
||||||
|
with pathlib.Path(install_dir, _BUILT_STAMPFILE).open('w') as f:
|
||||||
|
f.write(version_hash)
|
||||||
|
|
||||||
libpath = []
|
libpath = []
|
||||||
for lib_folder in ('lib', 'lib64'):
|
for lib_folder in ('lib', 'lib64'):
|
||||||
|
@ -2,7 +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 os
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
Import('env')
|
Import('env')
|
||||||
@ -18,7 +18,7 @@ def _clone(env: Environment, repo_name: str, remote_url: str):
|
|||||||
origin = repo.create_remote('origin', remote_url)
|
origin = repo.create_remote('origin', remote_url)
|
||||||
return repo, origin
|
return repo, origin
|
||||||
|
|
||||||
def _gitbranch(env: Environment, repo_name: str, remote_url: str, git_ref: str = 'main') -> dict:
|
def _git_branch(env: Environment, repo_name: str, remote_url: str, git_ref: str = 'main') -> dict:
|
||||||
repo, origin = _clone(env, repo_name, remote_url)
|
repo, origin = _clone(env, repo_name, remote_url)
|
||||||
worktree_dir = os.path.join(env['CLONE_DIR'], 'git', repo_name, hashlib.shake_128(git_ref.encode('utf-8')).hexdigest(6)) # TODO: commit hash would be better, right? -> not if it's a branch!
|
worktree_dir = os.path.join(env['CLONE_DIR'], 'git', repo_name, hashlib.shake_128(git_ref.encode('utf-8')).hexdigest(6)) # TODO: commit hash would be better, right? -> not if it's a branch!
|
||||||
if not os.path.exists(worktree_dir):
|
if not os.path.exists(worktree_dir):
|
||||||
@ -38,12 +38,58 @@ def _gitbranch(env: Environment, repo_name: str, remote_url: str, git_ref: str =
|
|||||||
'checkout_root': worktree_dir
|
'checkout_root': worktree_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
def _gittags(env: Environment, repo_name: str, remote_url: str, force_fetch: bool = False) -> 'list[str]':
|
def _git_tags(env: Environment, repo_name: str, remote_url: str, force_fetch: bool = False) -> 'list[str]':
|
||||||
repo, origin = _clone(env, repo_name, remote_url)
|
repo, origin = _clone(env, repo_name, remote_url)
|
||||||
if force_fetch or env['UPDATE_REPOSITORIES']:
|
if force_fetch or env['UPDATE_REPOSITORIES']:
|
||||||
origin.fetch(tags=True)
|
origin.fetch(tags=True)
|
||||||
return [t.name for t in repo.tags]
|
return [t.name for t in repo.tags]
|
||||||
|
|
||||||
env.AddMethod(_gitbranch, 'GitBranch')
|
def _make_callable(val):
|
||||||
env.AddMethod(_gittags, 'GitTags')
|
if callable(val):
|
||||||
|
return val
|
||||||
|
else:
|
||||||
|
return lambda env: val
|
||||||
|
|
||||||
|
def _git_recipe(env: Environment, globals: dict, repo_name, repo_url, cook_fn, versions = None, tag_pattern = None, tag_fn = None, ref_fn = None, dependencies: dict = {}) -> None:
|
||||||
|
_repo_name = _make_callable(repo_name)
|
||||||
|
_repo_url = _make_callable(repo_url)
|
||||||
|
_tag_pattern = _make_callable(tag_pattern)
|
||||||
|
versions_cb = versions and _make_callable(versions)
|
||||||
|
|
||||||
|
def _versions(env: Environment, update: bool = False):
|
||||||
|
pattern = _tag_pattern(env)
|
||||||
|
if pattern:
|
||||||
|
tags = env.GitTags(repo_name = _repo_name(env), remote_url = _repo_url(env), force_fetch=update)
|
||||||
|
result = []
|
||||||
|
for tag in tags:
|
||||||
|
match = pattern.match(tag)
|
||||||
|
if match:
|
||||||
|
result.append(tuple(int(part) for part in match.groups() if part is not None))
|
||||||
|
if len(result) == 0 and not update:
|
||||||
|
return _versions(env, update=True)
|
||||||
|
return result
|
||||||
|
elif versions_cb:
|
||||||
|
return versions_cb(env)
|
||||||
|
else:
|
||||||
|
return [(0, 0, 0)]
|
||||||
|
|
||||||
|
def _dependencies(env: Environment, version) -> 'dict':
|
||||||
|
return dependencies
|
||||||
|
|
||||||
|
def _cook(env: Environment, version) -> dict:
|
||||||
|
if tag_fn:
|
||||||
|
git_ref = f'refs/tags/{tag_fn(version)}'
|
||||||
|
else:
|
||||||
|
assert ref_fn
|
||||||
|
git_ref = ref_fn(env, version)
|
||||||
|
repo = env.GitBranch(repo_name = _repo_name(env), remote_url = _repo_url(env), git_ref = git_ref)
|
||||||
|
return cook_fn(env, repo)
|
||||||
|
|
||||||
|
globals['versions'] = _versions
|
||||||
|
globals['dependencies'] = _dependencies
|
||||||
|
globals['cook'] = _cook
|
||||||
|
|
||||||
|
env.AddMethod(_git_branch, 'GitBranch')
|
||||||
|
env.AddMethod(_git_tags, 'GitTags')
|
||||||
|
env.AddMethod(_git_recipe, 'GitRecipe')
|
||||||
Return('env')
|
Return('env')
|
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref: str = 'master', own_main: bool = False) -> dict:
|
def _git_cook(env: Environment, repo) -> dict:
|
||||||
repo = env.GitBranch(repo_name = 'catch2', remote_url = 'https://github.com/catchorg/Catch2.git', git_ref = git_ref)
|
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
build_result = env.CMakeProject(project_root=checkout_root)
|
build_result = env.CMakeProject(project_root=checkout_root)
|
||||||
|
|
||||||
@ -10,12 +10,21 @@ def cook(env: Environment, git_ref: str = 'master', own_main: bool = False) -> d
|
|||||||
'debug': 'Catch2d'
|
'debug': 'Catch2d'
|
||||||
}.get(env['BUILD_TYPE'], 'Catch2')
|
}.get(env['BUILD_TYPE'], 'Catch2')
|
||||||
libs = [lib_name]
|
libs = [lib_name]
|
||||||
if not own_main:
|
if not env.get('CATCH2_OWN_MAIN'):
|
||||||
libs.append({
|
libs.append({
|
||||||
'debug': 'Catch2Maind'
|
'debug': 'Catch2Maind'
|
||||||
}.get(env['BUILD_TYPE'], 'Catch2Main'))
|
}.get(env['BUILD_TYPE'], 'Catch2Main'))
|
||||||
return {
|
return {
|
||||||
'LIBPATH': build_result['LIBPATH'],
|
|
||||||
'CPPPATH': build_result['CPPPATH'],
|
'CPPPATH': build_result['CPPPATH'],
|
||||||
'LIBS': libs
|
'LIBS': [env.FindLib(lib, paths=build_result['LIBPATH']) for lib in libs]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
env.GitRecipe(
|
||||||
|
globals = globals(),
|
||||||
|
repo_name = 'Catch2',
|
||||||
|
repo_url = 'https://github.com/catchorg/Catch2.git',
|
||||||
|
tag_pattern = re.compile(r'^v([0-9]+)\.([0-9]+)\.([0-9]+)$'),
|
||||||
|
tag_fn = lambda version: f'v{version[0]}.{version[1]}.{version[2]}',
|
||||||
|
cook_fn = _git_cook
|
||||||
|
)
|
@ -1,12 +1,31 @@
|
|||||||
|
|
||||||
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref = 'main') -> dict:
|
_REPO_NAME = 'ImageMagick'
|
||||||
repo = env.GitBranch(repo_name = 'ImageMagick', remote_url = 'https://github.com/ImageMagick/ImageMagick.git', git_ref = git_ref)
|
_REPO_URL = 'https://github.com/ImageMagick/ImageMagick.git'
|
||||||
checkout_root = repo['checkout_root']
|
_TAG_PATTERN = re.compile(r'^([0-9]+)\.([0-9]+)\.([0-9]+)-([0-9]+)$')
|
||||||
build_result = env.AutotoolsProject(checkout_root)
|
|
||||||
return {
|
def versions(env: Environment, update: bool = False):
|
||||||
'LIBPATH': build_result['LIBPATH'],
|
tags = env.GitTags(repo_name = _REPO_NAME, remote_url = _REPO_URL, force_fetch=update)
|
||||||
'CPPPATH': build_result['CPPPATH'],
|
result = []
|
||||||
'LIBS': ['backtrace']
|
for tag in tags:
|
||||||
}
|
match = _TAG_PATTERN.match(tag)
|
||||||
|
if match:
|
||||||
|
result.append((int(match.groups()[0]), int(match.groups()[1]), int(match.groups()[2]), int(match.groups()[3])))
|
||||||
|
return result
|
||||||
|
|
||||||
|
def dependencies(env: Environment, version) -> 'dict':
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def cook(env: Environment, version) -> dict:
|
||||||
|
raise Exception('this still needs to be implemented property :/')
|
||||||
|
# git_ref = f'refs/tags/{version[0]}.{version[1]}.{version[2]}-{version[3]}'
|
||||||
|
# repo = env.GitBranch(repo_name = _REPO_NAME, remote_url = _REPO_URL, git_ref = git_ref)
|
||||||
|
# checkout_root = repo['checkout_root']
|
||||||
|
# build_result = env.AutotoolsProject(checkout_root)
|
||||||
|
# return {
|
||||||
|
# 'LIBPATH': build_result['LIBPATH'],
|
||||||
|
# 'CPPPATH': build_result['CPPPATH'],
|
||||||
|
# 'LIBS': ['backtrace']
|
||||||
|
# }
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
import os
|
|
||||||
import platform
|
import platform
|
||||||
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref: str = "main") -> dict:
|
|
||||||
repo = env.GitBranch(repo_name = 'SDL', remote_url = 'https://github.com/libsdl-org/SDL.git', git_ref = git_ref)
|
def _git_cook(env: Environment, repo: dict) -> dict:
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
build_result = env.CMakeProject(project_root=checkout_root, generate_args = ['-DSDL_STATIC=ON', '-DSDL_SHARED=OFF'])
|
build_result = env.CMakeProject(project_root=checkout_root, generate_args = ['-DSDL_STATIC=ON', '-DSDL_SHARED=OFF'])
|
||||||
libs = []
|
libs = []
|
||||||
@ -25,3 +25,13 @@ def cook(env: Environment, git_ref: str = "main") -> dict:
|
|||||||
'LIBS': libs
|
'LIBS': libs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
env.GitRecipe(
|
||||||
|
globals = globals(),
|
||||||
|
repo_name = 'SDL',
|
||||||
|
repo_url = 'https://github.com/libsdl-org/SDL.git',
|
||||||
|
tag_pattern = re.compile(r'^release-([0-9]+)\.([0-9]+)\.([0-9]+)$'),
|
||||||
|
tag_fn = lambda version: f'release-{version[0]}.{version[1]}.{version[2]}',
|
||||||
|
cook_fn = _git_cook
|
||||||
|
)
|
||||||
|
|
||||||
|
@ -1,12 +1,44 @@
|
|||||||
|
|
||||||
import os
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, remote: str = 'github', git_ref: str = 'main') -> dict:
|
_REPO_NAMES = {
|
||||||
if remote == 'mewin':
|
'default': 'VulkanHeaders',
|
||||||
repo = env.GitBranch(repo_name = 'VulkanHeaders_mewin', remote_url = 'https://git.mewin.de/mewin/vulkan-headers.git', git_ref = git_ref)
|
'mewin': 'VulkanHeaders_mewin'
|
||||||
|
}
|
||||||
|
_REPO_URLS = {
|
||||||
|
'default': 'https://github.com/KhronosGroup/Vulkan-Headers.git',
|
||||||
|
'mewin': 'https://git.mewin.de/mewin/vulkan-headers.git'
|
||||||
|
}
|
||||||
|
_TAG_PATTERN = re.compile(r'^v([0-9]+)\.([0-9]+)\.([0-9]+)$')
|
||||||
|
|
||||||
|
|
||||||
|
def _get_repo_name(env: Environment) -> str:
|
||||||
|
return _REPO_NAMES[env.get('VULKANHEADERS_REMOTE', 'default')]
|
||||||
|
|
||||||
|
def _get_repo_url(env: Environment) -> str:
|
||||||
|
return _REPO_URLS[env.get('VULKANHEADERS_REMOTE', 'default')]
|
||||||
|
|
||||||
|
def versions(env: Environment, update: bool = False):
|
||||||
|
if env.get('VULKANHEADERS_REMOTE') == 'mewin':
|
||||||
|
return [(0, 0, 0)]
|
||||||
|
tags = env.GitTags(repo_name = _get_repo_name(env), remote_url = _get_repo_url(env), force_fetch=update)
|
||||||
|
result = []
|
||||||
|
for tag in tags:
|
||||||
|
match = _TAG_PATTERN.match(tag)
|
||||||
|
if match:
|
||||||
|
result.append((int(match.groups()[0]), int(match.groups()[1]), int(match.groups()[2])))
|
||||||
|
return result
|
||||||
|
|
||||||
|
def dependencies(env: Environment, version) -> 'dict':
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def cook(env: Environment, version) -> dict:
|
||||||
|
if env.get('VULKANHEADERS_REMOTE') == 'mewin':
|
||||||
|
git_ref = 'main'
|
||||||
else:
|
else:
|
||||||
repo = env.GitBranch(repo_name = 'VulkanHeaders', remote_url = 'https://github.com/KhronosGroup/Vulkan-Headers.git', git_ref = git_ref)
|
git_ref = f'refs/tags/v{version[0]}.{version[1]}.{version[2]}'
|
||||||
|
repo = env.GitBranch(repo_name = _get_repo_name(env), remote_url = _get_repo_url(env), git_ref = git_ref)
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
return {
|
return {
|
||||||
'CPPPATH': [os.path.join(checkout_root, 'include')]
|
'CPPPATH': [os.path.join(checkout_root, 'include')]
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
|
|
||||||
import os
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref: str = "master") -> dict:
|
def _git_cook(env: Environment, repo: dict) -> dict:
|
||||||
repo = env.GitBranch(repo_name = 'argparse', remote_url = 'https://github.com/p-ranav/argparse.git', git_ref = git_ref)
|
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
return {
|
return {
|
||||||
'CPPPATH': [os.path.join(checkout_root, 'include')]
|
'CPPPATH': [os.path.join(checkout_root, 'include')]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
env.GitRecipe(
|
||||||
|
globals = globals(),
|
||||||
|
repo_name = 'argparse',
|
||||||
|
repo_url = 'https://github.com/p-ranav/argparse.git',
|
||||||
|
tag_pattern = re.compile(r'^v([0-9]+)\.([0-9]+)$'),
|
||||||
|
tag_fn = lambda version: f'v{version[0]}.{version[1]}',
|
||||||
|
cook_fn = _git_cook
|
||||||
|
)
|
||||||
|
@ -1,12 +1,57 @@
|
|||||||
|
|
||||||
import os
|
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import requests
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, version: str = "1.85.0") -> dict:
|
_VERSIONS_URL = 'https://api.github.com/repos/boostorg/boost/releases'
|
||||||
# TODO: build binaries?
|
_VERSION_PATTERN = re.compile(r'^boost-([0-9]+)\.([0-9]+)\.([0-9]+)$')
|
||||||
url = f'https://archives.boost.io/release/{version}/source/boost_{version.replace(".", "_")}.tar.gz'
|
|
||||||
repo = env.DownloadAndExtract(f'boost_{version}', url = url, skip_folders = 1)
|
def versions(env: Environment, update: bool = False):
|
||||||
|
versions_file = os.path.join(env['DOWNLOAD_DIR'], 'boost_versions.json')
|
||||||
|
if update or not os.path.exists(versions_file):
|
||||||
|
req = requests.get(_VERSIONS_URL)
|
||||||
|
versions_data = json.loads(req.text)
|
||||||
|
result = []
|
||||||
|
for version_data in versions_data:
|
||||||
|
match = _VERSION_PATTERN.match(version_data['name'])
|
||||||
|
if not match:
|
||||||
|
continue
|
||||||
|
result.append((int(match.groups()[0]), int(match.groups()[1]), int(match.groups()[2])))
|
||||||
|
with open(versions_file, 'w') as f:
|
||||||
|
json.dump(versions, f)
|
||||||
|
return result
|
||||||
|
else:
|
||||||
|
with open(versions_file, 'r') as f:
|
||||||
|
return [tuple(v) for v in json.load(f)]
|
||||||
|
|
||||||
|
def dependencies(env: Environment, version) -> 'dict':
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def cook(env: Environment, version) -> dict:
|
||||||
|
if env.get('BOOST_LIBS') is None:
|
||||||
|
raise Exception('BOOST_LIBS not set. Set to a list of boost libs to link or "*" to link everything.')
|
||||||
|
if version >= (1, 85, 0):
|
||||||
|
url = f'https://github.com/boostorg/boost/releases/download/boost-{version[0]}.{version[1]}.{version[2]}/boost-{version[0]}.{version[1]}.{version[2]}-cmake.tar.gz'
|
||||||
|
else:
|
||||||
|
url = f'https://github.com/boostorg/boost/releases/download/boost-{version[0]}.{version[1]}.{version[2]}/boost-{version[0]}.{version[1]}.{version[2]}.tar.gz'
|
||||||
|
repo = env.DownloadAndExtract(f'boost_{version[0]}.{version[1]}.{version[2]}', url = url, skip_folders = 1)
|
||||||
checkout_root = repo['extracted_root']
|
checkout_root = repo['extracted_root']
|
||||||
|
build_result = env.CMakeProject(checkout_root)
|
||||||
|
|
||||||
|
libs = []
|
||||||
|
if '*' in env['BOOST_LIBS']:
|
||||||
|
lib_dir = build_result['LIBPATH'][0]
|
||||||
|
for lib_file in os.listdir(lib_dir):
|
||||||
|
fname = os.path.join(lib_dir, lib_file)
|
||||||
|
if not os.path.isfile(fname):
|
||||||
|
continue
|
||||||
|
libs.append(fname)
|
||||||
|
else:
|
||||||
|
for lib in set(env['BOOST_LIBS']):
|
||||||
|
libs.append(env.FindLib(f'boost_{lib}', paths=build_result['LIBPATH']))
|
||||||
return {
|
return {
|
||||||
'CPPPATH': [checkout_root]
|
'CPPPATH': build_result['CPPPATH'],
|
||||||
|
'LIBS': libs
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,19 @@
|
|||||||
|
|
||||||
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref: str = "master") -> dict:
|
def _git_cook(env: Environment, repo) -> dict:
|
||||||
repo = env.GitBranch(repo_name = 'cgltf', remote_url = 'https://github.com/jkuhlmann/cgltf.git', git_ref = git_ref)
|
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
return {
|
return {
|
||||||
'CPPPATH': [checkout_root]
|
'CPPPATH': [checkout_root]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
env.GitRecipe(
|
||||||
|
globals = globals(),
|
||||||
|
repo_name = 'cgltf',
|
||||||
|
repo_url = 'https://github.com/jkuhlmann/cgltf.git',
|
||||||
|
tag_pattern = re.compile(r'^v([0-9]+)\.([0-9]+)$'),
|
||||||
|
tag_fn = lambda version: f'v{version[0]}.{version[1]}',
|
||||||
|
cook_fn = _git_cook
|
||||||
|
)
|
||||||
|
@ -1,16 +1,27 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref: str = 'master') -> dict:
|
|
||||||
repo = env.GitBranch(repo_name = 'fmt', remote_url = 'https://github.com/fmtlib/fmt.git', git_ref = git_ref)
|
def _git_cook(env: Environment, repo: dict) -> dict:
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
build_result = env.CMakeProject(project_root=checkout_root, generate_args = ['-DFMT_TEST=OFF'])
|
build_result = env.CMakeProject(checkout_root)
|
||||||
|
|
||||||
lib_name = {
|
lib_name = {
|
||||||
'debug': 'fmtd'
|
'debug': 'fmtd'
|
||||||
}.get(env['BUILD_TYPE'], 'fmt')
|
}.get(env['BUILD_TYPE'], 'fmt')
|
||||||
return {
|
return {
|
||||||
'LIBPATH': build_result['LIBPATH'],
|
|
||||||
'CPPPATH': build_result['CPPPATH'],
|
'CPPPATH': build_result['CPPPATH'],
|
||||||
'LIBS': [lib_name]
|
'LIBS': [env.FindLib(lib_name, paths=build_result['LIBPATH'])]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
env.GitRecipe(
|
||||||
|
globals = globals(),
|
||||||
|
repo_name = 'fmt',
|
||||||
|
repo_url = 'https://github.com/fmtlib/fmt.git',
|
||||||
|
tag_pattern = re.compile(r'^([0-9]+)\.([0-9]+)\.([0-9]+)$'),
|
||||||
|
tag_fn = lambda version: f'{version[0]}.{version[1]}.{version[2]}',
|
||||||
|
cook_fn = _git_cook
|
||||||
|
)
|
||||||
|
@ -1,13 +1,52 @@
|
|||||||
|
|
||||||
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, remote: str = 'github', git_ref: str = "master") -> dict:
|
_REPO_NAMES = {
|
||||||
if remote == 'mewin':
|
'default': 'glm',
|
||||||
repo = env.GitBranch(repo_name = 'glm_mewin', remote_url = 'https://git.mewin.de/mewin/glm.git', git_ref = git_ref)
|
'mewin': 'glm_mewin'
|
||||||
else:
|
}
|
||||||
repo = env.GitBranch(repo_name = 'glm', remote_url = 'https://github.com/g-truc/glm.git', git_ref = git_ref)
|
_REPO_URLS = {
|
||||||
checkout_root = repo['checkout_root']
|
'default': 'https://github.com/g-truc/glm.git',
|
||||||
|
'mewin': 'https://git.mewin.de/mewin/glm.git'
|
||||||
|
}
|
||||||
|
_TAG_PATTERN = re.compile(r'^([0-9]+)\.([0-9]+)\.([0-9]+)$')
|
||||||
|
_TAG_PATTERN_ALT = re.compile(r'^0\.([0-9]+)\.([0-9]+)\.([0-9]+)$')
|
||||||
|
|
||||||
|
def _get_repo_name(env: Environment) -> str:
|
||||||
|
return _REPO_NAMES[env.get('GLM_REMOTE', 'default')]
|
||||||
|
|
||||||
|
def _get_repo_url(env: Environment) -> str:
|
||||||
|
return _REPO_URLS[env.get('GLM_REMOTE', 'default')]
|
||||||
|
|
||||||
|
def versions(env: Environment, update: bool = False):
|
||||||
|
if env.get('GLM_REMOTE') == 'mewin':
|
||||||
|
return [(0, 0, 0)]
|
||||||
|
|
||||||
|
tags = env.GitTags(repo_name = _get_repo_name(env), remote_url = _get_repo_url(env), force_fetch=update)
|
||||||
|
result = []
|
||||||
|
for tag in tags:
|
||||||
|
match = _TAG_PATTERN.match(tag)
|
||||||
|
if match:
|
||||||
|
result.append((int(match.groups()[0]), int(match.groups()[1]), int(match.groups()[2])))
|
||||||
|
else:
|
||||||
|
match = _TAG_PATTERN_ALT.match(tag)
|
||||||
|
if match:
|
||||||
|
result.append((0, int(match.groups()[0]), int(match.groups()[1]) * 10 + int(match.groups()[2])))
|
||||||
|
return result
|
||||||
|
|
||||||
|
def dependencies(env: Environment, version) -> 'dict':
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def cook(env: Environment, version) -> dict:
|
||||||
|
if env.get('GLM_REMOTE') == 'mewin':
|
||||||
|
git_ref = 'master'
|
||||||
|
elif version[0] == 0:
|
||||||
|
git_ref = f'refs/tags/0.{version[1]}.{int(version[2]/10)}.{version[2]%10}'
|
||||||
|
else:
|
||||||
|
git_ref = f'refs/tags/{version[0]}.{version[1]}.{version[2]}'
|
||||||
|
repo = env.GitBranch(repo_name = _get_repo_name(env), remote_url = _get_repo_url(env), git_ref = git_ref)
|
||||||
|
checkout_root = repo['checkout_root']
|
||||||
return {
|
return {
|
||||||
'CPPPATH': [checkout_root],
|
'CPPPATH': [checkout_root],
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,15 @@
|
|||||||
|
|
||||||
from SCons.Script import *
|
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import os
|
|
||||||
import pathlib
|
import pathlib
|
||||||
import platform
|
import platform
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
from SCons.Script import *
|
||||||
|
|
||||||
_SCRIPT_STAMPFILE = '.spp_script_run'
|
_SCRIPT_STAMPFILE = '.spp_script_run'
|
||||||
|
|
||||||
def cook(env: Environment, remote: str = 'github', git_ref: str = '') -> dict:
|
|
||||||
if remote == 'mewin':
|
def _git_cook(env: Environment, repo) -> dict:
|
||||||
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')
|
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
|
|
||||||
# TODO: windows?
|
# 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') \
|
+ 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')]
|
||||||
|
|
||||||
# disable a few warnings when compiling with clang
|
# disable warnings
|
||||||
additional_cxx_flags = {
|
additional_cxx_flags = {
|
||||||
'clang': ['-Wno-deprecated-copy', '-Wno-missing-field-initializers', '-Wno-gnu-redeclared-enum',
|
'clang': ['-w'],
|
||||||
'-Wno-unused-but-set-variable', '-Wno-deprecated-enum-enum-conversion']
|
'gcc': ['-w'],
|
||||||
|
'cl': ['/w']
|
||||||
}.get(env['COMPILER_FAMILY'], [])
|
}.get(env['COMPILER_FAMILY'], [])
|
||||||
env.StaticLibrary(
|
env.StaticLibrary(
|
||||||
CCFLAGS = env['CCFLAGS'] + additional_cxx_flags,
|
CCFLAGS = env['CCFLAGS'] + additional_cxx_flags,
|
||||||
@ -79,5 +75,37 @@ def cook(env: Environment, remote: str = 'github', git_ref: str = '') -> dict:
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'CPPPATH': [include_dir],
|
'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
|
||||||
|
)
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
import os
|
def _git_cook(env: Environment, repo: dict) -> dict:
|
||||||
|
|
||||||
def cook(env: Environment, backends: list = [], git_ref: str = '') -> dict:
|
|
||||||
repo = env.GitBranch(repo_name = 'imgui', remote_url = 'https://github.com/ocornut/imgui.git', git_ref = git_ref or 'master')
|
|
||||||
|
|
||||||
imgui_source_files = [
|
imgui_source_files = [
|
||||||
os.path.join(repo['checkout_root'], 'imgui.cpp'),
|
os.path.join(repo['checkout_root'], 'imgui.cpp'),
|
||||||
os.path.join(repo['checkout_root'], 'imgui_draw.cpp'),
|
os.path.join(repo['checkout_root'], 'imgui_draw.cpp'),
|
||||||
@ -13,18 +12,27 @@ def cook(env: Environment, backends: list = [], git_ref: str = '') -> dict:
|
|||||||
]
|
]
|
||||||
|
|
||||||
imgui_add_sources = []
|
imgui_add_sources = []
|
||||||
backend_sources = {
|
for backend in env.get('IMGUI_BACKENDS', []):
|
||||||
'vulkan': os.path.join(repo['checkout_root'], 'backends/imgui_impl_vulkan.cpp'),
|
imgui_add_sources.append(f'backends/imgui_impl_{backend}.cpp')
|
||||||
'sdl2': os.path.join(repo['checkout_root'], 'backends/imgui_impl_sdl2.cpp')
|
|
||||||
}
|
|
||||||
for backend in backends:
|
|
||||||
imgui_add_sources.append(backend_sources[backend])
|
|
||||||
|
|
||||||
lib_imgui = env.StaticLibrary(
|
env.StaticLibrary(
|
||||||
CPPPATH = [repo['checkout_root']],
|
CPPPATH = [repo['checkout_root']],
|
||||||
CPPDEFINES = ['IMGUI_IMPL_VULKAN_NO_PROTOTYPES=1'],
|
CPPDEFINES = ['IMGUI_IMPL_VULKAN_NO_PROTOTYPES=1'],
|
||||||
target = env['LIB_DIR'] + '/imgui',
|
target = env['LIB_DIR'] + '/imgui',
|
||||||
source = imgui_source_files,
|
source = imgui_source_files,
|
||||||
add_source = imgui_add_sources
|
add_source = imgui_add_sources
|
||||||
)
|
)
|
||||||
return lib_imgui
|
return {
|
||||||
|
'CPPPATH': [repo['checkout_root']],
|
||||||
|
'LIBS': [os.path.join(env['LIB_DIR'], env.LibFilename('imgui'))]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
env.GitRecipe(
|
||||||
|
globals = globals(),
|
||||||
|
repo_name = 'imgui',
|
||||||
|
repo_url = 'https://github.com/ocornut/imgui.git',
|
||||||
|
tag_pattern = re.compile(r'^v([0-9]+)\.([0-9]+)\.([0-9]+)$'),
|
||||||
|
tag_fn = lambda version: f'v{version[0]}.{version[1]}.{version[2]}',
|
||||||
|
cook_fn = _git_cook
|
||||||
|
)
|
||||||
|
@ -1,8 +1,20 @@
|
|||||||
|
|
||||||
import os
|
import json
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref: str = "master") -> dict:
|
_REPO_NAME = 'iwa'
|
||||||
repo = env.GitBranch(repo_name = 'iwa', remote_url = 'https://git.mewin.de/mewin/iwa.git', git_ref = git_ref)
|
_REPO_URL = 'https://git.mewin.de/mewin/iwa.git'
|
||||||
|
|
||||||
|
def versions(env: Environment, update: bool = False):
|
||||||
|
return [(0, 0, 0)]
|
||||||
|
|
||||||
|
def dependencies(env: Environment, version) -> 'dict':
|
||||||
|
repo = env.GitBranch(repo_name = _REPO_NAME, remote_url = _REPO_URL, git_ref = 'master')
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
return SConscript(os.path.join(checkout_root, 'LibConf'), exports = ['env'])
|
with open(os.path.join(checkout_root, 'dependencies.json'), 'r') as f:
|
||||||
|
return env.DepsFromJson(json.load(f))
|
||||||
|
|
||||||
|
def cook(env: Environment, version) -> dict:
|
||||||
|
repo = env.GitBranch(repo_name = _REPO_NAME, remote_url = _REPO_URL, git_ref = 'master')
|
||||||
|
checkout_root = repo['checkout_root']
|
||||||
|
return env.Module(os.path.join(checkout_root, 'SModule'))
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
|
|
||||||
|
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref = 'master') -> dict:
|
def versions(env: Environment, update: bool = False):
|
||||||
|
return [(1, 0)]
|
||||||
|
|
||||||
|
def dependencies(env: Environment, version) -> 'dict':
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def cook(env: Environment, version) -> dict:
|
||||||
if env['COMPILER_FAMILY'] not in ('gcc', 'clang'):
|
if env['COMPILER_FAMILY'] not in ('gcc', 'clang'):
|
||||||
env.Error('libbacktrace requires gcc or clang.')
|
env.Error('libbacktrace requires gcc or clang.')
|
||||||
repo = env.GitBranch(repo_name = 'libbacktrace', remote_url = 'https://github.com/ianlancetaylor/libbacktrace.git', git_ref = git_ref)
|
repo = env.GitBranch(repo_name = 'libbacktrace', remote_url = 'https://github.com/ianlancetaylor/libbacktrace.git', git_ref = 'master')
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
build_result = env.AutotoolsProject(checkout_root)
|
build_result = env.AutotoolsProject(checkout_root)
|
||||||
return {
|
return {
|
||||||
|
@ -1,11 +1,21 @@
|
|||||||
|
|
||||||
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref = 'main') -> dict:
|
def _git_cook(env: Environment, repo: dict) -> dict:
|
||||||
repo = env.GitBranch(repo_name = 'libjpeg-turbo', remote_url = 'https://github.com/libjpeg-turbo/libjpeg-turbo.git', git_ref = git_ref)
|
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
build_result = env.CMakeProject(checkout_root)
|
build_result = env.CMakeProject(checkout_root)
|
||||||
return {
|
return {
|
||||||
'CPPPATH': build_result['CPPPATH'],
|
'CPPPATH': build_result['CPPPATH'],
|
||||||
'LIBS': [env.FindLib('jpeg', paths=build_result['LIBPATH'])],
|
'LIBS': [env.FindLib('jpeg', paths=build_result['LIBPATH'])],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
env.GitRecipe(
|
||||||
|
globals = globals(),
|
||||||
|
repo_name = 'libjpeg-turbo',
|
||||||
|
repo_url = 'https://github.com/libjpeg-turbo/libjpeg-turbo.git',
|
||||||
|
tag_pattern = re.compile(r'^([0-9]+)\.([0-9]+)\.([0-9]+)$'),
|
||||||
|
tag_fn = lambda version: f'{version[0]}.{version[1]}.{version[2]}',
|
||||||
|
cook_fn = _git_cook
|
||||||
|
)
|
||||||
|
@ -2,34 +2,27 @@
|
|||||||
import re
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
_REPO_NAME = 'libpng'
|
def _git_cook(env: Environment, repo: dict) -> dict:
|
||||||
_REPO_URL = 'https://git.code.sf.net/p/libpng/code.git'
|
lib_zlib = env.Cook('zlib')
|
||||||
_TAG_PATTERN = re.compile(r'^v([0-9])+\.([0-9])+\.([0-9])$')
|
|
||||||
|
|
||||||
def available(env: Environment) -> bool:
|
|
||||||
return hasattr(env, 'GitBranch') and hasattr(env, 'GitTags')
|
|
||||||
|
|
||||||
def versions(env: Environment, update: bool = False) -> 'list[str]':
|
|
||||||
tags = env.GitTags(repo_name = _REPO_NAME, remote_url = _REPO_URL, force_fetch=update)
|
|
||||||
result = []
|
|
||||||
for tag in tags:
|
|
||||||
match = _TAG_PATTERN.match(tag)
|
|
||||||
if match:
|
|
||||||
result.append((int(match.groups()[0]), int(match.groups()[1]), int(match.groups()[2])))
|
|
||||||
return result
|
|
||||||
|
|
||||||
def dependencies(env: Environment, version) -> 'list[dict]':
|
|
||||||
return {
|
|
||||||
'zlib': {}
|
|
||||||
}
|
|
||||||
|
|
||||||
def cook(env: Environment, git_ref = 'master') -> dict:
|
|
||||||
lib_z = env.Cook('zlib')
|
|
||||||
repo = env.GitBranch(repo_name = 'libpng', remote_url = 'https://git.code.sf.net/p/libpng/code.git', git_ref = git_ref)
|
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
build_result = env.AutotoolsProject(checkout_root)
|
build_result = env.CMakeProject(checkout_root, dependencies = [lib_zlib])
|
||||||
|
lib_name = {
|
||||||
|
'debug': 'png16d'
|
||||||
|
}.get(env['BUILD_TYPE'], 'png16')
|
||||||
return {
|
return {
|
||||||
'CPPPATH': build_result['CPPPATH'],
|
'CPPPATH': build_result['CPPPATH'],
|
||||||
'LIBS': [env.FindLib('png16', paths=build_result['LIBPATH'])],
|
'LIBS': [env.FindLib(lib_name, paths=build_result['LIBPATH'])]
|
||||||
'DEPENDENCIES': [lib_z]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
env.GitRecipe(
|
||||||
|
globals = globals(),
|
||||||
|
repo_name = 'libpng',
|
||||||
|
repo_url = 'https://git.code.sf.net/p/libpng/code.git',
|
||||||
|
tag_pattern = re.compile(r'^v([0-9]+)\.([0-9]+)\.([0-9]+)$'),
|
||||||
|
tag_fn = lambda version: f'v{version[0]}.{version[1]}.{version[2]}',
|
||||||
|
cook_fn = _git_cook,
|
||||||
|
dependencies = {
|
||||||
|
'zlib': {}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@ -1,10 +1,19 @@
|
|||||||
|
|
||||||
import os
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref: str = "master") -> dict:
|
def _git_cook(env: Environment, repo: dict) -> dict:
|
||||||
repo = env.GitBranch(repo_name = 'magic_enum', remote_url = 'https://github.com/Neargye/magic_enum.git', git_ref = git_ref)
|
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
return {
|
return {
|
||||||
'CPPPATH': [os.path.join(checkout_root, 'include')]
|
'CPPPATH': [os.path.join(checkout_root, 'include')]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
env.GitRecipe(
|
||||||
|
globals = globals(),
|
||||||
|
repo_name = 'magic_enum',
|
||||||
|
repo_url = 'https://github.com/Neargye/magic_enum.git',
|
||||||
|
tag_pattern = re.compile(r'^v([0-9]+)\.([0-9]+)\.([0-9]+)$'),
|
||||||
|
tag_fn = lambda version: f'v{version[0]}.{version[1]}.{version[2]}',
|
||||||
|
cook_fn = _git_cook
|
||||||
|
)
|
||||||
|
@ -3,8 +3,15 @@ from SCons.Script import *
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def cook(env: Environment, git_ref = 'master') -> dict:
|
|
||||||
repo = env.GitBranch(repo_name = 'mecab', remote_url = 'https://github.com/taku910/mecab.git', git_ref = git_ref)
|
def versions(env: Environment, update: bool = False):
|
||||||
|
return [(1, 0)]
|
||||||
|
|
||||||
|
def dependencies(env: Environment, version) -> 'dict':
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def cook(env: Environment, version) -> dict:
|
||||||
|
repo = env.GitBranch(repo_name = 'mecab', remote_url = 'https://github.com/taku910/mecab.git', git_ref = 'master')
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
build_result = env.AutotoolsProject(os.path.join(checkout_root, 'mecab'))
|
build_result = env.AutotoolsProject(os.path.join(checkout_root, 'mecab'))
|
||||||
return {
|
return {
|
||||||
|
@ -1,8 +1,20 @@
|
|||||||
|
|
||||||
import os
|
import json
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref: str = "master") -> dict:
|
_REPO_NAME = 'mijin'
|
||||||
repo = env.GitBranch(repo_name = 'mijin', remote_url = 'https://git.mewin.de/mewin/mijin2.git', git_ref = git_ref)
|
_REPO_URL = 'https://git.mewin.de/mewin/mijin2.git'
|
||||||
|
|
||||||
|
def versions(env: Environment, update: bool = False):
|
||||||
|
return [(0, 0, 0)]
|
||||||
|
|
||||||
|
def dependencies(env: Environment, version) -> 'dict':
|
||||||
|
repo = env.GitBranch(repo_name = _REPO_NAME, remote_url = _REPO_URL, git_ref = 'master')
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
return SConscript(os.path.join(checkout_root, 'LibConf'), exports = ['env'])
|
with open(os.path.join(checkout_root, 'dependencies.json'), 'r') as f:
|
||||||
|
return env.DepsFromJson(json.load(f))
|
||||||
|
|
||||||
|
def cook(env: Environment, version) -> dict:
|
||||||
|
repo = env.GitBranch(repo_name = _REPO_NAME, remote_url = _REPO_URL, git_ref = 'master')
|
||||||
|
checkout_root = repo['checkout_root']
|
||||||
|
return env.Module(os.path.join(checkout_root, 'SModule'))
|
||||||
|
@ -1,12 +1,23 @@
|
|||||||
|
|
||||||
import os
|
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref: str = 'master') -> dict:
|
def versions(env: Environment, update: bool = False):
|
||||||
repo = env.GitBranch(repo_name = 'mikktspace', remote_url = 'https://github.com/mmikk/MikkTSpace.git', git_ref = git_ref)
|
return [(1, 0)]
|
||||||
|
|
||||||
|
def dependencies(env: Environment, version) -> 'dict':
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def cook(env: Environment, version) -> dict:
|
||||||
|
repo = env.GitBranch(repo_name = 'mikktspace', remote_url = 'https://github.com/mmikk/MikkTSpace.git', git_ref = 'master')
|
||||||
|
checkout_root = repo['checkout_root']
|
||||||
lib_mikktspace = env.StaticLibrary(
|
lib_mikktspace = env.StaticLibrary(
|
||||||
CPPPATH = [repo['checkout_root']],
|
CPPPATH = [checkout_root],
|
||||||
target = env['LIB_DIR'] + '/mikktspace',
|
target = env['LIB_DIR'] + '/mikktspace',
|
||||||
source = [os.path.join(repo['checkout_root'], 'mikktspace.c')]
|
source = [os.path.join(repo['checkout_root'], 'mikktspace.c')]
|
||||||
)
|
)
|
||||||
return lib_mikktspace
|
return {
|
||||||
|
'CPPPATH': [checkout_root],
|
||||||
|
'LIBS': [lib_mikktspace]
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,22 +1,34 @@
|
|||||||
|
|
||||||
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref: str = 'v1.x', use_external_libfmt = False) -> dict:
|
|
||||||
repo = env.GitBranch(repo_name = 'spdlog', remote_url = 'https://github.com/gabime/spdlog.git', git_ref = git_ref)
|
def _git_cook(env: Environment, repo: dict) -> dict:
|
||||||
|
lib_fmt = env.Cook('fmt')
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
build_result = env.CMakeProject(project_root=checkout_root)
|
build_result = env.CMakeProject(project_root=checkout_root, dependencies=[lib_fmt])
|
||||||
|
|
||||||
lib_name = {
|
lib_name = {
|
||||||
'debug': 'spdlogd'
|
'debug': 'spdlogd'
|
||||||
}.get(env['BUILD_TYPE'], 'spdlog')
|
}.get(env['BUILD_TYPE'], 'spdlog')
|
||||||
|
|
||||||
cppdefines = ['SPDLOG_COMPILE_LIB=1']
|
cppdefines = ['SPDLOG_COMPILE_LIB=1', 'SPDLOG_FMT_EXTERNAL=1']
|
||||||
if use_external_libfmt:
|
|
||||||
cppdefines.append('SPDLOG_FMT_EXTERNAL=1')
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'LIBPATH': build_result['LIBPATH'],
|
|
||||||
'CPPPATH': build_result['CPPPATH'],
|
'CPPPATH': build_result['CPPPATH'],
|
||||||
'CPPDEFINES': cppdefines,
|
'CPPDEFINES': cppdefines,
|
||||||
'LIBS': [lib_name]
|
'LIBS': [env.FindLib(lib_name, paths=build_result['LIBPATH'])]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
env.GitRecipe(
|
||||||
|
globals = globals(),
|
||||||
|
repo_name = 'spdlog',
|
||||||
|
repo_url = 'https://github.com/gabime/spdlog.git',
|
||||||
|
tag_pattern = re.compile(r'^v([0-9]+)\.([0-9]+)\.([0-9]+)$'),
|
||||||
|
tag_fn = lambda version: f'v{version[0]}.{version[1]}.{version[2]}',
|
||||||
|
cook_fn = _git_cook,
|
||||||
|
dependencies = {
|
||||||
|
'fmt': {}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@ -1,8 +1,18 @@
|
|||||||
|
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref: str = "master") -> dict:
|
_REPO_NAME = 'stb'
|
||||||
repo = env.GitBranch(repo_name = 'stb', remote_url = 'https://github.com/nothings/stb.git', git_ref = git_ref)
|
_REPO_URL = 'https://github.com/nothings/stb.git'
|
||||||
|
|
||||||
|
|
||||||
|
def versions(env: Environment, update: bool = False):
|
||||||
|
return [(0, 0, 0)]
|
||||||
|
|
||||||
|
def dependencies(env: Environment, version) -> 'dict':
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def cook(env: Environment, version) -> dict:
|
||||||
|
repo = env.GitBranch(repo_name = _REPO_NAME, remote_url = _REPO_URL, git_ref = 'master')
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
return {
|
return {
|
||||||
'CPPPATH': [checkout_root]
|
'CPPPATH': [checkout_root]
|
||||||
|
@ -1,15 +1,26 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref: str = "master") -> dict:
|
|
||||||
repo = env.GitBranch(repo_name = 'yaml-cpp', remote_url = 'https://github.com/jbeder/yaml-cpp', git_ref = git_ref)
|
def _git_cook(env: Environment, repo: dict) -> dict:
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
build_result = env.CMakeProject(project_root=checkout_root)
|
build_result = env.CMakeProject(project_root=checkout_root)
|
||||||
lib_name = {
|
lib_name = {
|
||||||
'debug': 'yaml-cppd'
|
'debug': 'yaml-cppd'
|
||||||
}.get(env['BUILD_TYPE'], 'yaml-cpp')
|
}.get(env['BUILD_TYPE'], 'yaml-cpp')
|
||||||
return {
|
return {
|
||||||
'LIBPATH': build_result['LIBPATH'],
|
|
||||||
'CPPPATH': build_result['CPPPATH'],
|
'CPPPATH': build_result['CPPPATH'],
|
||||||
'LIBS': [lib_name]
|
'LIBS': [env.FindLib(lib_name, paths=build_result['LIBPATH'])]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
env.GitRecipe(
|
||||||
|
globals = globals(),
|
||||||
|
repo_name = 'yaml-cpp',
|
||||||
|
repo_url = 'https://github.com/jbeder/yaml-cpp',
|
||||||
|
tag_pattern = re.compile(r'^yaml-cpp-([0-9]+)\.([0-9]+)\.([0-9]+)$'),
|
||||||
|
tag_fn = lambda version: f'yaml-cpp-{version[0]}.{version[1]}.{version[2]}',
|
||||||
|
cook_fn = _git_cook
|
||||||
|
)
|
||||||
|
@ -1,12 +1,31 @@
|
|||||||
|
|
||||||
import os
|
import re
|
||||||
from SCons.Script import *
|
from SCons.Script import *
|
||||||
|
|
||||||
def cook(env: Environment, git_ref: str = 'master') -> dict:
|
_REPO_NAME = 'zlib'
|
||||||
repo = env.GitBranch(repo_name = 'zlib', remote_url = 'https://github.com/madler/zlib.git', git_ref = git_ref)
|
_REPO_URL = 'https://github.com/madler/zlib.git'
|
||||||
extracted_root = repo['checkout_root']
|
_TAG_PATTERN = re.compile(r'^v([0-9]+)\.([0-9]+)(?:\.([0-9]+))?$')
|
||||||
build_result = env.CMakeProject(project_root=extracted_root)
|
|
||||||
|
def versions(env: Environment, update: bool = False):
|
||||||
|
tags = env.GitTags(repo_name = _REPO_NAME, remote_url = _REPO_URL, force_fetch=update)
|
||||||
|
result = []
|
||||||
|
for tag in tags:
|
||||||
|
match = _TAG_PATTERN.match(tag)
|
||||||
|
if match:
|
||||||
|
result.append((int(match.groups()[0]), int(match.groups()[1]), int(match.groups()[2] or 0)))
|
||||||
|
return result
|
||||||
|
|
||||||
|
def dependencies(env: Environment, version) -> 'dict':
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def cook(env: Environment, version) -> dict:
|
||||||
|
git_ref = f'refs/tags/v{version[0]}.{version[1]}'
|
||||||
|
if version[2] != 0:
|
||||||
|
git_ref = git_ref + f'.{version[2]}'
|
||||||
|
repo = env.GitBranch(repo_name = _REPO_NAME, remote_url = _REPO_URL, git_ref = git_ref)
|
||||||
|
checkout_root = repo['checkout_root']
|
||||||
|
build_result = env.CMakeProject(project_root=checkout_root)
|
||||||
return {
|
return {
|
||||||
'CPPPATH': [os.path.join(build_result['install_dir'], 'install')],
|
'CPPPATH': [os.path.join(build_result['install_dir'], 'include')],
|
||||||
'LIBS': [env.FindLib('z', paths=build_result['LIBPATH'])]
|
'LIBS': [env.FindLib('z', paths=build_result['LIBPATH'])]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user