aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/base.py
AgeCommit message (Collapse)AuthorFilesLines
2021-01-21interpreter: accept external programs and dependencies for summaryPaolo Bonzini1-0/+17
2021-01-13Fix misspellsAntonin Décimo1-1/+1
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2021-01-12dependencies: use env.machines for is_$os methodsDylan Baker1-7/+7
Currently we use the mesonlib ones, but these are always the build machine definitions, rather than being available for either the build or host machine. We already have an `Environment` instance, and the correct `MachineChoice`, so lets use that. Fixes #8165
2021-01-11dependencies: Don't read PKG_CONFIG_PATH from the env againDylan Baker1-10/+2
We already read this in, don't read it again. Just rely on the value we have stored.
2021-01-10cmake: add PATH logic to preliminary dep check (fixes #8133)Daniel Mensinger1-2/+16
2021-01-04Use a single coredata dictionary for optionsDylan Baker1-5/+5
This patches takes the options work to it's logical conclusion: A single flat dictionary of OptionKey: UserOptions. This allows us to simplify a large number of cases, as we don't need to check if an option is in this dict or that one (or any of 5 or 6, actually).
2021-01-04use OptionKey for builtin and base optionsDylan Baker1-5/+6
I would have prefered to do these seperatately, but they are combined in some cases, so it was much easier to convert them together. this eliminates the builtins_per_machine dict, as it's duplicated with the OptionKey's machine parameter.
2020-12-16cmake: Revert to using self.for_machine instead of MachineChoice.BUILD ↵Daniel Mensinger1-2/+3
(fixes #8028)
2020-11-24compiler: allow non-built internal dependencies as argumentsPaolo Bonzini1-3/+10
Allow methods on the compiler object to receive internal dependencies, as long as they only specify compiler/linker arguments or other dependencies that satisfy the same requirements. This is useful if you're using internal dependencies to add special "-D" flags such as -DNCURSES_WIDECHAR, -D_XOPEN_SOURCE_EXTENDED or -DGLIB_STATIC_COMPILATION.
2020-11-22Merge pull request #8011 from dcbaker/submit/post-python36-cleanupsJussi Pakkanen1-1/+1
Python 3.6 cleanups
2020-11-21Handle cmake dependencies which require a specified versionJason Ekstrand1-2/+6
Some CMake packages fail to find at all if no version is specified. This commit adds a cmake_version parameter to dependency() to allow you to specify the requested version.
2020-11-20use real pathlib moduleDylan Baker1-1/+1
We added the _pathlib module to work around defeciencies in python 3.5's implementation, since we now rely on 3.6 lets drop this
2020-11-12dependencies: Put pkgconfig options before operandsHaelwenn (lanodan) Monnier1-1/+5
This fixes building with meson when the POSIX behavior of getopt is used, such as when GNU libc is used with POSIXLY_CORRECT=1 defined
2020-10-16cmake: ignore CMAKE_TOOLCHAIN_FILE and CMAKE_PROJECT_INCLUDE to avoid ↵Daniel Mensinger1-1/+2
conflicts with the meson CMake logic
2020-10-13cmake: Add cross compilation supportDaniel Mensinger1-9/+21
2020-10-08dependency: support boolean argument "allow_fallback"Paolo Bonzini1-2/+4
Sometimes, distros want to configure a project so that it does not use any bundled library. In this case, meson.build might want to do something like this, where slirp is a combo option with values auto/system/internal: slirp = dependency('', required: false) if get_option('slirp') != 'internal' slirp = dependency('slirp', required: get_option('slirp') == 'system') endif if not slirp.found() slirp = subproject('libslirp', ...) .variable('...') endif and we cannot use "fallback" because the "system" value should never look for a subproject. This worked until 0.54.x, but in 0.55.x this breaks because of the automatic subproject search. Note that the desired effect here is backwards compared to the policy of doing an automatic search on "required: true"; we only want to do the search if "required" is false! It would be possible to look for the dependency with `required: false` and issue the error manually, but it's ugly and it may produce an error message that looks "different" from Meson's. Instead, with this change it is possible to achieve this effect in an even simpler way: slirp = dependency('slirp', required: get_option('slirp') != 'auto', allow_fallback: get_option('slirp') == 'system' ? false : ['slirp', 'libslirp_dep']) The patch also adds support for "allow_fallback: true", which is simple and enables automatic fallback to a wrap even for non-required dependencies.
2020-10-08interpreter: clean up handling of force_fallbackPaolo Bonzini1-1/+1
Force_fallback is not an interpreter keyword argument, and there is no reason to handle it as one since it is not used anywhere else (and in fact is explicitly ignored by get_dep_identifier). Use a Python keyword argument instead, which makes the code simpler.
2020-10-04pathlib: Fix resolve() by overriding it in Python 3.5Daniel Mensinger1-1/+1
2020-10-04cmake: switch to pathlib (fixes #7322)Daniel Mensinger1-4/+4
2020-09-29Merge pull request #7758 from dcbaker/submit/hdf5-factoryDylan Baker1-3/+3
dependencies/hdf5: Convert to a dependency_factory
2020-09-28typing: fully annotate cmake.executorDaniel Mensinger1-5/+5
2020-09-25dependencies/hdf5: Convert to a dependency_factoryDylan Baker1-3/+3
Instead of a mega dependency that does everything, use a dependency factory for config-tool and pkg-config
2020-09-14InternalDependency: Add as_link_whole() methodXavier Claessens1-0/+5
2020-09-13external-project: New module to build configure/make projectsXavier Claessens1-11/+18
This adds an experimental meson module to build projects with other build systems. Closes: #4316
2020-09-08typing: fix dependencies for new follow_importsDaniel Mensinger1-11/+11
2020-09-08Add some type hints to the ExternalProgram classNirbheek Chauhan1-7/+7
2020-09-08Fix picking up tools with args from the env on WindowsNirbheek Chauhan1-1/+8
This was a regression in https://github.com/mesonbuild/meson/pull/7059. We do not need to do a full search for all windows special cases. We only want to check whether the command provided is actually a full path to a script so we can add the interpreter. Fixes https://github.com/mesonbuild/meson/issues/7645
2020-09-02cmake: Don't link DEBUG to CRT when not building with MSVCNirbheek Chauhan1-1/+3
is_debug doesn't just control the CRT, it also controls the 'debug configuration' which is unrelated to the CRT setting on non-MSVC. Fixes https://github.com/mesonbuild/meson/issues/7631
2020-09-02dependencies: Fix type of dependency_factory decoratorDylan Baker1-13/+11
There was both a straight up bug in the type signature (the return type is List[Callable[[], Dependency]] not List[Type[Dependency]]), and in the way the arguments are assembled. Typing is pretty limited in it's ability to express decorators, so the best mypy can do is check the return types (I think). I've done what the docs suggest and it's stopped complaining.
2020-08-18Interpreter: Fix c_stdlib usageXavier Claessens1-1/+1
- Exceptions raised during subproject setup were ignored. - Allow c_stdlib in native file, was already half supported. - Eliminate usage of subproject variable name by overriding '<lang>_stdlib' dependency name.
2020-08-05cmake: Use the DEBUG config when linking to the debug CRTNirbheek Chauhan1-1/+4
The `debug` builtin option does not control whether or not the debug CRT is used. Without this fix, when buildtype=debugoptimized or when debug=true + b_vscrt=md, we will try to link to the debug libraries found via cmake while linking with `/release`, which will cause a link failure.
2020-07-23Merge pull request #7461 from mensinda/noMoreSetuptoolsJussi Pakkanen1-4/+2
Remove the setuptools dependency with mesondata.py
2020-07-16mdata: remove setuptools and use mesondata insteadDaniel Mensinger1-4/+2
2020-07-16deps: Do not deepcopy internal libraries (fixes #7457)Daniel Mensinger1-0/+10
2020-06-14Use cmake args also when calling get_cmake_infoVili Väinölä1-4/+4
- vcpkg libraries are not found when given cmake_toolchain_file and vcpkg_target_triplet as cmake_args when looking for the dependency if the first call to cmake has different arguments. The libraries are found if the first call has same arguments or if the CMakeCache.txt is deleted in call_with_fake_build.
2020-06-13cmake: Fix handling of path seperators (fixes #7294)Daniel Mensinger1-3/+8
2020-06-12dependencies: Add a couple of type annotationsDylan Baker1-2/+3
2020-06-12dependencies: Don't allow using the default binary for host on cross compilesDylan Baker1-4/+4
Otherwise we can end up finding dependencies from the build machine for the host machine, which is incorrect. This alters cmake, pkg-config, and all config-tool based dependencies. Fixes: #7276
2020-06-12dependencies: Don't try to find a binary by "default_path" when cross compilingDylan Baker1-4/+7
2020-06-12dependencies: Split search_tool out of ExternalDependencyDylan Baker1-21/+25
it really doesn't make sense to put this in the ExternalDependency class. It doesn't rely on any of the state of that class, and it's generically useful inside meson.
2020-06-12cmake: Subprojects support CMAKE_PREFIX_PATH (fixes #7249)Daniel Mensinger1-15/+1
2020-06-10Fix python3 installed from the Windows StoreD Scott Phillips1-3/+12
When meson is currently being run with a python that seems to have been installed from the Windows Store, replace the general WindowsApps directory in search paths with dirname(sys.executable), and also handle failures with pathlib.resolve on WindowsApps exe files.
2020-06-10dependencies: Remove finish_init methodDylan Baker1-2/+0
This is a holdover from before we had the DependencyFactory. It should have already been refactored into the initializer, but wasn't for some reason.
2020-05-24fix cmake target configuration selection.Alexander Neumann1-2/+9
2020-05-11ConfigToolDependency: Don't fallback to system tool when cross compilingXavier Claessens1-21/+4
The system tool is always the wrong thing to use and cause hard to debug issues when trying to link system libraries with cross built binaries. The ExternalDependency base class already had a method to deal with this, used by PkgConfigDependency and QtBaseDependency, so it should make things more consistent.
2020-04-30ExternalProgram: Do special windows tricks even when name is providedXavier Claessens1-0/+4
Closes: #7051
2020-04-21Use pkg_resource to find resources files (data)Dylan Baker1-2/+4
Doing this by hand is fraught with corner cases, and we're running into some of those problems already. setuptools pkg_resource is a well tested solution for not running into corner cases, and we already rely on setuptools to make our entry point scripts work, so we might as well make us of the other things it can solve for us. Fixes #6801
2020-04-15dependencies/cmake: Only use abs paths as link argsDaniel Stone1-1/+5
When taking library dependencies from CMake, we first attempt to look the dependency up in the target list, then fall back to treating it as a path, which we add if the path exists. As there is no check for whether or not the path is really a path, this can cause false positives; for example if a 'uuid' dependency was passed intending to be a target, but it cannot be found and the current directory also contains a file or directory named 'uuid', we will just include the string 'uuid' in library dependencies. This is particularly prevalent on Windows, where a system library called 'version' exists, and thanks to case insensitivity will match a file called 'VERSION' if found in the source root when running Meson from the source directory, or a generated file when running Meson from the build directory. Fix this check to only look up filesystem existence on absolute paths, not unqualified. This also adds a fallback warning in case an argument cannot be found, rather than silently falling back.
2020-04-15dependencies/cmake: Suffix bare library dependencies on WindowsDaniel Stone1-0/+9
On Windows, library dependencies can be passed with no prefix or suffix; rather than -lfoo or foo.dll, they can just be passed as 'foo'. CMake handles this and suffixes the library with '.lib' or '.dll', depending on the link mode. Do the same here, and if we've been passed an unqualified non-option bare name on Windows, add the appropriate suffix and pass it through to the linker. This fixes dependencies on system libraries.
2020-04-15dependencies/cmake: Add Windows/VS library regexDaniel Stone1-1/+2
When finding dependencies from CMake, use a smarter regex to determine whether or not a dependency is actually a link argument, and pass through Windows link arguments properly.