[Tools] Add bsp_directory.

Add bsp_directory for PrepareModuleBuilding function and module building environment can parse rtconfig.h too.
This commit is contained in:
Bernard Xiong 2015-03-14 09:46:37 +08:00
parent 4888957d22
commit 1d23ce6cbd
1 changed files with 9 additions and 1 deletions

View File

@ -256,7 +256,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
return objs
def PrepareModuleBuilding(env, root_directory):
def PrepareModuleBuilding(env, root_directory, bsp_directory):
import rtconfig
global Env
@ -265,6 +265,14 @@ def PrepareModuleBuilding(env, root_directory):
Env = env
Rtt_Root = root_directory
# parse bsp rtconfig.h to get used component
PreProcessor = SCons.cpp.PreProcessor()
f = file(bsp_directory + '/rtconfig.h', 'r')
contents = f.read()
f.close()
PreProcessor.process_contents(contents)
BuildOptions = PreProcessor.cpp_namespace
# add build/clean library option for library checking
AddOption('--buildlib',
dest='buildlib',