Commit Graph

79 Commits

Author SHA1 Message Date
Dylan Baker d67271e1a6
Small cleanups for the LLVM dependency class (#6548) 2020-01-30 23:32:33 +02:00
Dylan Baker 5ab29e264b dependencies: Rename _add_sub_dependency2 to _add_sub_dependency
Since the original _add_sub_dependency is no longer in use.
2020-01-29 09:11:24 -08:00
Dylan Baker fbad73c939 dependencies: Use a DependencyFactory for threads
This lets us make a number of uses of threads safer, because we can use
the threads_factory instead of the ThreadDependency
2020-01-29 09:11:24 -08:00
Dylan Baker bc2bfcacbd dependencies: Use DependencyFactory for gmock 2020-01-29 09:11:24 -08:00
Dylan Baker 626f73416f dependencies: Use a DependencyFactory for gtest 2020-01-29 09:11:24 -08:00
Dylan Baker 29b6d3e63c dependencies: Use a DependencyFactory for LLVM 2020-01-29 09:11:24 -08:00
Dylan Baker fd892ad7ce dependencies: Make Dependency initializer signatures match
Currently PkgConfig takes language as a keyword parameter in position 3,
while the others take it as positional in position 2. Because most
dependencies don't actually set a language (they use C style linking),
using a positional argument makes more sense. ExtraFrameworkDependencies
is even more different, and duplicates some arguments from the base
ExternalDependency class.

For later changes I'm planning to make having all of the dependencies
use the same signature is really, really helpful.
2020-01-29 09:11:24 -08:00
Dylan Baker f85d6cee6a dependencies/base: Split process_method_kw out of Dependency
I want to use this in a new class as well, that doesn't descend from
Dependency.
2020-01-29 09:11:24 -08:00
Daniel Mensinger 3607f50d7f
cmake: Refactor CMakeExecutor and CMakeTraceParser
This moves most of the execution code from the CMakeInterpreter
into CMakeExecutor. Also, CMakeTraceParser is now responsible
for determining the trace cmd arguments.
2020-01-26 18:23:34 +01:00
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Daniel Mensinger 0cf31e2340 lgtm: fix Multiple calls to __init__
Some slight refactoring for the dependency classes and
I switched the elbrus compiler to the GnuLikeCompiler.
This is also the correct use according to the documentation
of GnuLikeCompiler.
2019-12-05 11:08:12 -05:00
Wolfgang Stöggl f037e7ef45 Fix typos found by codespell
- Typos were found by codespell v1.16.0
2019-11-06 09:55:30 -05:00
Ting-Wei Lan 08ce1fb541 Move the list of LLVM version suffixes to a common place
Both scan-build and llvm-config need the same list of LLVM version
suffixes. It is better to keep the list at a common place instead of
having several copies in different files, which is likely to become
out-of-sync when the list is updated.
2019-09-29 00:11:13 +08:00
Dylan Baker e3140fa2d2 dependencies/dev: Switch order of llvm dependency finders
Cmake ignores shared vs dynamic linking, and always returns static. This
went unnoticed, but results in regresssions for mesa. We need to fix
cmake, but with 0.51.1 due out shortly switching the order provides a
quick fix to restore expected functionality seems acceptable.

Fixes #5568
2019-07-02 23:27:28 +03:00
Daniel Mensinger b1cf0fd380
cmake: Move parsing the CMake trace into the CMake module 2019-06-12 13:58:20 +02:00
John Ericson 07777e15d4 Purge `is_cross` and friends without changing user interfaces
In most cases instead pass `for_machine`, the name of the relevant
machines (what compilers target, what targets run on, etc). This allows
us to use the cross code path in the native case, deduplicating the
code.

As one can see, environment got bigger as more information is kept
structured there, while ninjabackend got a smaller. Overall a few amount
of lines were added, but the hope is what's added is a lot simpler than
what's removed.
2019-06-09 13:13:25 -04:00
Dylan Baker e3e1d67ad6 dependencies/llvm: Fixup bad output from llvm-config on windows
It turns out that llvm-config on windows can return such wonderful
output as `-LIBDIR:c:\\... c:\\abslute\\path\\to\\lib.lib`, which was
all fine and dandy when we were blindly passing it through, GCC/MinGW
ignored it and MSVC understood it meant `/LIBDIR:`; however, after we
added some code to validate linker arguments, and we have some code
before the validation that tries to remove posix style -L arguments,
resulting in IBDIR:..., which doesn't validate.

This patch fixes up the output of llvm-config so that -LIBDIR: is
replaced by the the link libdir argument of the compiler, via the
compiler/linker method for getting that.

Fixes #5419
2019-05-27 01:10:17 +03:00
Daniel Mensinger 25de6dd675
cmake: Fixed new thread dependency 2019-05-03 01:49:01 +02:00
Daniel Mensinger 1fba945b61
cmake: LLVM better modules handling 2019-05-03 01:39:16 +02:00
Daniel Mensinger 3f539e01ae
cmake: revert module name mapping 2019-05-03 01:39:16 +02:00
Daniel Mensinger 6a2faacdf9
cmake: minor code fixes 2019-05-03 01:39:16 +02:00
Daniel Mensinger 55379b7d0f
CMake: optional modules support 2019-05-03 01:39:16 +02:00
Daniel Mensinger a9930fe066
LLVM: Added CMake backend 2019-05-03 01:39:16 +02:00
Daniel Mensinger e0f19cf520
LLVM dependency refactoring 2019-05-03 01:39:09 +02:00
Dylan Baker b59bec08a2 dependencies: Use the _add_sub_dependency 2019-05-02 13:28:33 -07:00
Dylan Baker 63090605a5 dependencies/dev: Use ext_deps for GTest in GMock
Rather than assigning the gtest variables to gmock, just set gtest as
a sub dependency.
2019-04-05 16:42:44 -07:00
Dylan Baker 6ad7fbf950 dependencies/misc: don't special case threads
Instad of having special casing of threads in the backends and
everywehre else, do what we did for openmp, create a real
dependency. Then make use of the fact that dependencies can now have
sub dependencies to add threads.
2019-04-05 16:41:08 -07:00
Dylan Baker 1f0b3652ac dependencies/llvm: Add support for fedora 30
In Fedora 30 the llvm-config binary has the number of bits in the isa
added as a suffic to the name llvm-config-64 or llvm-config-32, and no
naked llvm-config binary is provided. This commit moves the list of
llvm-config binaries to the constructor so that we can modify the list
on a per-instance basis, and adds the new Feodra names.

Fixes #5059
2019-03-14 23:35:26 +02:00
Dylan Baker cb614e8ff6 llvm: Add llvm-config80 for FreeBSD 2019-03-07 11:14:05 +02:00
Dylan Baker f72522e889 dependencies/llvm: add debian's llvm-9
Debian has already pushed llvm-9 into experimental
2019-01-23 14:45:17 +02:00
Dylan Baker be07a710ee dependencies/llvm: Mark as not found when not found
When either the shard or static libs are not available, and the
dependency is not required mark the dependency as not found and return.

Fixes #4360
2018-10-11 23:20:22 +03:00
Dylan Baker ca8ae7f5e5 dependencies/LLVM: rework shared link detection to be more robust
Instead of trying to hardcode which versions of which OSes are
misconfiguring llvm-config, lets try to use a generic mechanism that
catches most of the broken cases.

If a dynamic lib is built but the tools are linked staticly
(LLVM_BUILD_LLVM_DYLIB=true and LLVM_LINK_LLVM_DYLIB=false) and you
don't enabled shared libs (LLVM_BUILD_SHARED_LIBS=false, which should be
false), then llvm-config will mistakenly return a each static library
with .(so|dll|dylib) appended, instead of -lLLVM-x.y.z. if
LLVM_LINK_LLVM_DYlIB is true this works fine. There's been a bug opened
in upstream since 2014 about this with no responses[1].

So, this patches looks at --shared-mode (which tells us whether
llvm-config was linked staticly or dynamicly), then if the shared-mode
is static it will check and see what it gets. If it gets valid results
then it will go with those, if it doesn't then it will try to build a
set of valid link arguments to link with libLLVM.(so|dll|dylib).

[1] https://bugs.llvm.org/show_bug.cgi?id=19937
2018-10-01 14:23:34 -07:00
Dylan Baker e5080a8453 dependencies/llvm: Fix shared linking on osx
The versions of LLVM provided by brew have the same configuration problem that
dragonflyBSD and FreeBSD do, which means that they produce wrong results for
shared linking.
2018-10-01 14:23:34 -07:00
Dylan Baker 2b26ddbf3e dependencies/llvm: Add LLVM 7
It appears that debian has changed their naming scheme. This might
require revisiting in the future to add llvm-config-7.0 if debian
decides to do that.
2018-09-22 12:27:26 +03:00
Jon Turney 39d87269b3 Add missing reporting of some methods tried to find the dependency
Make us report 'system' and 'framework' when we tried those methods to
locate the dependency.
2018-09-10 21:02:18 +03:00
Jakub Wilk 73cbf4113a llvm: fix build flags with older llvm versions
Fix fallback code for older (<= 3.8) llvm versions to not be dependent
on readdir() order.

Fixes #4102
2018-09-04 22:46:01 -07:00
David Seifert c427f8cc9c
Pull in GTest as a dependency of GMock
* WrapDB already unconditionally includes GTest,
  and using GMock without GTest is extremely hard
  and definitely not the default setup.
2018-09-02 22:03:07 +02:00
David Seifert 5242241f5e
Prefer pkgconfig for `GMockDependency`
* Also bring `main` semantics in line with `GTestDependency`
2018-09-02 22:03:05 +02:00
David Seifert 0aa973777f
Prefer pkgconfig for `GTestDependency` 2018-09-02 22:03:02 +02:00
Jon Turney 6a4c2d63d7
Comparison with an unknown dependency version should always fail
Consistently use None to store an unknown dependency version (rather than
'none', 'unknown' or some made up version)
2018-08-26 17:23:39 +01:00
Jon Turney f2673d9b57
Consolidate reporting result of a dependency check
If successful, we should identify the method which was successful
If successful, we should report the version found (if known)
If failing, we should identify the methods we tried

Some dependency detectors which had no reporting now gain it

There's all kinds of complexities, inconsistencies and special cases hidden
in the existing behaviour, e.g.:

- boost reports modules requested, and BOOST_ROOT (if set)
- gtest/gmock report if they are a prebuilt library or header only
- mpi reports the language
- qt reports modules requested, and the config tool used or tried
- configtool reports the config tool used
- llvm reports if missing modules are optional (one per line)

We add some simple hooks to allow the dependency object to expose the
currently reported information into the consolidated reporting

Note that PkgConfigDependency() takes a silent: keyword which is used
internallly to suppress reporting.  This behaviour isn't needed in
find_external_dependency().
2018-08-01 14:26:01 +01:00
Nirbheek Chauhan 5113eb14b9 gnome: Use raw link arguments with g-ir and gtk-doc
Those tools use our arguments to build a file and execute it to
introspect it at runtime. However, they do not know that you can pass
the full path to the library to use, and ignore the arguments.

The long-term fix for this is to have them output a .c file that Meson
will build for them, which they can then run, but that will require
upstream changes:
https://gitlab.gnome.org/GNOME/gtk-doc/merge_requests/1

Closes https://github.com/mesonbuild/meson/issues/3774
2018-07-01 21:54:09 +00:00
Nirbheek Chauhan d737488150 dependencies: Don't assume self.compiler is a C compiler
All dependencies were using find_library, has_header, get_define, etc on
self.compiler assuming that it's a compiler that outputs and consumes
C-like libraries. This is not true for D (and in the future, for Rust)
since although they can consume C libraries, they do not use the
C ecosystem.

For such purposes, we now have self.clib_compiler. Nothing uses
self.compiler anymore as a result, and it has been removed.
2018-06-20 11:27:08 +00:00
Jussi Pakkanen 8b9fe0efff No longer require duplicate gtest header install. 2018-05-04 11:46:22 +00:00
Dylan Baker 221c3ec105 llvm: Add configs for freebsd 6.0 and debian 7svn
Debian has 7svn in their experimental repo, and FreeBSD has 6.0.r2 in
their ports.
2018-02-22 22:24:07 +02:00
Dylan Baker d889989ea1 dependnecies: generalize version suffix stripping code
This replaces calls to .rstrip('git'), .rstrip('svn') with a regex that
takes the leading numbers and dots, and throws away the rest. This also
moves the code up to the ConfigToolDepdency level, since these config
tools are of various quality and some of them are good, and some are
not. This shouldn't affect well behaved tools.

This should future proof LLVM against future suffixes (like someone
doing something strange like using Mercurial as a VCS).
2018-01-18 11:07:41 -08:00
Dylan Baker a9210c57e1 LLVM: work around FreeBSD specific static linking problems
Because FreeBSD's llvm-config adds -l/usr/lib/libexecinfo.so when asked
for system-libs, which is bogus. We'll remove the leading -l from any
argument that also ends with .so.
2018-01-06 13:49:34 -08:00
Dylan Baker 660dee1e10 LLVM: use DragonFly BSD workaround on FreeBSD as well 2018-01-06 13:49:34 -08:00
Dylan Baker 448ba5b6f3 LLVM: work around bug in dragonfly bsd llvm-config for shared libs
Of course there are OS specific bugs for llvm-config as well, so work
around those too.
2018-01-06 13:49:34 -08:00
Dylan Baker 3a0f8ab0cf dependencies/dev: remove unused imports
flake8 complains about them, and I prefer to have a clean error log in
vim.
2018-01-06 13:49:34 -08:00