Skip to content

[tools][cmake] fix processing groups with similar name #9667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion tools/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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):
Expand Down Expand Up @@ -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()))
Expand Down
Loading