From 547e82ea4eb736c1309498710178907059936ef1 Mon Sep 17 00:00:00 2001 From: Lightmann Date: Fri, 12 Jan 2024 10:11:34 -0500 Subject: [PATCH] Switch ld to cxx only for ++ files --- src/dragongen/generation.py | 6 ++++++ src/dragongen/toolchain.py | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/dragongen/generation.py b/src/dragongen/generation.py index fea1ad514..1a6ed3122 100644 --- a/src/dragongen/generation.py +++ b/src/dragongen/generation.py @@ -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']): @@ -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'] diff --git a/src/dragongen/toolchain.py b/src/dragongen/toolchain.py index 7d0349585..a15f4eb1a 100644 --- a/src/dragongen/toolchain.py +++ b/src/dragongen/toolchain.py @@ -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 @@ -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'