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 authored and 0cyn committed Jan 13, 2024
1 parent c431d6c commit 547e82e
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 @@ -280,6 +280,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 @@ -295,6 +299,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 @@ -31,10 +31,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'
# FIXME: hardcoded while I wait on a real distribution of llvm-objcs
Expand All @@ -59,10 +59,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 = tc_dir + 'ldid'
tc.dsym = tc_dir + 'dsymutil'
tc.lipo = tc_dir + 'lipo'
Expand Down

0 comments on commit 547e82e

Please sign in to comment.