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.
* Add boost_root support to properties files
This commit implements `boost_root`, `boost_includedir`, and
`boost_librarydir` variable support to native and cross properties
files. The search order is currently environment variables, then
these variables, and finally a platform-dependent search.
* Add preliminary boost_root / boost_includedir tests
Each test contains a fake "version.hpp", as that's how boost detection is
currently being done. We look for this file relative to the root directory,
which probably shouldn't be allowed (it previously was for BOOST_LIBRARYDIR
but not for BOOST_ROOT). It also cannot help with breakage detection in
libraries, however it looks like this wasn't getting tested beforehand.
I've given the two unique version numbers that shouldn't be present in any
stock version of boost (001 and 002).
* Add return type to detect_split_root
* Return empty list when nothing found in BOOST_ROOT, rather than None
* Update boost_root tests
* Create nativefile.ini based on location of run_project_tests.py
* Add fake libraries to ensure boost_librarydir is being used
* Require all search paths for boost to be absolute
* Redo boost search ordering
To better match things like pkg-config, we now look through native/cross files,
then environment variables, then system locations for boost installations.
Path detection does not fall back from one method to the next for properties or
environment variables--if boost_root, boost_librarydir, or boost_includedir is
specified, they must be sufficient to find boost. Likewise for BOOST_ROOT and
friends. pkg-config detection is still optional falling back to system-wide
detection, for Conan.
(Also, fix a typo in test 33's nativefile)
* Correct return type for detect_roots
* Correct boost dependency search order in documentation
* Print debug information for boost library finding, to resolve CI issues
* Handle native/cross file templates in a more consistent way
All tests can now create a `nativefile.ini.in` if they need to use some
parameter that the testing framework knows about but they can't.
* Pass str--rather than PosixPath--to os.path.exists, for Python35
* Look for boost minor versions, rather than boost patch versions in test cases
* Drop fake dylib versions of boost_regex
* Prefer get_env_var to use of os.environ
* Correct error reporting for relative BOOST_ROOT paths
* Bump version this appears in. Also, change "properties file" to "machine file" as that appears to be the more common language.
- 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.
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
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.
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.
The linker that comes with MSVC does not understand the /openmp flag.
This results in a string of
LINK : warning LNK4044: unrecognized option '/openmp'; ignored
warnings, one for each static_library linked with an executable.
Avoid this by only setting the linker openmp flag when the compiler is
not MSVC.
This is especially useful for Conan, where only the boost.pc
file is provided and manually setting BOOST_ROOT is not a
good solution since it is in a private cache directory.
See #5438
D lang compilers have an option -release (or similar) which turns off
asserts, contracts, and other runtime type checking. This patch wires
that up to the b_ndebug flag.
Fixes#7082
Now follows ios and other platform directory layouts. Moves from
separate android_$arch directories to every library containing a _$arch
suffix. e.g. libQt5Core_x86.a in a single directory.
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.
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
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.
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.
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.
This makes use of proper ConfigTool and PkgConfig dependencies rather
than one big ExternalDependency that internally creates other
dependencies and then copies their attributes.
Basically this breaks down into three cases. An open source version with
compliant PkgConfig, valid CMake, and a Intel implementation that has
completely broken PkgConfig. For the first two cases we can use standard
classes, for the last we can make a subclass of PkgConfigDependency that
handles the special logic.
This doesn't change any of the logic, but it does re-organize it to be
clearer, and make use of the dependency factory API, which makes other
things (like Dependency.get_variable) work.
This is untested with Intel MKL.
Compiler is invariant, in other words Compiler and only Compiler can
fulfull it, it's derived classes cannot be used. CompilerType is
covariant, that is Compiler and any derived class can fulfill it. This
fixes a number of issues in the boost module.
This makes the typing annotations basically impossible to get right, but
if we only have one key then it's easy. Fortunately python provides
comprehensions, so we don't even need the ability to pass multiple keys,
we can just [extract_as_list(kwargs, c) for c in ('a', 'b', 'c')] and
get the same result.
This PR significantly improves the handling of the boost library
tags and also ensures that the found libraries are always compatible
(have the same ABI tag). The current setup can also be extended to
filter for additional features (static linking with the runtime, etc.).
Additionally, BOOST_ROOT is better supported (it is now guaranteed
that all found files belong to a single root directory).
Finally, boost.py is now fully annotated (and checked with mypy).
This leads to better version parsing. An concrete example use case is
llc. When invoking llc with "--version", the output is
```
LLVM (http://llvm.org/):
LLVM version 9.0.1
...
```
The old version parsing recognizes the dot in the first line as version.
This commit also tries to adapt the two regexes to each other.
Reported-by: Björn Fiedler <fiedler@sra.uni-hannover.de>