import os import re from SCons.Script import * def _git_cook(env: Environment, repo: dict) -> dict: checkout_root = repo['checkout_root'] build_result = env.CMakeProject(project_root=checkout_root, generate_args=['-DJSON_BuildTests=OFF']) return { 'CPPPATH': build_result['CPPPATH'], 'CMAKE_PREFIX_PATH': [build_result['install_dir']] } env.GitRecipe( globals = globals(), repo_name = 'json', repo_url = 'https://github.com/nlohmann/json.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 )