Skip to content

Commit 547e82e

Browse files
L1ghtmann0cyn
authored andcommitted
Switch ld to cxx only for ++ files
1 parent c431d6c commit 547e82e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/dragongen/generation.py

+6
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ def rules_and_build_statements(self) -> (list, list):
280280
filedict = classify({key: self.project_variables[key] for key in FILE_RULES})
281281
linker_conds = set()
282282

283+
# switch to cxx for pp files (auto-links ++ stdlib)
284+
if any("cxx" in ftype for ftype in filedict):
285+
self.project_variables["ld"] = self.project_variables["cxx"]
286+
283287
# Deal with logos preprocessing
284288
if 'logos_files' in filedict:
285289
for f in standardize_file_list(subdir, filedict['logos_files']):
@@ -295,6 +299,8 @@ def rules_and_build_statements(self) -> (list, list):
295299
build_state.append(Build(f'$builddir/logos/{name}.mm', 'logos', f))
296300
filedict.setdefault('objcxx_files', [])
297301
filedict['objcxx_files'].append(f'$builddir/logos/{name}.mm')
302+
# switch to cxx for pp files (auto-links ++ stdlib)
303+
self.project_variables["ld"] = self.project_variables["cxx"]
298304

299305
# Deal with compilation
300306
archs = self.project_variables['archs']

src/dragongen/toolchain.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def locate_macos_toolchain(cls, use_objcs: bool):
3131
return None
3232

3333
tc = cls()
34-
tc.ass = tc_dir + 'clang'
3534
tc.clang = tc_dir + 'clang'
3635
tc.clangpp = tc_dir + 'clang++'
37-
tc.ld = tc_dir + 'clang++'
36+
tc.ass = tc.clang
37+
tc.ld = tc.clang
3838
tc.codesign = 'ldid'
3939
tc.dsym = tc_dir + 'dsymutil'
4040
# FIXME: hardcoded while I wait on a real distribution of llvm-objcs
@@ -59,10 +59,10 @@ def locate_linux_toolchain(cls, use_objcs: bool):
5959
return None
6060

6161
tc = cls()
62-
tc.ass = tc_dir + 'clang'
6362
tc.clang = tc_dir + 'clang'
6463
tc.clangpp = tc_dir + 'clang++'
65-
tc.ld = tc_dir + 'clang++'
64+
tc.ass = tc.clang
65+
tc.ld = tc.clang
6666
tc.codesign = tc_dir + 'ldid'
6767
tc.dsym = tc_dir + 'dsymutil'
6868
tc.lipo = tc_dir + 'lipo'

0 commit comments

Comments
 (0)