Commit Graph

66 Commits

Author SHA1 Message Date
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
Dylan Baker 0bbc9df74a dependencies: Also strip git version from llvm version
If LLVM is built from a git mirror instead of from SVN it will have
"git-<very short sha>" at the end of the version. We need to remove that
so that version comparison will work correctly.

Fixes: #2786
2017-12-16 14:42:30 +02:00
Dylan Baker 11b62c3c51 dependencies: use mlog.bold with llvm module/component names. 2017-12-15 14:20:16 -08:00
Dylan Baker 2b2ee68f90 dependencies: Print LLVM for LLVM dependency
Instead of config-tool
2017-12-15 13:46:24 -08:00
Jussi Pakkanen 746e70c0da
Merge pull request #2512 from dcbaker/wip/config-tool-variables
Add method to get values from config tool based dependency
2017-11-28 22:01:00 +02:00
Josh Soref 47bacd40e0 spelling: attempt 2017-11-26 05:12:21 +00:00
Josh Soref 8a66cfb2af spelling: arbitrary 2017-11-26 05:08:02 +00:00
Dylan Baker f0248b0342 Make LLVMDependency a ConfigToolDependency 2017-11-23 19:54:47 -08:00
Nirbheek Chauhan 18b42c5370 llvm: Output stderr when generating libs/flags/etc fails
f.ex when you don't have the llvm-static package installed, the error
message when generating libs is cryptic and uninformative since we
discard stderr.
2017-11-13 21:02:43 +02:00
Dylan Baker a8d3eb3c10 llvm: llvm 5.0 is released and the current stable
So set it as the first versioned config to check for, and add
llvm-config-6.0 to the list of configs.
2017-11-09 21:08:44 +02:00
Dylan Baker 3aa97d4ab5 llvm: fix static vs dynamic linking
LLVM >= 3.9 provides an llvm-config that has a sane mechanism for
selecting static vs dynamic linking. LLVM < 3.9 (but >= 3.5) not so
much. For those older LLVM versions, llvm-config will always provide
arguments for statically linking LLVM, even if there is a library for
dynamic linking.

Fixes #2442
2017-10-25 10:07:50 -07:00
Dylan Baker 5584409346 llvm: Add support for linking statically
This adds support for the static kwarg to the llvm dependency.
2017-10-25 10:03:34 -07:00
Dylan Baker 6cbbbd546e llvm: Add modules to libs check
Which is required for statically linking with LLVM.
2017-10-25 10:03:34 -07:00
Dylan Baker 3e004ae611 llvm: check for components (modules) before libs.
For statically linking we need to pass the modules to llvm-config, so we
need to validate them and have them ready to use before then.
2017-10-25 10:03:34 -07:00