diff --git a/recipes/VulkanHeaders/recipe.py b/recipes/VulkanHeaders/recipe.py index 4cbf83f..5314e97 100644 --- a/recipes/VulkanHeaders/recipe.py +++ b/recipes/VulkanHeaders/recipe.py @@ -5,5 +5,6 @@ from SCons.Script import * def cook(env: Environment, git_ref: str = "main") -> dict: repo = env.Cook('GitBranch', repo_name = 'VulkanHeaders', remote_url = 'https://github.com/KhronosGroup/Vulkan-Headers.git', git_ref = git_ref) checkout_root = repo['checkout_root'] - env.Append(CPPPATH = [os.path.join(checkout_root, 'include')]) - return {} + return { + 'CPPPATH': [os.path.join(checkout_root, 'include')] + } diff --git a/recipes/fmt/recipe.py b/recipes/fmt/recipe.py new file mode 100644 index 0000000..30f0f7f --- /dev/null +++ b/recipes/fmt/recipe.py @@ -0,0 +1,40 @@ + +import os +import subprocess +import sys +from SCons.Script import * + +def cook(env: Environment, git_ref: str = "master") -> dict: + repo = env.Cook('GitBranch', repo_name = 'fmt', remote_url = 'https://github.com/fmtlib/fmt.git', git_ref = git_ref) + checkout_root = repo['checkout_root'] + + config = env['BUILD_TYPE'] + build_dir = os.path.join(checkout_root, f'build_{config}') + install_dir = os.path.join(checkout_root, f'install_{config}') + lib_fname = { + 'debug': 'libfmtd.a' + }.get(env['BUILD_TYPE'], 'libfmt.a') # TODO: who cares about windows? + is_built = os.path.exists(os.path.join(build_dir, lib_fname)) # TODO! + if not is_built: + print(f'Building LibFMT, config {config}') + os.makedirs(build_dir, exist_ok=True) + build_type = { + 'debug': 'Debug', + 'release_debug': 'RelWithDebInfo', + 'release': 'Release', + 'profile': 'RelWithDebInfo' + }.get(env['BUILD_TYPE'], 'RelWithDebInfo') + subprocess.run(('cmake', '-G', 'Ninja', '-B', build_dir, f'-DCMAKE_BUILD_TYPE={build_type}', '-DFMT_TEST=OFF', f'-DCMAKE_INSTALL_PREFIX={install_dir}', checkout_root), stdout=sys.stdout, stderr=sys.stderr, check=True) + subprocess.run(('cmake', '--build', build_dir), stdout=sys.stdout, stderr=sys.stderr, check=True) + subprocess.run(('cmake', '--install', build_dir), stdout=sys.stdout, stderr=sys.stderr, check=True) + + + lib_name = { + 'debug': 'fmtd' + }.get(env['BUILD_TYPE'], 'fmt') + return { + 'LIBPATH': [os.path.join(install_dir, 'lib')], + 'CPPPATH': [os.path.join(install_dir, 'include')], + 'LIBS': [lib_name, 'm'] + } + diff --git a/recipes/magic_enum/recipe.py b/recipes/magic_enum/recipe.py new file mode 100644 index 0000000..085bc2c --- /dev/null +++ b/recipes/magic_enum/recipe.py @@ -0,0 +1,10 @@ + +import os +from SCons.Script import * + +def cook(env: Environment, git_ref: str = "master") -> dict: + repo = env.Cook('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')] + }