Skip to content

Commit

Permalink
Switch ld to cxx only for ++ files
Browse files Browse the repository at this point in the history
  • Loading branch information
L1ghtmann committed Jan 12, 2024
1 parent e2a1930 commit cafa4b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/dragongen/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ def rules_and_build_statements(self) -> (list, list):
filedict = classify({key: self.project_variables[key] for key in FILE_RULES})
linker_conds = set()

# switch to cxx for pp files (auto-links ++ stdlib)
if any("cxx" in ftype for ftype in filedict):
self.project_variables["ld"] = self.project_variables["cxx"]

# Deal with logos preprocessing
if 'logos_files' in filedict:
for f in standardize_file_list(subdir, filedict['logos_files']):
Expand All @@ -294,6 +298,8 @@ def rules_and_build_statements(self) -> (list, list):
build_state.append(Build(f'$builddir/logos/{name}.mm', 'logos', f))
filedict.setdefault('objcxx_files', [])
filedict['objcxx_files'].append(f'$builddir/logos/{name}.mm')
# switch to cxx for pp files (auto-links ++ stdlib)
self.project_variables["ld"] = self.project_variables["cxx"]

# Deal with compilation
archs = self.project_variables['archs']
Expand Down
8 changes: 4 additions & 4 deletions src/dragongen/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def locate_macos_toolchain(cls, use_objcs: bool):
return None

tc = cls()
tc.ass = tc_dir + 'clang'
tc.clang = tc_dir + 'clang'
tc.clangpp = tc_dir + 'clang++'
tc.ld = tc_dir + 'clang++'
tc.ass = tc.clang
tc.ld = tc.clang
tc.codesign = 'ldid'
tc.dsym = tc_dir + 'dsymutil'
tc.plutil = 'plutil'
Expand All @@ -73,10 +73,10 @@ def locate_linux_toolchain(cls, use_objcs: bool):
return None

tc = cls()
tc.ass = tc_dir + 'clang'
tc.clang = tc_dir + 'clang'
tc.clangpp = tc_dir + 'clang++'
tc.ld = tc_dir + 'clang++'
tc.ass = tc.clang
tc.ld = tc.clang
tc.codesign = 'ldid'
tc.dsym = tc_dir + 'dsymutil'
tc.plutil = 'plutil'
Expand Down

0 comments on commit cafa4b3

Please sign in to comment.