From aff597fb99a77b8c1211e30f712f223d6d99587c Mon Sep 17 00:00:00 2001 From: Martin Hostettler Date: Sun, 18 Feb 2018 18:33:35 +0100 Subject: 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. --- mesonbuild/compilers/c.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'mesonbuild/compilers') 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'] -- cgit v1.1