Commit Graph

343 Commits

Author SHA1 Message Date
Jussi Pakkanen b6af3f3810
Merge pull request #5833 from dcbaker/remove-compiler-type
Remove compiler type
2019-10-09 19:53:56 +03:00
Dylan Baker 65fc4149c5 environment: Detect sun4u and sun4v as sparc64
Solaris returns these values.

Fixes #6006
2019-10-09 19:49:57 +03:00
Dylan Baker afbed79baa compilers: replace uses of mesonlib.is_<os>() with self.info.is_<os>()
Since these are cross compilation safe, while the former is not.
2019-10-07 12:08:20 -07:00
Dylan Baker 0c22798b1a compilers: replace CompilerType with MachineInfo
Now that the linkers are split out of the compilers this enum is
only used to know what platform we're compiling for. Which is
what the MachineInfo class is for
2019-10-07 12:08:20 -07:00
Dylan Baker ff4a17dbef compilers: Add a specific type for AppleClangC
This allows us to detect use classes rather than methods to determine
what C standards are available.
2019-10-07 10:44:56 -07:00
Jussi Pakkanen 0b4d1e8afd Cross build is defined by the existance of a cross file. 2019-10-06 17:46:16 +03:00
Olexa Bilaniuk 2057ffccc3 Correct obviously-wrong test for gold linker. 2019-09-30 20:54:08 +03:00
Ting-Wei Lan 24bd029437 environment: LLVM 9 is now a stable release 2019-09-29 00:11:16 +08:00
Ting-Wei Lan 0390b673f1 Find clang-format with alternative names
This is similar to what we currently do for scan-build except there is
no environment variable to choose a specific clang-format to run. If an
environment variable is needed for better control, we can add it later.
2019-09-29 00:11:15 +08: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
Andrei Alexeyev 3fd460bce7 Fix GNU-like LLD being misdetected as MSVC-like LLD
Affects the latest version of the llvm-mingw toolchain
2019-09-27 08:20:07 -07:00
Ting-Wei Lan 74d5136e59 environment: Don't make special case for scan-build on Linux
Versioning of executables is not related to the operating system kernel.
It is possible for a Linux distribution to support multiple versions of
LLVM in a way similar to FreeBSD. For example, on Debian, you can use
'apt install clang-tools-7' to install the versioned 'scan-build-7'
executable without bringing the unversioned 'scan-build' into the
environment. Therefore, we should not skip the version list on Linux.
It also makes it consistent with the behavior of llvm dependency, which
does not change the search list depending on the operating system.

This commit also fixes the version suffix for Debian. Debian stops using
the minor version number on the executable after version 7, so it should
be 'scan-build-7', not 'scan-build-7.0'.

This is a follow-up of https://github.com/mesonbuild/meson/pull/5918.
2019-09-25 22:52:19 +03:00
Aleksey Gurtovoy 6ac5db50c9 CUDA support on Windows 2019-09-24 14:22:20 -07:00
Gabriel Ganne e7197895b2 uniform scan-build detection process
Detect scan-build the same way when trying to launch it and when
generating the target.
The detection method is:
  1. look within SCANBUILD env variable
  2. shutil.which('scan-build')
  3. *on non-linux platforms only*: go through all the possible
     name candidates and test them individually.

The third step is added following this comment
https://github.com/mesonbuild/meson/pull/5857#issuecomment-528305788
However, going through a list of all the possible candidates is neither
easily maintainable nor performant, and is therefore skipped on
platforms that should not require such a step (currently, only Linux
platforms).

This is a follow-up to the issue raised by @lantw44 during PR:
https://github.com/mesonbuild/meson/pull/5857
2019-09-14 05:51:36 +03:00
Alan Coopersmith 3d74987c81 compilers: Recognize Solaris 11.4 linker
Solaris 11.3 & earlier sent the --version output to stderr, but
Solaris 11.4 moved it to stdout in an attempt to be more compatible
with the GNU tools, so look for it in both streams of output.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-09-10 22:43:34 -07:00
Andrei Alexeyev d768a76ab2 Workaround for mingw-llvm linker (lld) misdetection
llvm-mingw uses a wrapper script to inject (among other things) a
-target argument into the clang command, which breaks -Wl,--version.
This confuses Meson into thinking the linker is some unknown version of
Apple ld, which breaks builds.

This patch makes it detect and recover from the issue.

Fixes #5910
2019-09-10 13:23:22 -07:00
Dylan Baker 15f8165bde environment: merge successive is_windows blocks 2019-09-09 21:22:26 -07:00
Dylan Baker 52aba19b17 environment: gcc/g++ and clang/clang++ are valid objc/objc++ compilers to try 2019-09-09 21:22:26 -07:00
Alan Coopersmith e5a67b4248 If ar is unrecognized, try gar for GNU ar
Needed on Solaris, where native ar doesn't recognize all the flags
that meson uses, but GNU ar does.
2019-09-09 21:22:26 -07:00
Jussi Pakkanen d67d5411bb
Merge pull request #5823 from scivision/linker-pgi-linux
PGI compiler fixes
2019-09-05 23:45:54 +03:00
Aleksey Gurtovoy 75daed27bc mesonlib.split_args/quote_arg/join_args 2019-09-05 23:42:47 +03:00
Michael Hirsch, Ph.D c8d380e4ef
PGI: use ar link wrapper on Windows 2019-09-05 11:50:17 -04:00
Kramer Peace caec875fe1 Create CUDA linker with CUDA compiler
Since they are laways paired there is no need to "search" for the cuda
linker.
2019-09-05 08:38:56 -07:00
Kramer Peace fb9a5ce867 Add a CUDA linker object
Fixes issue #5870
2019-09-05 08:38:56 -07:00
Dylan Baker cf55cd5c92 environment: clang uses lld-link or link.exe on windows 2019-08-30 00:01:32 +03:00
Dylan Baker 0efab591da compilers: Move the compiler argument to proxy linker flags to the compiler class
Instead of the DynamicLinker returning a hardcoded value like
`-Wl,-foo`, it now is passed a value that could be '-Wl,', or could be
something '-Xlinker='

This makes a few things cleaner, and will make it possible to fix using
clang (not clang-cl) on windows, where it invokes either link.exe or
lld-link.exe instead of a gnu-ld compatible linker.
2019-08-30 00:01:32 +03:00
Nirbheek Chauhan a107eab294 environment: Fix detection of MSVC arch on arm64
The regex was incorrect, so it was matching 'ARM64' with 'ARM'.
Make the regex more specific so that it matches:

Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27031.1 for x64
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27031.1 for x86
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27031.1 for ARM64
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86

etc.
2019-08-27 18:21:21 +03:00
nia 246b49fe75 Support NetBSD aarch64 and earm. 2019-08-23 13:10:25 -07:00
Dylan Baker 3fbb450166 environment: Detect dynamic linker class 2019-08-14 13:13:23 -07:00
Dylan Baker 29f351c05a environment: Handle OBJC[PP] clang detection like C[PP]
Which fixes using a non Apple clang for objc and objc++ on macOS.
2019-08-14 13:13:23 -07:00
Dylan Baker 1c455ee630 environment: Use a single function to check for ObjC and ObjC++
These two functions are different only in the classes that they use, a
couple of simple in-line ternaries takes care of that and reduces code
duplication.
2019-08-14 13:13:23 -07:00
Jussi Pakkanen f41bdae368 Add basic Webassembly support via Emscripten. 2019-08-05 19:31:32 +03:00
Jan Beich ddbf60f86d environment: simplify powerpc conditionals 2019-08-04 21:47:44 +03:00
Jan Beich 147d3f752c environment: simplify CPU logic via hw.machine_arch on BSDs 2019-08-04 21:47:44 +03:00
Michael Hirsch, Ph.D 7aecfb1540 remove unreachable code 2019-08-02 14:31:22 +03:00
Michael Hirsch, Ph.D 041de5814f BUGFIX: typo from 32e827dcdc broke PGI compilers 2019-07-06 00:26:59 +03:00
Charlie Barto 1e182b51c6 Improve performance with windows defender ATP 2019-07-05 21:59:15 +03:00
Michael Hirsch, Ph.D 838c8d642c BUGFIX: typo for PGI C/CPP 2019-06-24 14:06:32 -04:00
Michael Hirsch, Ph.D 5b109c9ad2 correct missing argument for IntelClFortranCompiler
ifort passes all tests

cleanup logic
2019-06-24 14:06:32 -04:00
Dylan Baker 56f7e5c74f coredata: Correctly handle receiving a pipe for native/cross files
* coredata: Correctly handle receiving a pipe for native/cross files

In some cases a cross/native file may be a pipe, such as when using bash
process replacement `meson --native-file
<([binaries]llvm-config='/opt/bin/llvm-config')`, for example. In this
case we copy the contents of the pipe into a file in the meson-private
directory so we can create a proper ninja dependency, and be able to
reload the file on --wipe/--reconfigure. This requires some extra
negotiation to preserve these native/cross files.

Fixes #5505

* run_unitests: Add a unit test for native files that are pipes

Using mkfifo.
2019-06-23 17:53:17 +03:00
Dylan Baker b972ee7125 environment: Fix detection of Microsoft cl.exe with non English locales
This uses the fix as suggested in issue 5491, which it also fixes.

Fixes #5491
2019-06-21 15:50:06 +03:00
Alan Coopersmith a35844c08d Canonicalize 'i86pc' return from platform.machine() for Solaris
i86pc may be either 32-bit or 64-bit, so use existing compiler checks
to determine if it should return 'x86' or 'x86_64'.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-06-19 00:04:17 +03:00
Kurtis Rader e06f0e6aaf Solaris fixes
Fixes #5351
2019-06-12 14:14:57 +03:00
Dan Kegel b28e76f6bf environment: better xcode 11 clang detection
Fixes #5474
2019-06-11 10:13:50 -07: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
John Ericson 32e827dcdc Use `env.machines.*` to avoid some `is_cross`
This is a small example of the `is_cross` removal the that abstraction
enables.
2019-06-09 13:13:20 -04:00
Marcel Hollerbach d6407445b9 backend: refactor get_custom_target_provided_libraries
the problem here is, that get_custom_target_provided_libraries iterated
over all generated sources of a target. In each output we check if this
is a library or not. In projects like EFL we have added a lot of
generated target to many different targets, so the iterating of the
output is rather consistent, with this commit we drop from 19% of the
time spending in get_custom_target_provided_libraries down to 3.51%.
2019-06-03 20:37:27 +03:00
Jussi Pakkanen ef024583df
Merge pull request #5276 from dcbaker/pkg-config-path-invalidate-cache
coredata: add pkg_config_path to depedency cache key
2019-05-20 22:50:12 +03:00
Jon Turney fb35e6faac Remove compiler data from build object
The actual data is in Coredata (which is serialized) and we just held a
reference in Build for (in)convenience.
2019-05-20 11:29:17 -07:00
Dylan Baker 5df6823bd8 coredata: Introduce a class to act as the dependency cache
Handling the PKG_CONFIG_PATH variable in meson introduces a new problem
for caching dependencies. We want to encode the pkg_config_path (or
cross_pkg_config_path if we're cross compiling) to be part of the key,
but we don't want to put that into the key for non-pkg-config
dependencies to avoid spurious cache misses (since pkg_config_path isn't
relevant to cmake, for example). However, on a cache lookup we can't
know that a dependency is a pkg-config dependency until we've looked in
the cache.

My solution is a two layer cache, the first layer remains the same as
before, the second layer is a dict-like object that encapsulates the
dependency type information and uses pkg_config_path and
cross_pkg_config_path as a sub key (and could be extended easily for
other types). A new object type is introduced to encapsulate this so
that callers don't need to be aware of the implementation details.
2019-05-17 12:26:20 -07:00