fixed IAR project add LIBS
This commit is contained in:
parent
b571cd8899
commit
495927696e
25
tools/iar.py
25
tools/iar.py
|
@ -54,13 +54,13 @@ def IARAddGroup(parent, name, files, project_path):
|
||||||
fn = f.rfile()
|
fn = f.rfile()
|
||||||
name = fn.name
|
name = fn.name
|
||||||
path = os.path.dirname(fn.abspath)
|
path = os.path.dirname(fn.abspath)
|
||||||
|
|
||||||
basename = os.path.basename(path)
|
basename = os.path.basename(path)
|
||||||
path = _make_path_relative(project_path, path)
|
path = _make_path_relative(project_path, path)
|
||||||
path = os.path.join(path, name)
|
path = os.path.join(path, name)
|
||||||
|
|
||||||
file = SubElement(group, 'file')
|
file = SubElement(group, 'file')
|
||||||
file_name = SubElement(file, 'name')
|
file_name = SubElement(file, 'name')
|
||||||
|
|
||||||
if os.path.isabs(path):
|
if os.path.isabs(path):
|
||||||
file_name.text = path.decode(fs_encoding)
|
file_name.text = path.decode(fs_encoding)
|
||||||
else:
|
else:
|
||||||
|
@ -87,6 +87,18 @@ def IARProject(target, script):
|
||||||
LINKFLAGS = ''
|
LINKFLAGS = ''
|
||||||
CCFLAGS = ''
|
CCFLAGS = ''
|
||||||
Libs = []
|
Libs = []
|
||||||
|
lib_prefix = ['lib', '']
|
||||||
|
lib_suffix = ['.a', '.o', '']
|
||||||
|
|
||||||
|
def searchLib(group):
|
||||||
|
for path_item in group['LIBPATH']:
|
||||||
|
for prefix_item in lib_prefix:
|
||||||
|
for suffix_item in lib_suffix:
|
||||||
|
lib_full_path = os.path.join(path_item, prefix_item + item + suffix_item)
|
||||||
|
if os.path.isfile(lib_full_path):
|
||||||
|
return lib_full_path
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
|
|
||||||
# add group
|
# add group
|
||||||
for group in script:
|
for group in script:
|
||||||
|
@ -106,16 +118,13 @@ def IARProject(target, script):
|
||||||
|
|
||||||
if group.has_key('LIBS') and group['LIBS']:
|
if group.has_key('LIBS') and group['LIBS']:
|
||||||
for item in group['LIBS']:
|
for item in group['LIBS']:
|
||||||
lib_path = ''
|
lib_path = searchLib(group)
|
||||||
|
|
||||||
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 != '':
|
if lib_path != '':
|
||||||
lib_path = _make_path_relative(project_path, lib_path)
|
lib_path = _make_path_relative(project_path, lib_path)
|
||||||
Libs += [lib_path]
|
Libs += [lib_path]
|
||||||
|
# print('found lib isfile: ' + lib_path)
|
||||||
|
else:
|
||||||
|
print('not found LIB: ' + item)
|
||||||
|
|
||||||
# make relative path
|
# make relative path
|
||||||
paths = set()
|
paths = set()
|
||||||
|
|
Loading…
Reference in New Issue