[Tools] Fix the buildlib with LOCAL_* options group
This commit is contained in:
parent
1bebbecd22
commit
cfd101ace3
|
@ -267,6 +267,12 @@ def PrepareModuleBuilding(env, root_directory, bsp_directory):
|
||||||
global Env
|
global Env
|
||||||
global Rtt_Root
|
global Rtt_Root
|
||||||
|
|
||||||
|
# patch for win32 spawn
|
||||||
|
if env['PLATFORM'] == 'win32':
|
||||||
|
win32_spawn = Win32Spawn()
|
||||||
|
win32_spawn.env = env
|
||||||
|
env['SPAWN'] = win32_spawn.spawn
|
||||||
|
|
||||||
Env = env
|
Env = env
|
||||||
Rtt_Root = root_directory
|
Rtt_Root = root_directory
|
||||||
|
|
||||||
|
@ -491,37 +497,35 @@ def DoBuilding(target, objects):
|
||||||
lst.append(item)
|
lst.append(item)
|
||||||
return lst
|
return lst
|
||||||
|
|
||||||
objects = one_list(objects)
|
# handle local group
|
||||||
|
def local_group(group, 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:
|
|
||||||
if group.has_key('LOCAL_CCFLAGS') or group.has_key('LOCAL_CPPPATH') or group.has_key('LOCAL_CPPDEFINES'):
|
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', '')
|
CCFLAGS = Env.get('CCFLAGS', '') + group.get('LOCAL_CCFLAGS', '')
|
||||||
CPPPATH = Env.get('CPPPATH', ['']) + group.get('LOCAL_CPPPATH', [''])
|
CPPPATH = Env.get('CPPPATH', ['']) + group.get('LOCAL_CPPPATH', [''])
|
||||||
CPPDEFINES = Env.get('CPPDEFINES', ['']) + group.get('LOCAL_CPPDEFINES', [''])
|
CPPDEFINES = Env.get('CPPDEFINES', ['']) + group.get('LOCAL_CPPDEFINES', [''])
|
||||||
|
|
||||||
for source in group['src']:
|
for source in group['src']:
|
||||||
objects += Env.Object(source, CCFLAGS = CCFLAGS,
|
objects.append(Env.Object(source, CCFLAGS = CCFLAGS,
|
||||||
CPPPATH = CPPPATH,
|
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES))
|
||||||
CPPDEFINES = CPPDEFINES)
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
objects = one_list(objects)
|
||||||
|
|
||||||
program = None
|
program = None
|
||||||
# check whether special buildlib option
|
# check whether special buildlib option
|
||||||
lib_name = GetOption('buildlib')
|
lib_name = GetOption('buildlib')
|
||||||
if lib_name:
|
if lib_name:
|
||||||
|
objects = [] # remove all of objects
|
||||||
# build library with special component
|
# build library with special component
|
||||||
for Group in Projects:
|
for Group in Projects:
|
||||||
if Group['name'] == lib_name:
|
if Group['name'] == lib_name:
|
||||||
lib_name = GroupLibName(Group['name'], Env)
|
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)
|
program = Env.Library(lib_name, objects)
|
||||||
|
|
||||||
# add library copy action
|
# add library copy action
|
||||||
|
@ -529,6 +533,18 @@ def DoBuilding(target, objects):
|
||||||
|
|
||||||
break
|
break
|
||||||
else:
|
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)
|
program = Env.Program(target, objects)
|
||||||
|
|
||||||
EndBuilding(target, program)
|
EndBuilding(target, program)
|
||||||
|
@ -557,7 +573,6 @@ def EndBuilding(target, program = None):
|
||||||
else:
|
else:
|
||||||
print 'No template project file found.'
|
print 'No template project file found.'
|
||||||
|
|
||||||
|
|
||||||
if GetOption('target') == 'mdk4':
|
if GetOption('target') == 'mdk4':
|
||||||
from keil import MDK4Project
|
from keil import MDK4Project
|
||||||
MDK4Project('project.uvproj', Projects)
|
MDK4Project('project.uvproj', Projects)
|
||||||
|
|
Loading…
Reference in New Issue