diff options
| author | Bernard Xiong <[email protected]> | 2019-07-27 17:42:34 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2019-07-27 17:42:34 +0800 |
| commit | fa1eaa1c5e3a7f255dd096af92476639729681de (patch) | |
| tree | 0eaf79d2433e6c3d938b29d07c49b725b127b44a | |
| parent | 384f3909711e831ee6dfe9fce4de337e07b35319 (diff) | |
[tools] Fix the lib issue in Keil project generation
| -rw-r--r-- | tools/keil.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/keil.py b/tools/keil.py index b096917a42..7d4913dcf8 100644 --- a/tools/keil.py +++ b/tools/keil.py @@ -56,7 +56,6 @@ def _get_filetype(fn): def MDK4AddGroupForFN(ProjectFiles, parent, name, filename, project_path): group = SubElement(parent, 'Group') - group.text = name group_name = SubElement(group, 'GroupName') group_name.text = name @@ -92,6 +91,8 @@ def MDK4AddGroupForFN(ProjectFiles, parent, name, filename, project_path): file_path.text = path.decode(fs_encoding) + return group + def MDK4AddLibToGroup(ProjectFiles, group, name, filename, project_path): name = os.path.basename(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) + return group + def MDK4AddGroup(ProjectFiles, parent, name, files, project_path): # don't add an empty group if len(files) == 0: @@ -243,16 +246,13 @@ def MDK45Project(tree, target, script): full_path = os.path.join(path_item, item + '.lib') if os.path.isfile(full_path): # has this library lib_path = full_path + break if lib_path != '': - need_create = 1 - for neighbor in groups.iter('Group'): - if neighbor.text == group['name']: - MDK4AddLibToGroup(ProjectFiles, neighbor, group['name'], lib_path, project_path) - need_create = 0 - break - if (need_create != 0): - MDK4AddGroupForFN(ProjectFiles, groups, group['name'], lib_path, project_path) + if group_tree != None: + MDK4AddLibToGroup(ProjectFiles, group_tree, group['name'], lib_path, project_path) + else: + group_tree = MDK4AddGroupForFN(ProjectFiles, groups, group['name'], lib_path, project_path) # write include path, definitions and link flags IncludePath = tree.find('Targets/Target/TargetOption/TargetArmAds/Cads/VariousControls/IncludePath') |
