[tools] Add LocalOption routines.
This commit is contained in:
parent
60591fefb6
commit
4730a45ab3
|
@ -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
|
# 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
|
# have their own components etc. If they point to the same folder, SCons
|
||||||
# would find the wrong source code to compile.
|
# would find the wrong source code to compile.
|
||||||
bsp_vdir = 'build/bsp'
|
bsp_vdir = 'build'
|
||||||
kernel_vdir = 'build/kernel'
|
kernel_vdir = 'build/kernel'
|
||||||
# board build script
|
# board build script
|
||||||
objs = SConscript('SConscript', variant_dir=bsp_vdir, duplicate=0)
|
objs = SConscript('SConscript', variant_dir=bsp_vdir, duplicate=0)
|
||||||
|
@ -361,6 +361,39 @@ def GetDepend(depend):
|
||||||
|
|
||||||
return building
|
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):
|
def AddDepend(option):
|
||||||
BuildOptions[option] = 1
|
BuildOptions[option] = 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue