31 lines
894 B
Python
31 lines
894 B
Python
|
|
import re
|
|
from SCons.Script import *
|
|
|
|
def _git_cook(env: Environment, repo) -> dict:
|
|
checkout_root = repo['checkout_root']
|
|
build_result = env.CMakeProject(project_root=checkout_root)
|
|
|
|
lib_name = {
|
|
'debug': 'Catch2d'
|
|
}.get(env['BUILD_TYPE'], 'Catch2')
|
|
libs = []
|
|
if not env.get('CATCH2_OWN_MAIN'):
|
|
libs.append({
|
|
'debug': 'Catch2Maind'
|
|
}.get(env['BUILD_TYPE'], 'Catch2Main'))
|
|
libs.append(lib_name)
|
|
return {
|
|
'CPPPATH': build_result['CPPPATH'],
|
|
'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
|
|
) |