[Tools] scons add iar LIBS and LIBPATH support
This commit is contained in:
parent
21daf7359a
commit
9d01021f30
33
tools/iar.py
33
tools/iar.py
@ -86,6 +86,7 @@ def IARProject(target, script):
|
|||||||
CPPDEFINES = []
|
CPPDEFINES = []
|
||||||
LINKFLAGS = ''
|
LINKFLAGS = ''
|
||||||
CCFLAGS = ''
|
CCFLAGS = ''
|
||||||
|
Libs = []
|
||||||
|
|
||||||
# add group
|
# add group
|
||||||
for group in script:
|
for group in script:
|
||||||
@ -102,19 +103,32 @@ def IARProject(target, script):
|
|||||||
# get each group's link flags
|
# get each group's link flags
|
||||||
if group.has_key('LINKFLAGS') and group['LINKFLAGS']:
|
if group.has_key('LINKFLAGS') and group['LINKFLAGS']:
|
||||||
LINKFLAGS += group['LINKFLAGS']
|
LINKFLAGS += group['LINKFLAGS']
|
||||||
|
|
||||||
|
if group.has_key('LIBS') and group['LIBS']:
|
||||||
|
for item in group['LIBS']:
|
||||||
|
lib_path = ''
|
||||||
|
|
||||||
|
for path_item in group['LIBPATH']:
|
||||||
|
full_path = os.path.join(path_item, item + '.a')
|
||||||
|
if os.path.isfile(full_path): # has this library
|
||||||
|
lib_path = full_path
|
||||||
|
|
||||||
|
if lib_path != '':
|
||||||
|
lib_path = _make_path_relative(project_path, lib_path)
|
||||||
|
Libs += [lib_path]
|
||||||
|
|
||||||
# make relative path
|
# make relative path
|
||||||
paths = set()
|
paths = set()
|
||||||
for path in CPPPATH:
|
for path in CPPPATH:
|
||||||
inc = _make_path_relative(project_path, os.path.normpath(path))
|
inc = _make_path_relative(project_path, os.path.normpath(path))
|
||||||
paths.add(inc) #.replace('\\', '/')
|
paths.add(inc) #.replace('\\', '/')
|
||||||
|
|
||||||
# setting options
|
# setting options
|
||||||
options = tree.findall('configuration/settings/data/option')
|
options = tree.findall('configuration/settings/data/option')
|
||||||
for option in options:
|
for option in options:
|
||||||
# print option.text
|
# print option.text
|
||||||
name = option.find('name')
|
name = option.find('name')
|
||||||
|
|
||||||
if name.text == 'CCIncludePath2' or name.text == 'newCCIncludePaths':
|
if name.text == 'CCIncludePath2' or name.text == 'newCCIncludePaths':
|
||||||
for path in paths:
|
for path in paths:
|
||||||
state = SubElement(option, 'state')
|
state = SubElement(option, 'state')
|
||||||
@ -127,9 +141,18 @@ def IARProject(target, script):
|
|||||||
for define in CPPDEFINES:
|
for define in CPPDEFINES:
|
||||||
state = SubElement(option, 'state')
|
state = SubElement(option, 'state')
|
||||||
state.text = define
|
state.text = define
|
||||||
|
|
||||||
|
if name.text == 'IlinkAdditionalLibs':
|
||||||
|
for path in Libs:
|
||||||
|
state = SubElement(option, 'state')
|
||||||
|
if os.path.isabs(path) or path.startswith('$'):
|
||||||
|
path = path.decode(fs_encoding)
|
||||||
|
else:
|
||||||
|
path = ('$PROJ_DIR$\\' + path).decode(fs_encoding)
|
||||||
|
state.text = path
|
||||||
|
|
||||||
xml_indent(root)
|
xml_indent(root)
|
||||||
out.write(etree.tostring(root, encoding='utf-8'))
|
out.write(etree.tostring(root, encoding='utf-8'))
|
||||||
out.close()
|
out.close()
|
||||||
|
|
||||||
IARWorkspace(target)
|
IARWorkspace(target)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user