Skip to content

Commit 28e06fe

Browse files
committed
[bug fix]:scons创建mdk工程时,group组中有多个library的情况下,会重复创建同名group.修改Tools/keil.py中的函数MDK45Project,若group已经创建,则直接添加子节点。
1 parent 3ae69ad commit 28e06fe

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tools/keil.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def _get_filetype(fn):
5656

5757
def MDK4AddGroupForFN(ProjectFiles, parent, name, filename, project_path):
5858
group = SubElement(parent, 'Group')
59+
group.text = name
5960
group_name = SubElement(group, 'GroupName')
6061
group_name.text = name
6162

@@ -244,9 +245,13 @@ def MDK45Project(tree, target, script):
244245
lib_path = full_path
245246

246247
if lib_path != '':
247-
if (group_tree != None):
248-
MDK4AddLibToGroup(ProjectFiles, group_tree, group['name'], lib_path, project_path)
249-
else:
248+
need_create = 1
249+
for neighbor in groups.iter('Group'):
250+
if neighbor.text == group['name']:
251+
MDK4AddLibToGroup(ProjectFiles, neighbor, group['name'], lib_path, project_path)
252+
need_create = 0
253+
break
254+
if (need_create != 0):
250255
MDK4AddGroupForFN(ProjectFiles, groups, group['name'], lib_path, project_path)
251256

252257
# write include path, definitions and link flags

0 commit comments

Comments
 (0)