aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies.py
AgeCommit message (Collapse)AuthorFilesLines
2017-05-09Move dependencies.py into a subdirectory.Elliott Sales de Andrade1-1815/+0
2017-05-09Merge pull request #1751 from centricular/fix-cached-depsJussi Pakkanen1-17/+21
Fix caching of external dependencies of various types
2017-05-09Merge pull request #1758 from dcbaker/llvm-cpp-blacklistJussi Pakkanen1-2/+3
LLVM cpp blacklist
2017-05-09Completely overhaul caching of external dependenciesNirbheek Chauhan1-5/+13
The old caching was a mess of spaghetti code layered over pasta code. The new code is well-commented, is clear about what it's trying to do, and uses a blacklist of keyword arguments instead of a whitelist while generating identifiers for dep caching which makes it much more robust for future changes. The only side-effect of forgetting about a new keyword argument would be that the dependency would not be cached unless the values of that keyword arguments were the same in the cached and new dependency. There are also more tests which identify scenarios that were broken earlier.
2017-05-09pkgconfig dependency: Define version_reqs at the startNirbheek Chauhan1-1/+1
Otherwise a cached not-found dependency won't have it and __repr__ will fail.
2017-05-09dependencies: Fix caching of native/cross dependenciesNirbheek Chauhan1-15/+11
All our cached_dep magic was totally useless since we ended up using the same identifier for native and cross deps. Just nuke all this cached_dep code since it is very error-prone and improve the identifier generation instead. For instance, this is broken *right now* with the `type_name` kwarg. Add a bunch of tests to ensure that all this actually works... Closes https://github.com/mesonbuild/meson/issues/1736
2017-05-08Fix error log in LLVM, which used the wrong variableDylan Baker1-1/+1
And that variable could be undefined at this point.
2017-05-08Implement a cpp blacklist for LLVM dependencyDylan Baker1-1/+2
This adds a set of private flags that are removed from the output of `llvm-config --cppflags` before storing them. This is unfortunately necessary since some versions of LLVM include absolute garbage like '-DNDEBUG' in their CPP flags, and we don't want to pass those.
2017-05-07run_command: Refactor + improve errors and testNirbheek Chauhan1-13/+17
Refactor to use ExternalProgram for the command instead of duplicating that code (badly). Also improve messages to say "or not executable" when a script/command is not found. Also allow ExternalPrograms to be passed as arguments to run_command(). The only thing we're doing by preventing that is forcing people to use prog.path()
2017-05-03Add dependency for LLVM. Fixes #1611Dylan Baker1-0/+127
This adds a depdendncy wrapper for llvm-config based on the wxwidgets dependency. IT handles libs, version, include dir, and the llvm unique concept of components. These components are individual pieces of the LLVM library that may or may not be available depending on the platform.
2017-05-03Add some FIXME comments to wxwidgets dependency.Dylan Baker1-0/+5
2017-05-02Don't use len() to test emptiness vs not emptinessDylan Baker1-3/+3
Meson has a common pattern of using 'if len(foo) == 0:' or 'if len(foo) != 0:', however, this is a common anti-pattern in python. Instead tests for emptiness/non-emptiness should be done with a simple 'if foo:' or 'if not foo:' Consider the following: >>> import timeit >>> timeit.timeit('if len([]) == 0: pass') 0.10730923599840025 >>> timeit.timeit('if not []: pass') 0.030033907998586074 >>> timeit.timeit('if len(['a', 'b', 'c', 'd']) == 0: pass') 0.1154778649979562 >>> timeit.timeit("if not ['a', 'b', 'c', 'd']: pass") 0.08259823200205574 >>> timeit.timeit('if len("") == 0: pass') 0.089759664999292 >>> timeit.timeit('if not "": pass') 0.02340641999762738 >>> timeit.timeit('if len("foo") == 0: pass') 0.08848102600313723 >>> timeit.timeit('if not "foo": pass') 0.04032287199879647 And for the one additional case of 'if len(foo.strip()) == 0', which can be replaced with 'if not foo.isspace()' >>> timeit.timeit('if len(" ".strip()) == 0: pass') 0.15294511600222904 >>> timeit.timeit('if " ".isspace(): pass') 0.09413968399894657 >>> timeit.timeit('if len(" abc".strip()) == 0: pass') 0.2023209120015963 >>> timeit.timeit('if " abc".isspace(): pass') 0.09571301700270851 In other words, it's always a win to not use len(), when you don't actually want to check the length.
2017-04-29dependencies: qt: qmake method: prefer QT_HOST_BINS over QT_INSTALL_BINSWade Berrier1-2/+10
When cross compiling and looking for moc/uic/rcc you really want the host binary. Still fall back to QT_INSTALL_BINS as it appears that's the only variable available with qt4.
2017-04-21Expose the implementation language for external librariesNirbheek Chauhan1-6/+12
Ideally, all dependency objects should support this, but it's a lot of work and isn't supported by all dependency types (like frameworks and pkg-config), so for now just enable it for external libraries.
2017-04-14dependencies: boost: use system include flag for header includesWade Berrier1-3/+28
... based on the compiler object This addresses issue #1569 Need to be careful about using -isystem with the standard include dirs (thanks to the unit tests for catching this). It may be worthwhile trying to detect what the include dirs are. Other dependencies (GTest) just avoid adding the include dir for those system includes. Do the same here.
2017-04-10Use an enum instead of strings for method names.Aaron Small1-23/+40
If a non-string value is passed as a method, reject this explicitly with a clear error message rather than trying to match with it and failing.
2017-04-09Rename the pkgconfig method to pkg-configAaron Small1-13/+13
2017-04-09Add an option to dependencies called 'method'. This can be used toAaron Small1-101/+153
configure a detection method, for those types of dependencies that have more than one means of detection. The default detection methods are unchanged if 'method' is not specified, and all dependencies support the method 'auto', which is the same as not specifying a method. The dependencies which do support multiple detection methods additionally support other values, depending on the dependency.
2017-04-09Add support for BOOST_INCLUDEDIR and BOOST_LIBRARYDIRWade Berrier1-3/+13
In case they are not decendants of BOOST_ROOT... (Idea copied from CMake FindBoost) Fix for #1562 authors.txt: add myself as requested
2017-03-29Add dependency type for ValgrindDylan Baker1-0/+9
Valgrind is a bit of a strange beast, in general use one isn't supposed to link against valgrinds libs, they're non-PIC static libs, instead, including the headers does magic to make valgrind work. This patch implements a simple ValgrindDependency class subclassed from PkgConfigDependency, that overwrites (effectively) only the get_link_args method to always return an empty list. This solution may seem strange, but I think that it follows the principle of least surprise, and simplifies the most common use case for valgrind. Essentially without this every valgrind consumer would be forced to implement the following code to have a usable valgrind dependency object: _dep = dependency('valgrind', required : false) if _dep.found() valgrind_dep = declare_dependency( compile_args : _dep.get_pkgconfig_variable('Cflags') ) else valgrind_dep = [] endif While the above is workable, it's surprising behavior and the above code snippet becomes boilerplate that everyone needs to copy into their meson files. Fixes #826
2017-03-27Fix qt4 tool location detection, which may result in incorrectly pickingAaron Small1-1/+16
up qt5 tools when using the qt4 module.
2017-03-25Fix regen when using pkg-deps when there's no pkg-configNirbheek Chauhan1-1/+1
Without this, we'd fail with a "no attribute modversion" error.
2017-03-25Never accept a directory as being an executable programThibault Saunier1-1/+1
Otherwise we will possibly use a subfolder with the name an executable we are looking for as an executable
2017-02-19rpm: We no longer provide the full path to a libraryNirbheek Chauhan1-0/+3
Ever since we changed how we do library searching, the full path to the library has not been available under `.fullpath`. This has been broken for at least a year...
2017-02-19dependencies: Remove useless and verbose dict.get() callNirbheek Chauhan1-2/+2
We already ensured that the cross-info binaries section has pkg-config in the if check above.
2017-02-19find_program: Fix implementation of .path()Nirbheek Chauhan1-21/+28
And actually test that prog.path() works. The earlier test was just running the command without checking if it succeeded. Also make everything use prog.get_command() or get_path() instead of accessing the internal member prog.fullpath directly.
2017-02-18find_program: Correctly use scripts found in PATHNirbheek Chauhan1-12/+38
We also need to check whether the program found in PATH can be executed directly by Windows or if we need to figure out what the interpreter is and add it to the list. Also add `msc` to the list of extensions that can be executed natively Includes a project test and a unit test for this and all expected behaviours on Windows.
2017-02-13Detect Boost libraries primarily with the C++ compiler's find_library.Jussi Pakkanen1-3/+17
2017-02-07dependencies: Distinguish native/cross while cachingNirbheek Chauhan1-7/+7
Closes https://github.com/mesonbuild/meson/issues/1366
2017-01-28Check cross-pkg-config's viability with ExternalProgram. Closes #1329.Jussi Pakkanen1-3/+8
2017-01-28Merge pull request #1335 from tp-m/test-custom-target-used-in-test-cmdJussi Pakkanen1-3/+9
tests: check custom target output is created before being used in a t…
2017-01-28Use CompilerArgs for generation of compile commandsNirbheek Chauhan1-5/+3
At the same time, also fix the order in which compile arguments are added. Detailed comments have been added concerning the priority and order of the arguments. Also adds a unit test and an integration test for the same.
2017-01-28find_program: Translate 'python3' to sys.executable on WindowsNirbheek Chauhan1-3/+9
While reading shebangs, when we detect an attempt to run 'python3', use sys.executable instead. For example: #!/usr/bin/python3 #!python3 #!/usr/bin/env python3
2017-01-23Merge pull request #1302 from centricular/install-modeJussi Pakkanen1-0/+1
Support file perms for install_data and install_subdir
2017-01-23Gracefully fallback when cross pkg-config can not be found for an optional ↵Jussi Pakkanen1-2/+4
dependency.
2017-01-24wx deps: Always set modversion, even if dep not foundNirbheek Chauhan1-0/+1
Fixes: Traceback (most recent call last): File "mesonbuild/mesonmain.py", line 295, in run app.generate() File "mesonbuild/mesonmain.py", line 177, in generate intr.run() File "mesonbuild/interpreter.py", line 2444, in run super().run() File "mesonbuild/interpreterbase.py", line 124, in run self.evaluate_codeblock(self.ast, start=1) File "mesonbuild/interpreterbase.py", line 145, in evaluate_codeblock raise e File "mesonbuild/interpreterbase.py", line 139, in evaluate_codeblock self.evaluate_statement(cur) File "mesonbuild/interpreterbase.py", line 152, in evaluate_statement return self.assignment(cur) File "mesonbuild/interpreterbase.py", line 546, in assignment value = self.evaluate_statement(node.value) File "mesonbuild/interpreterbase.py", line 150, in evaluate_statement return self.function_call(cur) File "mesonbuild/interpreterbase.py", line 371, in function_call return self.funcs[func_name](node, self.flatten(posargs), kwargs) File "mesonbuild/interpreter.py", line 1876, in func_dependency found = cached_dep.get_version() File "mesonbuild/dependencies.py", line 369, in get_version return self.modversion AttributeError: 'WxDependency' object has no attribute 'modversion' ninja: error: rebuilding 'build.ninja': subcommand failed
2017-01-18Merge pull request #1312 from centricular/print-pkgdep-error-osxJussi Pakkanen1-8/+10
Fix pkg-config error handling on OS X
2017-01-18cleanup: Remove redundant parenthesesMike Sinkovsky1-3/+3
2017-01-18cleanup: Unused local variablesMike Sinkovsky1-1/+0
2017-01-17pkgdep: Print found message after setting cargs/libsNirbheek Chauhan1-2/+4
Fetching cflags and libs can also fail if, for instance, the pkg-config file for a dependency needed by this package isn't found. Without this, we will print "Found: YES" and then "Found: NO".
2017-01-17Print pkg-config error when framework dep isn't foundNirbheek Chauhan1-1/+3
Without this, macOS users can't figure out why a particular dependency wasn't found because the pkg-config error message gets masked by the fresh and useless DependencyException.
2017-01-17Derive all exceptions correctly from base exceptionsNirbheek Chauhan1-5/+3
Don't need to define __init__ and manually call the parent init. Doing so messes up the error message you get by doing str(exception) because it includes the current class name in it repeatedly.
2017-01-11style: [E1**] IndentationMike Sinkovsky1-3/+5
2017-01-11style: [E303] too many blank lines (2)Mike Sinkovsky1-1/+0
2017-01-11style: [E301] expected 1 blank line, found 0Mike Sinkovsky1-0/+2
2017-01-11style: [E502] the backslash is redundant between bracketsMike Sinkovsky1-3/+3
2017-01-01style: fix E124 violationsIgor Gnatenko1-1/+1
E124: closing bracket does not match visual indentation Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01style: fix E222 violationsIgor Gnatenko1-2/+2
E222: multiple spaces after operator Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-31Fix space before :.Jussi Pakkanen1-6/+6
2016-12-23Add get_version() method to all dependenciesNirbheek Chauhan1-13/+69
We unconditionally check the version of all dependencies, so without this regen will fail if you use that dependency.