4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-02-06 22:04:34 +08:00

[tools] Fix the lib issue in Keil project generation

This commit is contained in:
Bernard Xiong 2019-07-27 17:42:34 +08:00
parent 384f390971
commit fa1eaa1c5e

View File

@ -56,7 +56,6 @@ def _get_filetype(fn):
def MDK4AddGroupForFN(ProjectFiles, parent, name, filename, project_path): def MDK4AddGroupForFN(ProjectFiles, parent, name, filename, project_path):
group = SubElement(parent, 'Group') group = SubElement(parent, 'Group')
group.text = name
group_name = SubElement(group, 'GroupName') group_name = SubElement(group, 'GroupName')
group_name.text = name group_name.text = name
@ -92,6 +91,8 @@ def MDK4AddGroupForFN(ProjectFiles, parent, name, filename, project_path):
file_path.text = path.decode(fs_encoding) file_path.text = path.decode(fs_encoding)
return group
def MDK4AddLibToGroup(ProjectFiles, group, name, filename, project_path): def MDK4AddLibToGroup(ProjectFiles, group, name, filename, project_path):
name = os.path.basename(filename) name = os.path.basename(filename)
path = os.path.dirname (filename) path = os.path.dirname (filename)
@ -125,6 +126,8 @@ def MDK4AddLibToGroup(ProjectFiles, group, name, filename, project_path):
file_path.text = path.decode(fs_encoding) file_path.text = path.decode(fs_encoding)
return group
def MDK4AddGroup(ProjectFiles, parent, name, files, project_path): def MDK4AddGroup(ProjectFiles, parent, name, files, project_path):
# don't add an empty group # don't add an empty group
if len(files) == 0: if len(files) == 0:
@ -243,16 +246,13 @@ def MDK45Project(tree, target, script):
full_path = os.path.join(path_item, item + '.lib') full_path = os.path.join(path_item, item + '.lib')
if os.path.isfile(full_path): # has this library if os.path.isfile(full_path): # has this library
lib_path = full_path lib_path = full_path
break
if lib_path != '': if lib_path != '':
need_create = 1 if group_tree != None:
for neighbor in groups.iter('Group'): MDK4AddLibToGroup(ProjectFiles, group_tree, group['name'], lib_path, project_path)
if neighbor.text == group['name']: else:
MDK4AddLibToGroup(ProjectFiles, neighbor, group['name'], lib_path, project_path) group_tree = MDK4AddGroupForFN(ProjectFiles, groups, group['name'], lib_path, project_path)
need_create = 0
break
if (need_create != 0):
MDK4AddGroupForFN(ProjectFiles, groups, group['name'], lib_path, project_path)
# write include path, definitions and link flags # write include path, definitions and link flags
IncludePath = tree.find('Targets/Target/TargetOption/TargetArmAds/Cads/VariousControls/IncludePath') IncludePath = tree.find('Targets/Target/TargetOption/TargetArmAds/Cads/VariousControls/IncludePath')