diff options
| author | Bernard Xiong <[email protected]> | 2016-10-28 22:12:24 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2016-10-28 22:12:24 +0800 |
| commit | 4730a45ab32991ad03c43304fd488bcf96769af1 (patch) | |
| tree | a6a81881176034a8238dc2f050ef72e39bb3205d | |
| parent | 60591fefb6a2bb12b9d944e98ce0febef7e7aa8e (diff) | |
[tools] Add LocalOption routines.
| -rw-r--r-- | tools/building.py | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/tools/building.py b/tools/building.py index c6555b1e63..1eca1eaf39 100644 --- a/tools/building.py +++ b/tools/building.py @@ -279,7 +279,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ # we need to seperate the variant_dir for BSPs and the kernels. BSPs could # have their own components etc. If they point to the same folder, SCons # would find the wrong source code to compile. - bsp_vdir = 'build/bsp' + bsp_vdir = 'build' kernel_vdir = 'build/kernel' # board build script objs = SConscript('SConscript', variant_dir=bsp_vdir, duplicate=0) @@ -361,6 +361,39 @@ def GetDepend(depend): return building +def LocalOptions(config_filename): + from SCons.Script import SCons + + # parse wiced_config.h to get used component + PreProcessor = SCons.cpp.PreProcessor() + + f = file(config_filename, 'r') + contents = f.read() + f.close() + + PreProcessor.process_contents(contents) + local_options = PreProcessor.cpp_namespace + + return local_options + +def GetLocalDepend(options, depend): + building = True + if type(depend) == type('str'): + if not options.has_key(depend) or options[depend] == 0: + building = False + elif options[depend] != '': + return options[depend] + + return building + + # for list type depend + for item in depend: + if item != '': + if not options.has_key(item) or options[item] == 0: + building = False + + return building + def AddDepend(option): BuildOptions[option] = 1 |
