diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index ba5bd90ac886..57a0263e171a 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -1219,3 +1219,22 @@ def get_introspection_data(self, target_id, target): }] return [] + + def get_export_symbol_file_args(self, linker, target, *, absolute_paths=False): + args = [] + dep_files = [] + for f in target.symbol_export_files: + if isinstance(f, File): + relpath = f.rel_to_builddir(self.build_to_src) + elif isinstance(f, build.CustomTarget): + relpath = self.get_target_filename(f) + else: + raise RuntimeError('Broken, please file a bug.') + if absolute_paths: + final_path = os.path.join(self.build_dir, relpath) + else: + final_path = relpath + args += linker.get_symbol_export_file_args(final_path) + dep_files.append(relpath) + return (args, dep_files) + diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index f3343e8b72de..64c0176985b2 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2464,20 +2464,6 @@ def guess_external_link_dependencies(self, linker, target, commands, internal): return guessed_dependencies + absolute_libs - def get_export_symbol_file_args(self, linker, target): - args = [] - dep_files = [] - for f in target.symbol_export_files: - if isinstance(f, File): - relpath = f.rel_to_builddir(self.build_to_src) - elif isinstance(f, build.CustomTarget): - relpath = self.get_target_filename(f) - else: - raise RuntimeError('Broken, please file a bug.') - args += linker.get_symbol_export_file_args(relpath) - dep_files.append(relpath) - return (args, dep_files) - def generate_link(self, target, outfile, outname, obj_list, linker, extra_args=[], stdlib_args=[]): if isinstance(target, build.StaticLibrary): linker_base = 'STATIC' diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 8029d58c2838..ad497e834388 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -1090,6 +1090,9 @@ def gen_vcxproj(self, target, ofname, guid): extra_link_args += compiler.get_option_link_args(self.environment.coredata.compiler_options[for_machine]) (additional_libpaths, additional_links, extra_link_args) = self.split_link_args(extra_link_args.to_native()) + unquoted_args, _ = self.get_export_symbol_file_args(compiler, target, absolute_paths=True) + extra_link_args += ['"{}"'.format(x) for x in unquoted_args] + # Add more libraries to be linked if needed for t in target.get_dependencies(): lobj = self.build.targets[t.get_id()]