diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-11-11 06:12:34 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-11-12 13:56:17 -0500 |
commit | 085650a1e3769366ac47f7d8a59386ed6d5a1ef5 (patch) | |
tree | 406344ab18e2708757534a95cf1b2ec0ff2c39c0 /mesonbuild/interpreter.py | |
parent | 4cdd22f0944d46e6759be93cd4310e23ee94dd2e (diff) | |
download | meson-085650a1e3769366ac47f7d8a59386ed6d5a1ef5.zip meson-085650a1e3769366ac47f7d8a59386ed6d5a1ef5.tar.gz meson-085650a1e3769366ac47f7d8a59386ed6d5a1ef5.tar.bz2 |
vala: Implement valac.find_library
Move CCompiler.compile to Compiler.compile so that ValaCompiler can use
it. Also rewrite ValaCompiler.sanity_check to use it since it does
a simple compile check.
At the same time, it enhances ExternalLibrary to support arguments for
languages other than C-like.
Includes a test for this that links against zlib through Vala.
Closes #983
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 33587a4..f8af82e 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -944,9 +944,17 @@ class CompilerHolder(InterpreterObject): if not os.path.isabs(i): raise InvalidCode('Search directory %s is not an absolute path.' % i) linkargs = self.compiler.find_library(libname, self.environment, search_dirs) - if required and linkargs is None: - raise InterpreterException('Library {} not found'.format(libname)) - lib = dependencies.ExternalLibrary(libname, linkargs) + if required and not linkargs: + l = self.compiler.language.capitalize() + raise InterpreterException('{} library {!r} not found'.format(l, libname)) + # If this is set to None, the library and link arguments are for + # a C-like compiler. Otherwise, it's for some other language that has + # a find_library implementation. We do this because it's easier than + # maintaining a list of languages that can consume C libraries. + lang = None + if self.compiler.language == 'vala': + lang = 'vala' + lib = dependencies.ExternalLibrary(libname, linkargs, language=lang) return ExternalLibraryHolder(lib) def has_argument_method(self, args, kwargs): |