diff options
| author | Kai <[email protected]> | 2024-11-22 19:06:43 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-11-22 19:06:43 +0800 |
| commit | e4b02a28f897c1c87b04522f965d03e9bb4774fc (patch) | |
| tree | a55725e342964b130c85d1c8ce48792b47225fed /tools/cmake.py | |
| parent | 42a41c696d2a42b409d3c74c3161bc9c61b68d9b (diff) | |
[tools][cmake] fix processing groups with similar name (#9667)
Diffstat (limited to 'tools/cmake.py')
| -rw-r--r-- | tools/cmake.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/cmake.py b/tools/cmake.py index c0bb87160f..fb894d1ed3 100644 --- a/tools/cmake.py +++ b/tools/cmake.py @@ -9,7 +9,7 @@ import re import utils import rtconfig from utils import _make_path_relative -from collections import defaultdict +from collections import defaultdict, Counter def GenerateCFiles(env, project, project_name): @@ -184,6 +184,20 @@ def GenerateCFiles(env, project, project_name): else: libgroups.append(group) + # Process groups whose names differ only in capitalization. + # (Groups have same name should be merged into one before) + for group in libgroups: + group['alias'] = group['name'].lower() + names = [group['alias'] for group in libgroups] + counter = Counter(names) + names = [name for name in names if counter[name] > 1] + for group in libgroups: + if group['alias'] in names: + counter[group['alias']] -= 1 + group['alias'] = f"{group['name']}_{counter[group['alias']]}" + print(f"Renamed {group['name']} to {group['alias']}") + group['name'] = group['alias'] + cm_file.write("# Library source files\n") for group in project: cm_file.write("SET(RT_{:s}_SOURCES\n".format(group['name'].upper())) |
