35 lines
		
	
	
		
			912 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			912 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
 | |
| import re
 | |
| from SCons.Script import *
 | |
| 
 | |
| 
 | |
| def _git_cook(env: Environment, repo: dict) -> dict:
 | |
|     lib_fmt = env.Cook('fmt')
 | |
|     checkout_root = repo['checkout_root']
 | |
|     build_result = env.CMakeProject(project_root=checkout_root, dependencies=[lib_fmt])
 | |
|     
 | |
|     lib_name = {
 | |
|         'debug': 'spdlogd'
 | |
|     }.get(env['BUILD_TYPE'], 'spdlog')
 | |
| 
 | |
|     cppdefines = ['SPDLOG_COMPILE_LIB=1', 'SPDLOG_FMT_EXTERNAL=1']
 | |
| 
 | |
|     return {
 | |
|         'CPPPATH': build_result['CPPPATH'],
 | |
|         'CPPDEFINES': cppdefines,
 | |
|         'LIBS': [env.FindLib(lib_name, paths=build_result['LIBPATH'])]
 | |
|     }
 | |
| 
 | |
| 
 | |
| env.GitRecipe(
 | |
|     globals = globals(),
 | |
|     repo_name = 'spdlog',
 | |
|     repo_url = 'https://github.com/gabime/spdlog.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,
 | |
|     dependencies = {
 | |
|         'fmt': {}
 | |
|     }
 | |
| )
 |