From 1086f6cfa03330a7afc87830e8e9a36a4db554a4 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Wed, 14 Oct 2015 11:07:42 +0800 Subject: [PATCH] [Tools] Fix the buildlib with LOCAL_* options group --- tools/building.py | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/tools/building.py b/tools/building.py index 38b7881797..07f5e91fc9 100644 --- a/tools/building.py +++ b/tools/building.py @@ -497,37 +497,35 @@ def DoBuilding(target, objects): lst.append(item) return lst - objects = one_list(objects) - - # remove source files with local flags setting - for group in Projects: - if group.has_key('LOCAL_CCFLAGS') or group.has_key('LOCAL_CPPPATH') or group.has_key('LOCAL_CPPDEFINES'): - for source in group['src']: - for obj in objects: - if source.abspath == obj.abspath or (len(obj.sources) > 0 and source.abspath == obj.sources[0].abspath): - objects.remove(obj) - - # re-add the source files to the objects - for group in Projects: + # handle local group + def local_group(group, objects): if group.has_key('LOCAL_CCFLAGS') or group.has_key('LOCAL_CPPPATH') or group.has_key('LOCAL_CPPDEFINES'): CCFLAGS = Env.get('CCFLAGS', '') + group.get('LOCAL_CCFLAGS', '') CPPPATH = Env.get('CPPPATH', ['']) + group.get('LOCAL_CPPPATH', ['']) CPPDEFINES = Env.get('CPPDEFINES', ['']) + group.get('LOCAL_CPPDEFINES', ['']) for source in group['src']: - objects += Env.Object(source, CCFLAGS = CCFLAGS, - CPPPATH = CPPPATH, - CPPDEFINES = CPPDEFINES) + objects.append(Env.Object(source, CCFLAGS = CCFLAGS, + CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)) + + return True + + return False + + objects = one_list(objects) program = None # check whether special buildlib option lib_name = GetOption('buildlib') if lib_name: + objects = [] # remove all of objects # build library with special component for Group in Projects: if Group['name'] == lib_name: lib_name = GroupLibName(Group['name'], Env) - objects = Env.Object(Group['src']) + if not local_group(Group, objects): + objects = Env.Object(Group['src']) + program = Env.Library(lib_name, objects) # add library copy action @@ -535,6 +533,18 @@ def DoBuilding(target, objects): break else: + # remove source files with local flags setting + for group in Projects: + if group.has_key('LOCAL_CCFLAGS') or group.has_key('LOCAL_CPPPATH') or group.has_key('LOCAL_CPPDEFINES'): + for source in group['src']: + for obj in objects: + if source.abspath == obj.abspath or (len(obj.sources) > 0 and source.abspath == obj.sources[0].abspath): + objects.remove(obj) + + # re-add the source files to the objects + for group in Projects: + local_group(group, objects) + program = Env.Program(target, objects) EndBuilding(target, program)