aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/c.py
diff options
context:
space:
mode:
authorMartin Hostettler <textshell@uchuujin.de>2018-02-18 18:33:35 +0100
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-04-15 07:29:21 +0000
commitaff597fb99a77b8c1211e30f712f223d6d99587c (patch)
tree1267ab643f11f1fef70b19cc27efeef654d7283a /mesonbuild/compilers/c.py
parent642e17aa6be5b6736b856961563377d10faa57aa (diff)
downloadmeson-aff597fb99a77b8c1211e30f712f223d6d99587c.zip
meson-aff597fb99a77b8c1211e30f712f223d6d99587c.tar.gz
meson-aff597fb99a77b8c1211e30f712f223d6d99587c.tar.bz2
ninjabackend: Try to guess library dependencies for linker invocation.
The linkers currently do not support ninja compatible output of dependencies used while linking. Try to guess which files will be used while linking in python code and generate conservative dependencies to ensure changes in linked libraries are detected. This generates dependencies on the best match for static and shared linking, but this should not be a problem, except for spurious rebuilding when only one of them changes, which should not be a problem. Also makes sure to ignore any libraries generated inside the build, to keep the optimisation working where changes in a shared library only cause relink if the symbols have changed as well.
Diffstat (limited to 'mesonbuild/compilers/c.py')
-rw-r--r--mesonbuild/compilers/c.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index dee5125..958357b 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -754,7 +754,7 @@ class CCompiler(Compiler):
return False
raise RuntimeError('BUG: {!r} check failed unexpectedly'.format(n))
- def get_library_naming(self, env, libtype):
+ def get_library_naming(self, env, libtype, strict=False):
'''
Get library prefixes and suffixes for the target platform ordered by
priority
@@ -762,7 +762,10 @@ class CCompiler(Compiler):
stlibext = ['a']
# We've always allowed libname to be both `foo` and `libfoo`,
# and now people depend on it
- prefixes = ['lib', '']
+ if strict and self.id != 'msvc': # lib prefix is not usually used with msvc
+ prefixes = ['lib']
+ else:
+ prefixes = ['lib', '']
# Library suffixes and prefixes
if for_darwin(env.is_cross_build(), env):
shlibext = ['dylib']