diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-02-15 13:33:29 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-02-17 20:13:24 +0200 |
commit | 440d73902dc266ff25465d125b7f625e531b1225 (patch) | |
tree | efd7efe0511f9965662156b482fe14db7d52ba84 | |
parent | e31b6e4a7b6b0b9504bea160cc7e8e811eb7b856 (diff) | |
download | meson-440d73902dc266ff25465d125b7f625e531b1225.zip meson-440d73902dc266ff25465d125b7f625e531b1225.tar.gz meson-440d73902dc266ff25465d125b7f625e531b1225.tar.bz2 |
Explicitly use the import library while generating link args for a target
-rw-r--r-- | mesonbuild/backend/backends.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index d66418c..d6b8e7c 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -89,6 +89,14 @@ class Backend(): filename = os.path.join(targetdir, fname) return filename + def get_target_filename_for_linking(self, target): + # On some platforms (msvc for instance), the file that is used for + # dynamic linking is not the same as the dynamic library itself. This + # file is called an import library, and we want to link against that. + # On platforms where this distinction is not important, the import + # library is the same as the dynamic library itself. + return os.path.join(self.get_target_dir(target), target.get_import_filename()) + def get_target_dir(self, target): if self.environment.coredata.get_builtin_option('layout') == 'mirror': dirname = target.get_subdir() @@ -265,11 +273,7 @@ class Backend(): if not isinstance(d, build.StaticLibrary) and\ not isinstance(d, build.SharedLibrary): raise RuntimeError('Tried to link with a non-library target "%s".' % d.get_basename()) - fname = self.get_target_filename(d) - if compiler.id == 'msvc': - if fname.endswith('dll'): - fname = fname[:-3] + 'lib' - args.append(fname) + args.append(self.get_target_filename_for_linking(d)) # If you have executable e that links to shared lib s1 that links to shared library s2 # you have to specify s2 as well as s1 when linking e even if e does not directly use # s2. Gcc handles this case fine but Clang does not for some reason. Thus we need to |