Compare commits
87 Commits
develop
...
8770bd97dc
| Author | SHA1 | Date | |
|---|---|---|---|
| 8770bd97dc | |||
| 68f20bcf2d | |||
| e583c5ef6c | |||
| c3b5244eac | |||
| 88844ee5da | |||
| 161f2e52d8 | |||
| 9436d2c48d | |||
| 2769fd801f | |||
|
|
5f11d64744 | ||
| 1401fdea90 | |||
|
|
3a3c79d240 | ||
| e6e7dbe642 | |||
| 1edf745b39 | |||
| 9e5fc05f4f | |||
| d03b7097f7 | |||
| ba5def01b0 | |||
|
|
4082f8cb22 | ||
|
|
0bec9f7062 | ||
| 283aa0f99c | |||
| 71f8631e48 | |||
| ae739b9946 | |||
| 2cc3145669 | |||
| 5159c80167 | |||
| 748f8f229f | |||
| b034e87aaf | |||
| 726d206f9a | |||
| 5debc6d334 | |||
| 5c6a8a1cc6 | |||
| 9d3d52ffaf | |||
| c994752c32 | |||
| 42dada23c9 | |||
| 0e22057fc4 | |||
| c883f3c1c7 | |||
| bca2398828 | |||
| 10a5239b7f | |||
| 0b8d115907 | |||
| 134fb106a8 | |||
| b546931c09 | |||
| 7c4e403747 | |||
| c24c864915 | |||
| fe95a92cf6 | |||
| 1bdc1ef7a0 | |||
| ff219840ea | |||
| ee55878b18 | |||
| 55893909f0 | |||
| 349a08b084 | |||
| 5490de84eb | |||
| 70fc36335a | |||
| ca1466469f | |||
| 42a433582c | |||
| 0dcd8b383c | |||
| 946cfc57ce | |||
| 28c1675b87 | |||
| 7345305a77 | |||
| 651c8770c3 | |||
| 071cd207a9 | |||
| a479e90335 | |||
| cdbec36b8f | |||
| f2dc9872f7 | |||
| 2b05834798 | |||
| e3b3fd8f7c | |||
| 329278c5f5 | |||
| a0bbb46e51 | |||
| c6bba0e440 | |||
| 0a29b41639 | |||
| a7c736de56 | |||
| b45fec7561 | |||
| c74fbb8798 | |||
| fe8f329b38 | |||
| ae870e798d | |||
| 941f94a7b6 | |||
| 1b8d6e175b | |||
| bdf063a16c | |||
| 6cd076394d | |||
| 0175b812a2 | |||
| eb044b6d2f | |||
| e6adeb3a20 | |||
| fa83ff4581 | |||
| 29791d2e9c | |||
| 4e579121db | |||
| cd727e5a1d | |||
| 6f83b68788 | |||
| 17ee9777ed | |||
| ecb8ea9a74 | |||
| a3426f1132 | |||
| e9438455ea | |||
| cc5fd2d668 |
833
SConscript
833
SConscript
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@ _BUILT_STAMPFILE = '.spp_built'
|
||||
|
||||
Import('env')
|
||||
|
||||
def _autotools_project(env: Environment, project_root: str, config_args: 'list[str]' = [], build_args : 'list[str]' = [], install_args : 'list[str]' = []) -> dict:
|
||||
def _autotools_project(env: Environment, project_root: str, config_args: 'list[str]' = [], build_args : 'list[str]' = [], install_args : 'list[str]' = [], configure_script_path: str = 'configure', skip_steps = ()) -> dict:
|
||||
config = env['BUILD_TYPE']
|
||||
build_dir = os.path.join(project_root, f'build_{config}')
|
||||
install_dir = os.path.join(project_root, f'install_{config}')
|
||||
@@ -27,15 +27,32 @@ def _autotools_project(env: Environment, project_root: str, config_args: 'list[s
|
||||
jobs = env.GetOption('num_jobs')
|
||||
env = os.environ.copy()
|
||||
env['CFLAGS'] = cflags
|
||||
|
||||
config_script = os.path.join(project_root, configure_script_path)
|
||||
if not os.path.exists(config_script) and os.path.exists(f'{config_script}.ac'):
|
||||
subprocess.run(('autoreconf', '--install', '--force'), cwd=project_root)
|
||||
|
||||
subprocess.run((os.path.join(project_root, 'configure'), '--prefix', install_dir, *config_args), cwd=build_dir, env=env, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
||||
subprocess.run(('make', f'-j{jobs}', *build_args), cwd=build_dir, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
||||
subprocess.run(('make', 'install', *install_args), cwd=build_dir, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
||||
if 'configure' not in skip_steps:
|
||||
subprocess.run((config_script, f'--prefix={install_dir}', *config_args), cwd=build_dir, env=env, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
||||
if 'build' not in skip_steps:
|
||||
subprocess.run(('make', f'-j{jobs}', *build_args), cwd=build_dir, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
||||
if 'install' not in skip_steps:
|
||||
subprocess.run(('make', 'install', *install_args), cwd=build_dir, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
||||
else:
|
||||
# must still create the install dir for the stamp file
|
||||
os.makedirs(install_dir, exist_ok=True)
|
||||
pathlib.Path(install_dir, _BUILT_STAMPFILE).touch()
|
||||
|
||||
libpath = []
|
||||
for lib_folder in ('lib', 'lib64'):
|
||||
full_path = os.path.join(install_dir, lib_folder)
|
||||
if os.path.exists(full_path):
|
||||
libpath.append(full_path)
|
||||
|
||||
return {
|
||||
'build_dir': build_dir,
|
||||
'install_dir': install_dir,
|
||||
'LIBPATH': [os.path.join(install_dir, 'lib')],
|
||||
'LIBPATH': libpath,
|
||||
'CPPPATH': [os.path.join(install_dir, 'include')]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
|
||||
import os
|
||||
import json
|
||||
import pathlib
|
||||
import shutil
|
||||
|
||||
from SCons.Script import *
|
||||
|
||||
_BUILT_STAMPFILE = '.spp_built'
|
||||
_VERSION = 2 # bump if you change how the projects are build to trigger a clean build
|
||||
|
||||
Import('env')
|
||||
|
||||
@@ -11,11 +14,66 @@ def cmd_quote(s: str) -> str:
|
||||
escaped = s.replace('\\', '\\\\')
|
||||
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(env, dependencies: 'list[dict]') -> str:
|
||||
parts = env['DEPS_CFLAGS'].copy()
|
||||
for dependency in dependencies:
|
||||
for path in dependency.get('CPPPATH', []):
|
||||
parts.append(f'-I{path}')
|
||||
return cmd_quote(' '.join(parts))
|
||||
|
||||
def _generate_cmake_cxx_flags(env, dependencies: 'list[dict]') -> str:
|
||||
parts = env['DEPS_CXXFLAGS'].copy()
|
||||
for dependency in dependencies:
|
||||
for path in dependency.get('CPPPATH', []):
|
||||
parts.append(f'-I{path}')
|
||||
return cmd_quote(' '.join(parts))
|
||||
|
||||
def _get_cmake_cxx_standard(env: Environment) -> str:
|
||||
return env['CXX_STANDARD'][3:] # we use "C++XX", CMake just "XX"
|
||||
|
||||
def _get_cmake_prefix_path(dependencies: 'list[dict]') -> str:
|
||||
parts = []
|
||||
for dependency in dependencies:
|
||||
for path in dependency.get('CMAKE_PREFIX_PATH', []):
|
||||
parts.append(path)
|
||||
return cmd_quote(';'.join(parts))
|
||||
|
||||
def _generate_cmake_args(env: Environment, dependencies: 'list[dict]') -> 'list[str]':
|
||||
args = [f'-DCMAKE_C_FLAGS={_generate_cmake_c_flags(env, dependencies)}',
|
||||
f'-DCMAKE_CXX_FLAGS={_generate_cmake_cxx_flags(env, dependencies)}',
|
||||
f'-DCMAKE_CXX_STANDARD={_get_cmake_cxx_standard(env)}',
|
||||
f'-DCMAKE_PREFIX_PATH={_get_cmake_prefix_path(dependencies)}']
|
||||
for dependency in dependencies:
|
||||
for name, value in dependency.get('CMAKE_VARS', {}).items():
|
||||
args.append(f'-D{name}={cmd_quote(value)}')
|
||||
return args
|
||||
|
||||
def _calc_version_hash(env, dependencies: 'list[dict]') -> str:
|
||||
return json.dumps({
|
||||
'version': _VERSION,
|
||||
'dependencies': dependencies,
|
||||
'cxxflags': env['DEPS_CXXFLAGS']
|
||||
})
|
||||
|
||||
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']
|
||||
build_dir = os.path.join(project_root, f'build_{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(env, 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']:
|
||||
print(f'Building {project_root}, config {config}')
|
||||
os.makedirs(build_dir, exist_ok=True)
|
||||
@@ -26,14 +84,19 @@ def _cmake_project(env: Environment, project_root: str, generate_args: 'list[str
|
||||
'profile': 'RelWithDebInfo'
|
||||
}.get(env['BUILD_TYPE'], 'RelWithDebInfo')
|
||||
def run_cmd(args):
|
||||
env.Execute(' '.join([str(s) for s in args]))
|
||||
if env.Execute(' '.join([str(s) for s in args])):
|
||||
Exit(1)
|
||||
# TODO: is this a problem?
|
||||
# environ = os.environ.copy()
|
||||
# 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',
|
||||
*_generate_cmake_args(env, dependencies), *generate_args, project_root])
|
||||
run_cmd(['cmake', '--build', *build_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 = []
|
||||
for lib_folder in ('lib', 'lib64'):
|
||||
@@ -43,6 +106,7 @@ def _cmake_project(env: Environment, project_root: str, generate_args: 'list[str
|
||||
|
||||
return {
|
||||
'install_dir': install_dir,
|
||||
'BINPATH': [os.path.join(install_dir, 'bin')],
|
||||
'LIBPATH': libpath,
|
||||
'CPPPATH': [os.path.join(install_dir, 'include')]
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
from git import Repo
|
||||
from git.exc import GitError
|
||||
import hashlib
|
||||
import os
|
||||
import inspect
|
||||
from SCons.Script import *
|
||||
|
||||
Import('env')
|
||||
|
||||
def _gitbranch(env: Environment, repo_name: str, remote_url: str, git_ref: str = "main") -> dict:
|
||||
def _clone(env: Environment, repo_name: str, remote_url: str):
|
||||
repo_dir = os.path.join(env['CLONE_DIR'], 'git', repo_name, '_bare')
|
||||
try:
|
||||
repo = Repo(repo_dir)
|
||||
@@ -16,24 +16,114 @@ def _gitbranch(env: Environment, repo_name: str, remote_url: str, git_ref: str =
|
||||
print(f'Initializing git repository at {repo_dir}.')
|
||||
repo = Repo.init(repo_dir, bare=True)
|
||||
origin = repo.create_remote('origin', remote_url)
|
||||
return repo, origin
|
||||
|
||||
def _git_branch(env: Environment, repo_name: str, remote_url: str, git_ref: str = 'main') -> dict:
|
||||
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!
|
||||
update_submodules = False
|
||||
if not os.path.exists(worktree_dir):
|
||||
print(f'Checking out into {worktree_dir}.')
|
||||
origin.fetch(tags=True)
|
||||
origin.fetch(tags=True, force=True)
|
||||
os.makedirs(worktree_dir)
|
||||
repo.git.worktree('add', worktree_dir, git_ref)
|
||||
worktree_repo = Repo(worktree_dir)
|
||||
update_submodules = True
|
||||
elif env['UPDATE_REPOSITORIES']:
|
||||
worktree_repo = Repo(worktree_dir)
|
||||
if not worktree_repo.head.is_detached:
|
||||
print(f'Updating git repository at {worktree_dir}')
|
||||
worktree_origin = worktree_repo.remotes['origin']
|
||||
worktree_origin.pull()
|
||||
update_submodules = True
|
||||
else:
|
||||
print(f'Not updating git repository {worktree_dir} as it is not on a branch.')
|
||||
if update_submodules:
|
||||
for submodule in worktree_repo.submodules:
|
||||
submodule.update(init=True)
|
||||
return {
|
||||
'checkout_root': worktree_dir
|
||||
'checkout_root': worktree_dir,
|
||||
'repo': repo,
|
||||
'origin': origin
|
||||
}
|
||||
|
||||
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)
|
||||
if force_fetch or env['UPDATE_REPOSITORIES']:
|
||||
origin.fetch(tags=True)
|
||||
return [t.name for t in repo.tags]
|
||||
|
||||
env.AddMethod(_gitbranch, 'GitBranch')
|
||||
def _make_callable(val):
|
||||
if callable(val):
|
||||
return val
|
||||
else:
|
||||
def _wrapped(*args, **kwargs):
|
||||
return val
|
||||
return _wrapped
|
||||
|
||||
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)
|
||||
dependencies_cb = _make_callable(dependencies)
|
||||
|
||||
def _versions(env: Environment, update: bool = False, options: dict = {}):
|
||||
if 'ref' in options:
|
||||
return [(0, 0, 0)] # no versions if compiling from a branch
|
||||
pattern_signature = inspect.signature(_tag_pattern)
|
||||
kwargs = {}
|
||||
if 'options' in pattern_signature.parameters:
|
||||
kwargs['options'] = options
|
||||
pattern = _tag_pattern(env, **kwargs)
|
||||
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, options: dict) -> 'dict':
|
||||
dependencies_signature = inspect.signature(dependencies_cb)
|
||||
kwargs = {}
|
||||
if 'options' in dependencies_signature.parameters:
|
||||
kwargs['options'] = options
|
||||
return dependencies_cb(env, version, **kwargs)
|
||||
|
||||
def _cook(env: Environment, version, options: dict = {}) -> dict:
|
||||
if 'ref' in options:
|
||||
git_ref = options['ref']
|
||||
elif tag_fn:
|
||||
tag_signature = inspect.signature(tag_fn)
|
||||
kwargs = {}
|
||||
if 'options' in tag_signature.parameters:
|
||||
kwargs['options'] = options
|
||||
git_ref = f'refs/tags/{tag_fn(version, **kwargs)}'
|
||||
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)
|
||||
|
||||
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['dependencies'] = _dependencies
|
||||
globals['cook'] = _cook
|
||||
|
||||
env.AddMethod(_git_branch, 'GitBranch')
|
||||
env.AddMethod(_git_tags, 'GitTags')
|
||||
env.AddMethod(_git_recipe, 'GitRecipe')
|
||||
Return('env')
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
Import('env')
|
||||
@@ -31,8 +32,33 @@ def _wrap_jinja(orig_jinja):
|
||||
return target
|
||||
return _wrapped
|
||||
|
||||
def _find_file(env, fname):
|
||||
for path in env['JINJA_FILE_SEARCHPATH']:
|
||||
fullpath = os.path.join(path.abspath, fname)
|
||||
if os.path.exists(fullpath):
|
||||
return env.File(fullpath)
|
||||
return None
|
||||
|
||||
def _file_size(env, fname: str) -> int:
|
||||
file = _find_file(env, fname)
|
||||
if not file:
|
||||
env.Error(f'File does not exist: {fname}. Searched in: {[d.abspath for d in env["JINJA_FILE_SEARCHPATH"]]}')
|
||||
return file.get_size()
|
||||
|
||||
def _file_content_hex(env, fname: str) -> str:
|
||||
file = _find_file(env, fname)
|
||||
if not file:
|
||||
env.Error(f'File does not exist: {fname}. Searched in: {[d.abspath for d in env["JINJA_FILE_SEARCHPATH"]]}')
|
||||
bytes = file.get_contents()
|
||||
return ','.join([hex(byte) for byte in bytes])
|
||||
|
||||
env.AddMethod(_wrap_jinja(env.Jinja), 'Jinja')
|
||||
env.Append(JINJA_FILTERS = {'load_config': _jinja_load_config})
|
||||
env.Append(JINJA_GLOBALS = {
|
||||
'file_size': lambda *args: _file_size(env, *args),
|
||||
'file_content_hex': lambda *args: _file_content_hex(env, *args)
|
||||
})
|
||||
env.Append(JINJA_TEMPLATE_SEARCHPATH = ['data/jinja'])
|
||||
env['JINJA_CONFIG_SEARCHPATH'] = [env.Dir('#data/config')]
|
||||
env['JINJA_FILE_SEARCHPATH'] = [env.Dir('#')]
|
||||
Return('env')
|
||||
|
||||
11
addons/recipe_repository.py
Normal file
11
addons/recipe_repository.py
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
import os
|
||||
|
||||
Import('env')
|
||||
def _recipe_repository(env, repo_name: str, remote_url: str, git_ref: str = 'master') -> None:
|
||||
repo = env.GitBranch(repo_name = os.path.join('recipe_repos', repo_name), remote_url = remote_url, git_ref = git_ref)
|
||||
env.Append(SPP_RECIPES_FOLDERS = [os.path.join(repo['checkout_root'], 'recipes')])
|
||||
|
||||
env.AddMethod(_recipe_repository, 'RecipeRepo')
|
||||
Return('env')
|
||||
13
contrib/builder/Dockerfile
Normal file
13
contrib/builder/Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
FROM debian:sid-slim
|
||||
RUN apt-get -y update && \
|
||||
apt-get -y upgrade && \
|
||||
apt-get -y install build-essential clang-19 gcc-14 g++-14 python3 python3-pip \
|
||||
virtualenv python-is-python3 clang-tidy git ninja-build cmake
|
||||
RUN ln -s /usr/bin/clang-19 /usr/local/bin/clang \
|
||||
&& ln -s /usr/bin/clang++-19 /usr/local/bin/clang++ \
|
||||
&& ln -s /usr/bin/clang-tidy-19 /usr/local/bin/clang-tidy \
|
||||
&& ln -s /usr/bin/run-clang-tidy-19 /usr/local/bin/run-clang-tidy
|
||||
|
||||
COPY scripts /opt/scripts
|
||||
|
||||
RUN chmod a+x /opt/scripts/*.sh
|
||||
9
contrib/builder/scripts/build_clang.sh
Normal file
9
contrib/builder/scripts/build_clang.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -xe
|
||||
python -m virtualenv venv
|
||||
source venv/bin/activate
|
||||
pip install scons
|
||||
pip install -r external/scons-plus-plus/requirements.txt
|
||||
scons -j$(nproc) --build_type=debug --variant=linux_clang_debug --compiler=clang
|
||||
scons -j$(nproc) --build_type=release_debug --variant=linux_clang_release_debug --compiler=clang
|
||||
scons -j$(nproc) --build_type=release --variant=linux_clang_release --compiler=clang
|
||||
9
contrib/builder/scripts/build_gcc.sh
Normal file
9
contrib/builder/scripts/build_gcc.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -xe
|
||||
python -m virtualenv venv
|
||||
source venv/bin/activate
|
||||
pip install scons
|
||||
pip install -r external/scons-plus-plus/requirements.txt
|
||||
scons -j$(nproc) --build_type=debug --variant=linux_gcc_debug --compiler=gcc
|
||||
scons -j$(nproc) --build_type=release_debug --variant=linux_gcc_release_debug --compiler=gcc
|
||||
scons -j$(nproc) --build_type=release --variant=linux_gcc_release --compiler=gcc
|
||||
6
contrib/run_scons.py
Normal file
6
contrib/run_scons.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# use this to start SCons from the IDE for debugging
|
||||
import sys
|
||||
from SCons.Script.Main import main
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
@@ -1,21 +0,0 @@
|
||||
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, git_ref: str = 'master', own_main: bool = False) -> dict:
|
||||
repo = env.GitBranch(repo_name = 'catch2', remote_url = 'https://github.com/catchorg/Catch2.git', git_ref = git_ref)
|
||||
checkout_root = repo['checkout_root']
|
||||
build_result = env.CMakeProject(project_root=checkout_root)
|
||||
|
||||
lib_name = {
|
||||
'debug': 'Catch2d'
|
||||
}.get(env['BUILD_TYPE'], 'Catch2')
|
||||
libs = [lib_name]
|
||||
if not own_main:
|
||||
libs.append({
|
||||
'debug': 'Catch2Maind'
|
||||
}.get(env['BUILD_TYPE'], 'Catch2Main'))
|
||||
return {
|
||||
'LIBPATH': build_result['LIBPATH'],
|
||||
'CPPPATH': build_result['CPPPATH'],
|
||||
'LIBS': libs
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, git_ref = 'main') -> dict:
|
||||
repo = env.GitBranch(repo_name = 'ImageMagick', remote_url = 'https://github.com/ImageMagick/ImageMagick.git', 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,27 +0,0 @@
|
||||
|
||||
import os
|
||||
import platform
|
||||
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)
|
||||
checkout_root = repo['checkout_root']
|
||||
build_result = env.CMakeProject(project_root=checkout_root, generate_args = ['-DSDL_STATIC=ON', '-DSDL_SHARED=OFF'])
|
||||
libs = []
|
||||
if platform.system() == 'Windows':
|
||||
if env['BUILD_TYPE'] == 'debug':
|
||||
libs.append('SDL2-staticd')
|
||||
else:
|
||||
libs.append('SDL2-static')
|
||||
libs.extend(('kernel32', 'user32', 'gdi32', 'winmm', 'imm32', 'ole32', 'oleaut32', 'version', 'uuid', 'advapi32', 'setupapi', 'shell32', 'dinput8'))
|
||||
else:
|
||||
if env['BUILD_TYPE'] == 'debug':
|
||||
libs.append('SDL2d')
|
||||
else:
|
||||
libs.append('SDL2')
|
||||
return {
|
||||
'LIBPATH': build_result['LIBPATH'],
|
||||
'CPPPATH': [os.path.join(build_result['install_dir'], 'include/SDL2')], # SDL is really weird about include paths ...
|
||||
'LIBS': libs
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
import os
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, remote: str = 'github', git_ref: str = 'main') -> dict:
|
||||
if remote == 'mewin':
|
||||
repo = env.GitBranch(repo_name = 'VulkanHeaders_mewin', remote_url = 'https://git.mewin.de/mewin/vulkan-headers.git', git_ref = git_ref)
|
||||
else:
|
||||
repo = env.GitBranch(repo_name = 'VulkanHeaders', remote_url = 'https://github.com/KhronosGroup/Vulkan-Headers.git', git_ref = git_ref)
|
||||
checkout_root = repo['checkout_root']
|
||||
return {
|
||||
'CPPPATH': [os.path.join(checkout_root, 'include')]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
import os
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, git_ref: str = "master") -> 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']
|
||||
return {
|
||||
'CPPPATH': [os.path.join(checkout_root, 'include')]
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
import os
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, version: str = "1.85.0") -> dict:
|
||||
# TODO: build binaries?
|
||||
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)
|
||||
checkout_root = repo['extracted_root']
|
||||
return {
|
||||
'CPPPATH': [checkout_root]
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, git_ref: str = "master") -> dict:
|
||||
repo = env.GitBranch(repo_name = 'cgltf', remote_url = 'https://github.com/jkuhlmann/cgltf.git', git_ref = git_ref)
|
||||
checkout_root = repo['checkout_root']
|
||||
return {
|
||||
'CPPPATH': [checkout_root]
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
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)
|
||||
checkout_root = repo['checkout_root']
|
||||
build_result = env.CMakeProject(project_root=checkout_root, generate_args = ['-DFMT_TEST=OFF'])
|
||||
|
||||
lib_name = {
|
||||
'debug': 'fmtd'
|
||||
}.get(env['BUILD_TYPE'], 'fmt')
|
||||
return {
|
||||
'LIBPATH': build_result['LIBPATH'],
|
||||
'CPPPATH': build_result['CPPPATH'],
|
||||
'LIBS': [lib_name]
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, remote: str = 'github', git_ref: str = "master") -> dict:
|
||||
if remote == 'mewin':
|
||||
repo = env.GitBranch(repo_name = 'glm_mewin', remote_url = 'https://git.mewin.de/mewin/glm.git', git_ref = git_ref)
|
||||
else:
|
||||
repo = env.GitBranch(repo_name = 'glm', remote_url = 'https://github.com/g-truc/glm.git', git_ref = git_ref)
|
||||
checkout_root = repo['checkout_root']
|
||||
|
||||
return {
|
||||
'CPPPATH': [checkout_root],
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
|
||||
from SCons.Script import *
|
||||
|
||||
import glob
|
||||
import os
|
||||
import pathlib
|
||||
import platform
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
_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')
|
||||
checkout_root = repo['checkout_root']
|
||||
|
||||
# TODO: windows?
|
||||
did_run_script = os.path.exists(os.path.join(repo['checkout_root'], _SCRIPT_STAMPFILE))
|
||||
if not did_run_script or env['UPDATE_REPOSITORIES']:
|
||||
python_exe = os.path.realpath(sys.executable)
|
||||
script_file = os.path.join(repo['checkout_root'], 'update_glslang_sources.py')
|
||||
prev_cwd = os.getcwd()
|
||||
os.chdir(repo['checkout_root'])
|
||||
if env.Execute(f'"{python_exe}" {script_file}'):
|
||||
env.Exit(1)
|
||||
os.chdir(prev_cwd)
|
||||
pathlib.Path(repo['checkout_root'], _SCRIPT_STAMPFILE).touch()
|
||||
|
||||
# generate the build_info.h
|
||||
generator_script = os.path.join(repo['checkout_root'], 'build_info.py')
|
||||
generator_script_input = os.path.join(repo['checkout_root'], 'build_info.h.tmpl')
|
||||
generator_script_output = os.path.join(repo['checkout_root'], 'glslang/build_info.h')
|
||||
env.Command(
|
||||
target = generator_script_output,
|
||||
source = [generator_script, generator_script_input, os.path.join(repo['checkout_root'], 'CHANGES.md')],
|
||||
action = f'"$PYTHON" "{generator_script}" "{repo["checkout_root"]}" -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'], 'SPIRV/'), '*.cpp') \
|
||||
+ [os.path.join(repo['checkout_root'], f'glslang/OSDependent/{platform_source_dir}/ossource.cpp')]
|
||||
|
||||
# disable a few warnings when compiling with clang
|
||||
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']
|
||||
}.get(env['COMPILER_FAMILY'], [])
|
||||
env.StaticLibrary(
|
||||
CCFLAGS = env['CCFLAGS'] + additional_cxx_flags,
|
||||
CPPPATH = repo['checkout_root'],
|
||||
target = env['LIB_DIR'] + '/glslang_full',
|
||||
source = glslang_source_files
|
||||
)
|
||||
|
||||
# build the include folder
|
||||
include_dir = os.path.join(checkout_root, 'include')
|
||||
if not os.path.exists(include_dir) or env['UPDATE_REPOSITORIES']:
|
||||
def copy_headers(dst, src):
|
||||
os.makedirs(dst, exist_ok=True)
|
||||
for file in glob.glob(os.path.join(src, '*.h')):
|
||||
shutil.copy(file, dst)
|
||||
|
||||
copy_headers(os.path.join(include_dir, 'glslang/HLSL'), os.path.join(checkout_root, 'glslang/HLSL'))
|
||||
copy_headers(os.path.join(include_dir, 'glslang/Include'), os.path.join(checkout_root, 'glslang/Include'))
|
||||
copy_headers(os.path.join(include_dir, 'glslang/MachineIndependent'), os.path.join(checkout_root, 'glslang/MachineIndependent'))
|
||||
copy_headers(os.path.join(include_dir, 'glslang/Public'), os.path.join(checkout_root, 'glslang/Public'))
|
||||
copy_headers(os.path.join(include_dir, 'glslang/SPIRV'), os.path.join(checkout_root, 'SPIRV'))
|
||||
|
||||
return {
|
||||
'CPPPATH': [include_dir],
|
||||
'LIBS': ['glslang_full']
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
from SCons.Script import *
|
||||
|
||||
import os
|
||||
|
||||
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 = [
|
||||
os.path.join(repo['checkout_root'], 'imgui.cpp'),
|
||||
os.path.join(repo['checkout_root'], 'imgui_draw.cpp'),
|
||||
os.path.join(repo['checkout_root'], 'imgui_tables.cpp'),
|
||||
os.path.join(repo['checkout_root'], 'imgui_widgets.cpp')
|
||||
]
|
||||
|
||||
imgui_add_sources = []
|
||||
backend_sources = {
|
||||
'vulkan': os.path.join(repo['checkout_root'], 'backends/imgui_impl_vulkan.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(
|
||||
CPPPATH = [repo['checkout_root']],
|
||||
CPPDEFINES = ['IMGUI_IMPL_VULKAN_NO_PROTOTYPES=1'],
|
||||
target = env['LIB_DIR'] + '/imgui',
|
||||
source = imgui_source_files,
|
||||
add_source = imgui_add_sources
|
||||
)
|
||||
return lib_imgui
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
import os
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, git_ref: str = "master") -> dict:
|
||||
repo = env.GitBranch(repo_name = 'iwa', remote_url = 'https://git.mewin.de/mewin/iwa.git', git_ref = git_ref)
|
||||
checkout_root = repo['checkout_root']
|
||||
return SConscript(os.path.join(checkout_root, 'LibConf'), exports = ['env'])
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, git_ref = 'master') -> dict:
|
||||
if env['COMPILER_FAMILY'] not in ('gcc', '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)
|
||||
checkout_root = repo['checkout_root']
|
||||
build_result = env.AutotoolsProject(checkout_root)
|
||||
return {
|
||||
'LIBPATH': build_result['LIBPATH'],
|
||||
'CPPPATH': build_result['CPPPATH'],
|
||||
'LIBS': ['backtrace']
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, git_ref = 'main') -> 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']
|
||||
build_result = env.CMakeProject(checkout_root)
|
||||
return {
|
||||
'CPPPATH': build_result['CPPPATH'],
|
||||
'LIBS': [env.FindLib('jpeg', paths=build_result['LIBPATH'])],
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
from SCons.Script import *
|
||||
|
||||
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']
|
||||
build_result = env.AutotoolsProject(checkout_root)
|
||||
return {
|
||||
'CPPPATH': build_result['CPPPATH'],
|
||||
'LIBS': [env.FindLib('png16', paths=build_result['LIBPATH'])],
|
||||
'DEPENDENCIES': [lib_z]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
import os
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, git_ref: str = "master") -> 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']
|
||||
return {
|
||||
'CPPPATH': [os.path.join(checkout_root, 'include')]
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
from SCons.Script import *
|
||||
|
||||
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)
|
||||
checkout_root = repo['checkout_root']
|
||||
build_result = env.AutotoolsProject(os.path.join(checkout_root, 'mecab'))
|
||||
return {
|
||||
'LIBPATH': build_result['LIBPATH'],
|
||||
'CPPPATH': build_result['CPPPATH'],
|
||||
'LIBS': ['mecab']
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
import os
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, git_ref: str = "master") -> dict:
|
||||
repo = env.GitBranch(repo_name = 'mijin', remote_url = 'https://git.mewin.de/mewin/mijin2.git', git_ref = git_ref)
|
||||
checkout_root = repo['checkout_root']
|
||||
return SConscript(os.path.join(checkout_root, 'LibConf'), exports = ['env'])
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
import os
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, git_ref: str = 'master') -> dict:
|
||||
repo = env.GitBranch(repo_name = 'mikktspace', remote_url = 'https://github.com/mmikk/MikkTSpace.git', git_ref = git_ref)
|
||||
lib_mikktspace = env.StaticLibrary(
|
||||
CPPPATH = [repo['checkout_root']],
|
||||
target = env['LIB_DIR'] + '/mikktspace',
|
||||
source = [os.path.join(repo['checkout_root'], 'mikktspace.c')]
|
||||
)
|
||||
return lib_mikktspace
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
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)
|
||||
checkout_root = repo['checkout_root']
|
||||
build_result = env.CMakeProject(project_root=checkout_root)
|
||||
|
||||
lib_name = {
|
||||
'debug': 'spdlogd'
|
||||
}.get(env['BUILD_TYPE'], 'spdlog')
|
||||
|
||||
cppdefines = ['SPDLOG_COMPILE_LIB=1']
|
||||
if use_external_libfmt:
|
||||
cppdefines.append('SPDLOG_FMT_EXTERNAL=1')
|
||||
|
||||
return {
|
||||
'LIBPATH': build_result['LIBPATH'],
|
||||
'CPPPATH': build_result['CPPPATH'],
|
||||
'CPPDEFINES': cppdefines,
|
||||
'LIBS': [lib_name]
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, git_ref: str = "master") -> dict:
|
||||
repo = env.GitBranch(repo_name = 'stb', remote_url = 'https://github.com/nothings/stb.git', git_ref = git_ref)
|
||||
checkout_root = repo['checkout_root']
|
||||
return {
|
||||
'CPPPATH': [checkout_root]
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
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)
|
||||
checkout_root = repo['checkout_root']
|
||||
build_result = env.CMakeProject(project_root=checkout_root)
|
||||
lib_name = {
|
||||
'debug': 'yaml-cppd'
|
||||
}.get(env['BUILD_TYPE'], 'yaml-cpp')
|
||||
return {
|
||||
'LIBPATH': build_result['LIBPATH'],
|
||||
'CPPPATH': build_result['CPPPATH'],
|
||||
'LIBS': [lib_name]
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
import os
|
||||
from SCons.Script import *
|
||||
|
||||
def cook(env: Environment, git_ref: str = 'master') -> dict:
|
||||
repo = env.GitBranch(repo_name = 'zlib', remote_url = 'https://github.com/madler/zlib.git', git_ref = git_ref)
|
||||
extracted_root = repo['checkout_root']
|
||||
build_result = env.CMakeProject(project_root=extracted_root)
|
||||
return {
|
||||
'CPPPATH': [os.path.join(build_result['install_dir'], 'install')],
|
||||
'LIBS': [env.FindLib('z', paths=build_result['LIBPATH'])]
|
||||
}
|
||||
@@ -1,2 +1,4 @@
|
||||
GitPython
|
||||
psutil
|
||||
Jinja2
|
||||
requests
|
||||
|
||||
8
util/clion_project_template/.gitignore
vendored
Normal file
8
util/clion_project_template/.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
35
util/clion_project_template/customTargets.xml.jinja
Normal file
35
util/clion_project_template/customTargets.xml.jinja
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CLionExternalBuildManager">
|
||||
{% for executable in project.executables %}
|
||||
{% for build_type in project.build_types %}
|
||||
{% set build_type_name = build_type | capitalize -%}
|
||||
<target id="{{ generate_uuid('target_' + executable.name + '_' + build_type) }}" name="{{ executable.name }} {{ build_type_name }}" defaultType="TOOL">
|
||||
<configuration id="{{ generate_uuid('configuration_' + executable.name + '_' + build_type) }}" name="{{ executable.name }} {{ build_type_name }}">
|
||||
<build type="TOOL">
|
||||
<tool actionId="Tool_External Tools_{{ executable.name }} {{ build_type_name }}" />
|
||||
</build>
|
||||
<clean type="TOOL">
|
||||
<tool actionId="Tool_External Tools_{{ executable.name }} {{ build_type_name }} Clean" />
|
||||
</clean>
|
||||
</configuration>
|
||||
</target>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% for library in project.libraries %}
|
||||
{% for build_type in project.build_types %}
|
||||
{% set build_type_name = build_type | capitalize -%}
|
||||
<target id="{{ generate_uuid('target_' + library.name + '_' + build_type) }}" name="{{ library.name }} {{ build_type_name }}" defaultType="TOOL">
|
||||
<configuration id="{{ generate_uuid('configuration_' + library.name + '_' + build_type) }}" name="{{ library.name }} {{ build_type_name }}">
|
||||
<build type="TOOL">
|
||||
<tool actionId="Tool_External Tools_{{ library.name }} {{ build_type_name }}" />
|
||||
</build>
|
||||
<clean type="TOOL">
|
||||
<tool actionId="Tool_External Tools_{{ library.name }} {{ build_type_name }} Clean" />
|
||||
</clean>
|
||||
</configuration>
|
||||
</target>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</component>
|
||||
</project>
|
||||
17
util/clion_project_template/misc.xml
Normal file
17
util/clion_project_template/misc.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompDBSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<CompDBProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</CompDBProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
<component name="CompDBWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
</project>
|
||||
40
util/clion_project_template/tools/External Tools.xml.jinja
Normal file
40
util/clion_project_template/tools/External Tools.xml.jinja
Normal file
@@ -0,0 +1,40 @@
|
||||
<toolSet name="External Tools">
|
||||
{% for executable in project.executables %}
|
||||
{% for build_type in project.build_types %}
|
||||
{% set build_type_name = build_type | capitalize -%}
|
||||
<tool name="{{ executable.name }} {{ build_type_name }}" showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
|
||||
<exec>
|
||||
<option name="COMMAND" value="{{ scons_exe }}" />
|
||||
<option name="PARAMETERS" value="-j{{ nproc }} --build_type={{ build_type }} --unity=disable {{ executable.filename(build_type) }} compile_commands.json" />
|
||||
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
|
||||
</exec>
|
||||
</tool>
|
||||
<tool name="{{ executable.name }} {{ build_type_name }} Clean" showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
|
||||
<exec>
|
||||
<option name="COMMAND" value="{{ scons_exe }}" />
|
||||
<option name="PARAMETERS" value="--build_type={{ build_type }} --unity=disable {{ executable.filename(build_type) }} -c" />
|
||||
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
|
||||
</exec>
|
||||
</tool>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% for library in project.libraries %}
|
||||
{% for build_type in project.build_types %}
|
||||
{% set build_type_name = build_type | capitalize -%}
|
||||
<tool name="{{ library.name }} {{ build_type_name }}" showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
|
||||
<exec>
|
||||
<option name="COMMAND" value="{{ scons_exe }}" />
|
||||
<option name="PARAMETERS" value="-j{{ nproc }} --build_type={{ build_type }} --unity=disable {{ library.filename(build_type) }} compile_commands.json" />
|
||||
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
|
||||
</exec>
|
||||
</tool>
|
||||
<tool name="{{ library.name }} {{ build_type_name }} Clean" showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
|
||||
<exec>
|
||||
<option name="COMMAND" value="{{ scons_exe }}" />
|
||||
<option name="PARAMETERS" value="--build_type={{ build_type }} --unity=disable {{ library.filename(build_type) }} -c" />
|
||||
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
|
||||
</exec>
|
||||
</tool>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</toolSet>
|
||||
7
util/clion_project_template/vcs.xml
Normal file
7
util/clion_project_template/vcs.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/external/scons-plus-plus" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
109
util/clion_project_template/workspace.xml.jinja
Normal file
109
util/clion_project_template/workspace.xml.jinja
Normal file
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="CMakeRunConfigurationManager">
|
||||
<generated />
|
||||
</component>
|
||||
<component name="CMakeSettings">
|
||||
<configurations>
|
||||
<configuration PROFILE_NAME="Debug" ENABLED="true" CONFIG_NAME="Debug" />
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ClangdSettings">
|
||||
<option name="formatViaClangd" value="false" />
|
||||
</component>
|
||||
<component name="CompDBLocalSettings">
|
||||
<option name="availableProjects">
|
||||
<map>
|
||||
<entry>
|
||||
<key>
|
||||
<ExternalProjectPojo>
|
||||
<option name="name" value="{{ project.name }}" />
|
||||
<option name="path" value="$PROJECT_DIR$" />
|
||||
</ExternalProjectPojo>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<ExternalProjectPojo>
|
||||
<option name="name" value="{{ project.name }}" />
|
||||
<option name="path" value="$PROJECT_DIR$" />
|
||||
</ExternalProjectPojo>
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
<option name="projectSyncType">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$" value="RE_IMPORT" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ExternalProjectsData">
|
||||
<projectState path="$PROJECT_DIR$">
|
||||
<ProjectState />
|
||||
</projectState>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 5
|
||||
}</component>
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
{% for executable in project.executables -%}
|
||||
{% for build_type in project.build_types -%}
|
||||
{% set build_type_name = build_type | capitalize -%}
|
||||
"Custom Build Application.{{ executable.name }} {{ build_type_name }}.executor": "Debug",
|
||||
{% endfor -%}
|
||||
{% endfor -%}
|
||||
"RunOnceActivity.RadMigrateCodeStyle": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.cidr.known.project.marker": "true",
|
||||
"RunOnceActivity.readMode.enableVisualFormatting": "true",
|
||||
"cf.first.check.clang-format": "false",
|
||||
"cidr.known.project.marker": "true",
|
||||
"git-widget-placeholder": "master",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "CLionExternalConfigurable",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RunManager" selected="Custom Build Application.{{ project.executables[0].name }} {{ project.build_types[0] }}">
|
||||
{% for executable in project.executables -%}
|
||||
{% for build_type in project.build_types -%}
|
||||
{% set build_type_name = build_type | capitalize -%}
|
||||
<configuration name="{{ executable.name }} {{ build_type_name }}" type="CLionExternalRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" WORKING_DIR="file://$ProjectFileDir$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="{{ project.name }}" TARGET_NAME="{{ executable.name }} {{ build_type_name }}" CONFIG_NAME="{{ executable.name }} {{ build_type_name }}" RUN_PATH="$PROJECT_DIR$/{{ executable.filename(build_type) }}">
|
||||
<method v="2">
|
||||
<option name="CLION.EXTERNAL.BUILD" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
{% endfor -%}
|
||||
{% endfor -%}
|
||||
{% for library in project.libraries -%}
|
||||
{% for build_type in project.build_types -%}
|
||||
{% set build_type_name = build_type | capitalize -%}
|
||||
<configuration name="{{ library.name }} {{ build_type_name }}" type="CLionExternalRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="{{ project.name }}" TARGET_NAME="{{ library.name }} {{ build_type_name }}" CONFIG_NAME="{{ library.name }} {{ build_type_name }}">
|
||||
<method v="2">
|
||||
<option name="CLION.EXTERNAL.BUILD" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
{% endfor -%}
|
||||
{% endfor -%}
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
</project>
|
||||
6
util/vscode_project_template/extensions.json
Normal file
6
util/vscode_project_template/extensions.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"ms-vscode.cpptools",
|
||||
"llvm-vs-code-extensions.vscode-clangd"
|
||||
]
|
||||
}
|
||||
20
util/vscode_project_template/launch.json.jinja
Normal file
20
util/vscode_project_template/launch.json.jinja
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"configurations": [
|
||||
{% for executable in project.executables %}
|
||||
{% for build_type in project.build_types %}
|
||||
{% set build_type_name = build_type | capitalize -%}
|
||||
{
|
||||
"name": "{{ executable.name }} ({{ build_type | capitalize }})",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "{{ executable.filename(build_type) | escape_path }}",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"console": "integratedTerminal"
|
||||
}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
]
|
||||
}
|
||||
69
util/vscode_project_template/tasks.json.jinja
Normal file
69
util/vscode_project_template/tasks.json.jinja
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{% for executable in project.executables %}
|
||||
{% for build_type in project.build_types %}
|
||||
{% set build_type_name = build_type | capitalize -%}
|
||||
{
|
||||
"label": "{{ executable.name }} {{ build_type_name }}",
|
||||
"type": "shell",
|
||||
"command": "{{ scons_exe | escape_path }} -j{{ nproc }} --build_type={{ build_type }} --unity=disable {{ executable.filename(build_type) | escape_path }} compile_commands.json",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "{{ executable.name }} {{ build_type_name }} Clean",
|
||||
"type": "shell",
|
||||
"command": "{{ scons_exe | escape_path }} --build_type={{ build_type }} --unity=disable {{ executable.filename(build_type) | escape_path }} -c",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
}
|
||||
},
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% for library in project.libraries %}
|
||||
{% for build_type in project.build_types %}
|
||||
{% set build_type_name = build_type | capitalize -%}
|
||||
{
|
||||
"label": "{{ library.name }} {{ build_type_name }}",
|
||||
"type": "shell",
|
||||
"command": "{{ scons_exe | escape_path }} -j{{ nproc }} --build_type={{ build_type }} --unity=disable {{ library.filename(build_type) | escape_path }} compile_commands.json",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "{{ library.name }} {{ build_type_name }} Clean",
|
||||
"type": "shell",
|
||||
"command": "{{ scons_exe | escape_path }} --build_type={{ build_type }} --unity=disable {{ library.filename(build_type) | escape_path }} -c",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
}
|
||||
},
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user