diff --git a/recipes/CMakeProject/recipe.py b/recipes/CMakeProject/recipe.py index 80d5823..d182c82 100644 --- a/recipes/CMakeProject/recipe.py +++ b/recipes/CMakeProject/recipe.py @@ -21,7 +21,9 @@ def cook(env: Environment, project_root: str, generate_args: 'list[str]' = [], b 'release': 'Release', 'profile': 'RelWithDebInfo' }.get(env['BUILD_TYPE'], 'RelWithDebInfo') - subprocess.run(('cmake', '-G', 'Ninja', '-B', build_dir, f'-DCMAKE_BUILD_TYPE={build_type}', f'-DCMAKE_INSTALL_PREFIX={install_dir}', *generate_args, project_root), stdout=sys.stdout, stderr=sys.stderr, check=True) + environ = os.environ.copy() + environ['CXXFLAGS'] = ' '.join(f'-D{define}' for define in env['CPPDEFINES']) # TODO: who cares about windows? + subprocess.run(('cmake', '-G', 'Ninja', '-B', build_dir, f'-DCMAKE_BUILD_TYPE={build_type}', f'-DCMAKE_INSTALL_PREFIX={install_dir}', '-DBUILD_TESTING=OFF', *generate_args, project_root), env=environ, stdout=sys.stdout, stderr=sys.stderr, check=True) subprocess.run(('cmake', '--build', *build_args, build_dir), stdout=sys.stdout, stderr=sys.stderr, check=True) subprocess.run(('cmake', '--install', *install_args, build_dir), stdout=sys.stdout, stderr=sys.stderr, check=True) pathlib.Path(install_dir, _BUILT_STAMPFILE).touch() diff --git a/recipes/SDL/recipe.py b/recipes/SDL/recipe.py index 3d84b87..1e2b269 100644 --- a/recipes/SDL/recipe.py +++ b/recipes/SDL/recipe.py @@ -1,7 +1,4 @@ -import os -import subprocess -import sys from SCons.Script import * def cook(env: Environment, git_ref: str = "main") -> dict: diff --git a/recipes/yaml-cpp/recipe.py b/recipes/yaml-cpp/recipe.py new file mode 100644 index 0000000..64c6937 --- /dev/null +++ b/recipes/yaml-cpp/recipe.py @@ -0,0 +1,15 @@ +from SCons.Script import * + +def cook(env: Environment, git_ref: str = "master") -> dict: + repo = env.Cook('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.Cook('CMakeProject', project_root=checkout_root) + lib_name = { + 'debug': 'yaml-cppd' + }.get(env['BUILD_TYPE'], 'yaml-cppd') + return { + 'LIBPATH': build_result['LIBPATH'], + 'CPPPATH': build_result['CPPPATH'], + 'LIBS': [lib_name] + } +