diff --git a/SConscript b/SConscript index e7b3bb3..47e24fb 100644 --- a/SConscript +++ b/SConscript @@ -86,6 +86,15 @@ def _wrap_default(default): default(arg) return _wrapped +def _wrap_depends(depends): + def _wrapped(env, dependant, dependency): + if isinstance(dependant, dict) and '_target' in dependant: + dependant = dependant['_target'] + if isinstance(dependency, dict) and '_target' in dependency: + dependency = dependency['_target'] + depends(dependant, dependency) + return _wrapped + def _get_fallback_cache_dir() -> str: return Dir('#cache').abspath @@ -205,7 +214,11 @@ vars.Add('CCFLAGS', 'C/C++ Compiler Flags') vars.Add('LINKFLAGS', 'Linker Flags') vars.Add('PYTHON', 'Python Executable', 'python') -env = Environment(tools = ['default', 'compilation_db', 'unity_build'], variables = vars) +tools = ['default', 'compilation_db', 'unity_build'] +if 'TOOLS' in config: + tools.extend(config['TOOLS']) + +env = Environment(tools = tools, variables = vars) env['RECIPES_FOLDERS'] = [Dir('recipes')] env['SYSTEM_CACHE_DIR'] = os.path.join(_find_system_cache_dir(), 'spp_cache') env['CLONE_DIR'] = os.path.join(env['SYSTEM_CACHE_DIR'], 'cloned') @@ -331,6 +344,7 @@ env.AddMethod(_wrap_builder(env.StaticLibrary, is_lib = True), 'StaticLibrary') env.AddMethod(_wrap_builder(env.SharedLibrary, is_lib = True), 'SharedLibrary') env.AddMethod(_wrap_builder(env.Program), 'Program') env.AddMethod(_wrap_default(env.Default), 'Default') +env.AddMethod(_wrap_depends(env.Depends), 'Depends') env.AddMethod(_wrap_builder(env.UnityProgram), 'UnityProgram') env.AddMethod(_wrap_builder(env.UnityLibrary, is_lib = True), 'UnityLibrary')