Commit Graph

113 Commits

Author SHA1 Message Date
Tristan Partin 80b101443d Add BSD support to the JNISystemDependency
Supports all BSDs that Meson currently supports.

Fixes #10883
2022-10-09 16:47:47 +03:00
Eli Schwartz cc5ef6478f
compilers: perform targeted imports for detect
Only import the ones we need for the language we are detecting, once we
actually detect that language.

This will allow finally dropping the main imports of these files in a
followup commit.
2022-09-19 15:19:00 -04:00
Eli Schwartz 5bfab845d0
compilers: directly import from subpackages
It turns out we don't generally need to proxy every compiler ever
through the top-level package. The number of times we directly poke at
one is negligible and direct imports are pretty clean.
2022-09-19 15:19:00 -04:00
Eli Schwartz 36e7748d02
dependencies: simplify logging methods
A bunch of SystemDependency subclasses overrode log_tried() even though
they used the same function anyway. Delete them -- they still print
the same thing either way.
2022-09-12 19:16:59 -04:00
Eli Schwartz c5db96e051 flake8: fix typing casts to not have actual objects
We use `__future__.annotations` to good effect everywhere we can, and
one of the effects of this is that annotations are automatically
stringized and don't need to be evaluated, using less memory and
computation. But this only affects actual annotations -- a cast is just
a function with an argument, so the compiler has no idea that it's an
annotation to be stringized.

Do this manually.
2022-08-29 23:32:43 +03:00
Daniel Mensinger 1a80e5b35e cmake: Fix CMake LLVM dependency error (fixes #10322) 2022-05-01 23:45:08 +03:00
Daniel Mensinger 589600cb51 cmake: Always use all compilers for LLVM (fixes #10249) 2022-04-12 18:25:38 -04:00
Eli Schwartz c9938f8f60
move a bunch of imports into TYPE_CHECKING blocks
These are only used for type checking, so don't bother importing them at
runtime.

Generally add future annotations at the same time, to make sure that
existing uses of these imports don't need to be quoted.
2022-03-29 16:44:54 -04:00
Tristan Partin 498db2764c Add modules kwarg to JNI system dep
This allows someone to link against libjvm.so and libjawt.so.
2022-03-04 13:52:21 -05:00
Tristan Partin 96b2469544 Rename JDK system dep to JNI
JNI is a more apt name because it currently only supports the JNI. I
also believe that CMake uses the terminology JNI here as well.

JNI is currently the only way to interact with the JVM through native
code, but there is a project called "Project Panama" which aims to be
another way for native code to interact with the JVM.
2022-03-02 16:23:09 -05:00
Eli Schwartz 140d6aef04 mark a bunch of dependencies with the version they were introduced
All these dependencies are impossible to find on versions of Meson older
than the ones they got custom lookups in, because they don't provide
pkg-config files. So they should not / cannot be reasonably used on
older versions, and it is easy to say "yep, these should emit a
FeatureNew for the versions they got added in".
2022-03-01 12:13:24 -08:00
Dudemanguy e67c07c006 dependencies/zlib: Allow for generic OS checks
Contrary to most system method checks, zlib currently functions as a
whitelist of OSes. This isn't really needed however. The first special
case for OSes that provide zlib as part of the base OS is worth keeping.
However, the elif for windows is more than generic enough to allow any
other potential OSes to try. Just make it a simplie if/else instead.
2021-11-20 23:54:33 -05:00
Dudemanguy a4b4b21908 dependencies/zlib: Add system zlib method for android
The same method that the BSDs use should also work for android. Also
update the tests and docs where appropriate.
2021-11-15 12:40:00 -05:00
Eli Schwartz 8947352889 fix various flake8 whitespace errors 2021-10-27 09:51:52 -04:00
Alan Coopersmith 8c02005595 dependencies: Add JDK system dependency for Solaris
Handle is_sunos() machines in __machine_info_to_platform_include_dir
2021-09-25 18:06:46 -07:00
Dylan Baker dd97ec607d dependencies: drop Dependency.methods and Dependency.get_methods()
Both of these are artifacts of the time before Dependency Factories,
when a dependency that could be discovered multiple ways did ugly stuff
like finding a specific dependency, then replacing it's own attributes
with that dependency's attributes. We don't have cases of that left in
the tree, so let's get rid of this code too
2021-07-13 16:43:14 -07:00
kira78 4f49fa8315
dependencies: Deterministic LLVM compile and link arg ordering (#8959)
* dependencies: Deterministic LLVM compile and link arg ordering

In LLVMDependencyConfigTool, the members compile_args and required_modules are
either converted to or stored as sets, which do not have a stable ordering. This
results in nondeterministic builds, particularly with required_modules causing
the order in which the LLVM libraries are linked in to the output binaries to
change across independent builds. As any guarantee about ordering for
compile_args is lost by being converted from a list to a set and back, and the
modules added to required_modules was even already sorted once, sort both when
converting them to lists.

* Use mesonlib.OrderedSet instead of sorting the sets.

Co-authored-by: Kaelyn Takata <kaelyn.alexi@protonmail.com>
2021-07-04 17:37:35 -07:00
Daniel Mensinger 3f889606c7 Split compiler detection from Environment
This moves all the compiler detection logic into the new
compilers.detect module. This dramatically reduces the size
and complexity of Environment.
2021-06-25 19:34:48 +02:00
Eli Schwartz 493dc6ed10
move base class for system dependencies into base.py
In accordance with review comments; it's small enough this seems fitting.
2021-06-17 13:22:25 -04:00
Dylan Baker 203a548d60 dependencies: Use the SystemDependency
This fixes these dependencies, which currently return the name of the
dependency as the type.

Fixes #8877
2021-06-14 09:09:32 -07:00
Daniel Mensinger 9c40b33cf6 compilers: Fix missing functions in Compiler base class 2021-06-09 09:46:37 +02:00
Daniel Mensinger 15b69d0421 typing: Fully annotate dependencies 2021-06-09 09:46:37 +02:00
Daniel Mensinger 95b70bcb97 deps: Split dependencies.base
Split the Factory and dependency classes out
of the base.py script to improve maintainability.
2021-06-03 10:23:27 -07:00
Dylan Baker 49b5037496 dependencies/zlib: System Dependency needs a clib_compiler on windows
Otherwise it'll except when it tries to get an attribute from None that
doesn't exist.
2021-05-28 09:26:38 -04:00
Tristan Partin 4c13aa30a1 dependency: Add JDK system dependency
The JDK system dependency is important for detecting JDK include paths
that may be useful when developing a JNI interface.
2021-04-12 10:43:11 -07:00
Eli Schwartz 6a0fabc647
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04 17:16:11 -05:00
Dylan Baker e8399c8c6e
depenencies/llvm: Handle llvm-config --shared-mode failing (#7379)
* depenencies/llvm: Handle llvm-config --shared-mode failing

Fixes: #7371
Fixes: #7878

* test cases/llvm: Refactor to use test.json

Instead of trying to cover everything internally
2020-10-22 17:21:14 +03:00
Dylan Baker cb6ccf2632 dependencies/zlib: Fix header detection
has_header returns a tuple of (found: bool, cached: bool), so `if
has_header` will always return true because the tuple is non-empty. We
need to check if the found value is true or not.
2020-09-29 14:58:32 -07:00
Jesse Natalie bca69aaf89 Fix VS Intellisense for projects which depend on LLVM found via CMake. 2020-04-12 12:26:17 +02:00
Jesse Natalie f655518545 Log when ignoring LLVM because dynamic was requested
Without this, there's tons of log output about finding LLVM, followed by "couldn't find LLVM."
2020-04-10 16:41:29 +03:00
Daniel Mensinger 673ca982f1 cmake: Add find_package COMPONETS support 2020-03-19 22:52:03 +02:00
Dylan Baker c1a3b37ab7 dependencies: Add a zlib system dependency for windows 2020-01-31 09:22:25 -08:00
Dylan Baker d87955f990 dependencies: Add system zlib method for freebsd and dragonflybsd
I've tested this on FreeBSD, and dragonfly's userland is close enough
I'm willing to call it good without testing. OpenBSD and NetBSD also
have a zlib in their base configurations, but I'm not confident enough
to enable those without testing.
2020-01-31 09:22:25 -08:00
Dylan Baker 5f51ee2fc8 dependencies: Add a zlib system dependency for macOS
This comes pre-installed, but currently we don't have a way to detect it
without relying on pkg-config or cmake. This is only valid with the
apple clang-based compilers, as they do some special magic to get
headers.
2020-01-31 09:22:25 -08:00
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