Commit Graph

431 Commits

Author SHA1 Message Date
Paolo Bonzini 492afe50a4 environment: use ExternalProgram to find ninja
This allows the NINJA environment variable to support all the Windows special
cases, especially allowing an absolute path without extension.

Based on a patch by Yonggang Luo.

Fixes: #7659
Suggested-by: Nirbheek Chauhan <nirbheek@centricular.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-04 15:38:12 +02:00
Matt Madison 3eab43136c environment: do not raise exception in detect_cuda_compiler
when the compiler is not a string.  When the compiler
is set in the build configuration (required, for example,
in a cross-build setup), the compiler setting is already
a list, which is the desired type.

Signed-off-by: Matt Madison <matt@madison.systems>
2020-09-02 17:48:39 +02:00
Christoph Reiter 0710ad18d9 Be stricter when detecting Windows/Cygwin
This removes the check for "mingw" for platform.system(). The only case I know
where "mingw" is return is if using a msys Python under a msys2 mingw environment.
This combination is not really supported by meson and will result in weird errors,
so remove the check.

The second change is checking sys.platform for cygwin instead of platform.system().
The former is document to return "cygwin", while the latter is not and just
returns uname().

While under Cygwin it uname() always starts with "cygwin" it's not hardcoded in MSYS2
and starts with the environment name. Using sys.platform is safer here.

Fixes #7552
2020-08-30 23:37:46 +03:00
Jussi Pakkanen 3a25efc056
Merge pull request #7581 from peterh/aix
Add AIX support
2020-08-25 23:58:17 +03:00
Jussi Pakkanen fc13c90de3
Merge pull request #7600 from alexrp/master
Add C2x option support.
2020-08-23 00:26:44 +03:00
Jussi Pakkanen a9f33d96c6
Merge pull request #7609 from dcbaker/submit/2020-08/cmake-fix-apple-clang
Fix mapping of apple compilers in cmake
2020-08-22 22:40:44 +03:00
Dylan Baker b6c28d282c compilers: Add Apple subclasses for ObjC and ObjC++
These are needed because in some cases we need to be able to know if
we're using vanilla clang or Apple's clang.
2020-08-22 10:49:35 -07:00
Alex Rønne Petersen 9f338e41b0 Update LLVM tool versions for LLVM/Clang 10. 2020-08-22 18:57:09 +02:00
Jussi Pakkanen c42298e146
Merge pull request #7447 from scivision/nvc
Add support for NVidia HPC SDK compilers
2020-08-22 18:31:56 +03:00
Peter Harris 0f90299b1c aix: allow both 32-bit and 64-bit objects in a static library
Without the -Xany flag, the ar command will complain when an .o file is
compiled for the non-default bit width. This change is necessary to allow
64-bit builds via a native (or cross) file.
2020-08-12 21:13:07 -04:00
Peter Harris abe72d5c84 aix: detect and support the AIX dynamic linker 2020-08-12 21:13:07 -04:00
Peter Harris 45a12d28b9 aix: fix cpu family detection
Like the BSDs, AIX does not return anything useful in platform.machine().
2020-08-12 19:56:01 -04:00
Elad Lahav 1ddd2b4cbe Use uname -p to detect x86_64 on QNX. 2020-08-08 15:43:57 -07:00
Zbigniew Jędrzejewski-Szmek 6006987ce5 "Downgrade" warning when regenerating after version bump
There is nothing to "warn" about, this is a completely routine
occurence. OTOH, when something is corrupted, we should warn. Keep
the red color and "WARNING:" prefix in that case.

Example output:
$ ninja -C build
Regenerating configuration from scratch: Build directory has been generated with Meson version 0.55.999, which is incompatible with current version 0.56.0.
The Meson build system
Version: 0.56.0
...
2020-08-04 17:15:37 +03:00
John Ericson 2447a1132a Capitalize some constants in coredata
I've been getting confused between them and similarly-named other
things, so I figured it was high time to clean this up.
2020-08-04 00:24:05 +03:00
Antony Chan 70edf82c6c Make meson recognize the Qualcomm LLVM toolchain
Meson calls `path/to/clang++ --version` to guess which build toolchain the
user has picked to build the source code. For the Qualcomm LLVM toolchain,
the output have an unusual output as shown below:

```
clang version 8.0.12
Snapdragon LLVM ARM Compiler 8.0.12 (based on llvm.org 7.0+)
Target: arm-unknown-linux-gnueabi
Thread model: posix
Repository: (ssh://git-hexagon-aus.qualcomm.com:...)
InstalledDir: /pkg/qct/software/llvm/release/arm/8.0.12/bin
```

Another unusual pattern is the output of `path/to/ld.qcld --version`:

```
ARM Linker from Snapdragon LLVM ARM Compiler Version 8.0.12
ARM Linker based on LLVM version: 8.0
```

The Meson logic is modified accordingly so that Meson can correctly
determine toolchain as "LLVM aarch64 cross-compiler on GNU/Linux64 OS".

This is the expected output of
`meson --native-file native_file.ini --cross-file cross_file.ini build/aarch64-debug/`:

```
...
C++ compiler for the host machine: ... (clang 8.0.12 "clang version 8.0.12")
C++ linker for the host machine: ... ld.lld 8.0.12
...
```
2020-08-02 10:39:44 -07:00
Dylan Baker 591e6e94b9 Put machine file and cmd line parsing in Environment
This creates a full set of option in environment that mirror those in
coredata, this mirroring of the coredata structure is convenient because
lookups int env (such as when initializing compilers) becomes a straight
dict lookup, with no list iteration. It also means that all of the
command line and machine files are read and stored in the correct order
before they're ever accessed, simplifying the logic of using them.
2020-08-01 22:00:06 -07:00
Dylan Baker 601789cc7c machine-files: deprecate the paths section 2020-08-01 22:00:06 -07:00
Dylan Baker bbba6a7f36 Allow setting built-in options from cross/native files
This is like the project options, but for meson builtin options.

The only real differences here have to do with the differences between
meson builtin options and project options. Some meson options can be set
on a per-machine basis (build.pkg_config_path vs pkg_config_path) others
can be set on a per-subproject basis, but should inherit the parent
setting.
2020-08-01 22:00:06 -07:00
Dylan Baker a6164ca5a8 Allow setting project options from cross or native files
This allows adding a `[project options]` section to a cross or native file
that contains the options defined for a project in it's meson_option.txt
file.
2020-07-30 19:34:37 -07:00
Mark Hindley cc201a5396 Support armel/armhf builds on native arm64 hosts. 2020-07-30 12:04:54 -07:00
Michael Hirsch, Ph.D f985bb7383
add Nvidia HPC SDK compilers 2020-07-13 00:16:52 -04:00
Alan Coopersmith 20d405ec18 SolarisDynamicLinker: report ld's version instead of gcc's
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-07 22:08:52 -07:00
Xavier Claessens b510d644fe find_program: Do not use fallback when before parsing project()
Mesa is doing `project(... find_program() ...)` so
environment.wrap_resolver is not defined yet.
2020-07-04 13:57:51 +03:00
Marvin Scholz 85686e21d7 environment: Correctly detect arm64 as aarch64
On some systems aarch64 is reported as arm64. Due to mesons
mangling of everything that starts with arm, it would end up being
detected as arm (which implies 32 bit) which is incorrect.
2020-07-02 20:03:24 +03:00
Xavier Claessens 1c8731a100 envconfig: Add [constants] section in machine files
Machine files already supports `+` operator as an implementation detail,
since it's using eval(). Now make it an officially supported feature and
add a way to define constants that are used while evaluating an entry
value.
2020-06-29 20:16:21 +03:00
Cary Converse a198e5d191 coverage: llvm-cov support 2020-06-17 23:02:50 -04:00
Michael Hirsch 0b9e8e39dd environment: fallback regex for versions like 2020.01
add four-digit version unit_test cases
2020-06-15 10:06:34 -07:00
Eric Dodd 71d68a940b Updated to resolve issue identifying SGI CPUs on IRIX systems 2020-06-10 22:16:14 +03:00
Yevhenii Kolesnikov 9dc3ca2c1c compilers: add fetching of define list for clang
Simmilar to gcc, the list of pre-processor defines can be fetched with
`-dM -E` option. The way cpu_family is determined on linux relies on
this list.

Fixes incorrect value of cpu_family on linux, when crosscompiling:

```
CC="clang -m32" meson ./build
```

Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2020-05-22 16:58:12 +03:00
Ole André Vadla Ravnås 859dc4255a Fix outdated cross-compilation checks 2020-05-13 15:51:54 +00:00
Andrei Alexeyev c4960cefb0 Improve Emscripten linker version detection 2020-05-10 20:06:02 +03:00
Michael c53b637959 switch python2 %s for python3 .format 2020-04-21 00:16:21 +03:00
John Ericson 278c294aa4 Compiler options per lang
A current rather untyped storage of options is one of the things that
contributes to the options code being so complex. This takes a small
step in synching down by storing the compiler options in dicts per
language.

Future work might be replacing the langauge strings with an enum, and
defaultdict with a custom struct, just like `PerMachine` and
`MachineChoice`.
2020-04-20 23:23:15 +03:00
Dylan Baker 8bdc5c2dd5 environment: "power machintosh" is ppc
I've combined the two ppc checks into one, since they're not very
complicated and added power machintosh, which is used by PPC macs
running older versions of osx.

Fixes: #6746
2020-03-29 20:54:12 +03:00
Martin Storsjö b3fe9fa5d8
Clarify a workaround for older versions of LLD for MinGW (#6836) [skip ci]
The previous diagnosis (that the wrapper that injects the -target
option to clang caused the issues) doesn't seem right; the issue
was that LLD's MinGW frontend (which is invoked when ld.lld is given
a COFF argument to the -m option) didn't handle the --version argument
before LLD 9.0.0.
2020-03-24 08:36:52 -07:00
John Ericson 3a4388e51d Fix legacy env var support with cross
Fix #3969
2020-03-23 17:51:36 +02:00
alanNz 7460292810 -Add xc16 and c2000 C,Cpp toolchain support 2020-03-21 00:47:24 +02:00
Andrei Alexeyev b521c65de6 Fix bogus parameter passed to LLVMDynamicLinker (llvm-mingw regression) 2020-03-19 09:38:26 -07:00
Jussi Pakkanen 88e40c7081
Merge pull request #6356 from dcbaker/fix-d-compiler-abstractions
Fix d compiler abstractions
2020-03-12 00:57:52 +02:00
Luca Bacci 1bd1f98086 Improve regular expression for MSVC compiler target arch detection
Did not work for some MSVC output language combinations.
Now should work for every locale / output language.

Fixes issue #6757
2020-03-10 07:50:54 +00:00
Dylan Baker 23b5f9b351 linkers: Allow optlink to be invoked indirectly 2020-03-09 16:55:08 -07:00
Dylan Baker fe86c594c6 Allow invoking the linker directly through dmd
DMD is awful in a lot of ways. To change the linker you set an
environment variable, which is pretty much impossible for us.
2020-03-09 16:55:08 -07:00
Dylan Baker 1fe153a3a5 Allow invoking link.exe and lld-link.exe through ldc2
Like it wants
2020-03-09 13:19:03 -07:00
Jussi Pakkanen 7234316dc7
Merge pull request #6688 from dcbaker/emcc-linker-bugs
Emcc linker bugs and improvments
2020-03-08 14:04:48 +02:00
Dylan Baker 175f12ac89 environment: Strip 'el' from the end of mips architectures
Mips architectures may have `el` on the end, to differentiate the little
endian from the big endian variants. We don't encode endianness in the
cpu names, so ensure we've stripped that.

Fixes #6655
2020-02-29 00:37:17 +02:00
Jan Alexander Steffens (heftig) 2ba8fe6af0 environment: Fix construction of CudaLinker
The 0.53.2 test suite has a new failure:

    Traceback (most recent call last):
      File "run_project_tests.py", line 1024, in <module>
        detect_system_compiler()
      File "run_project_tests.py", line 964, in detect_system_compiler
        comp = env.compiler_from_language(lang, MachineChoice.HOST)
      File "/build/meson/src/meson-0.53.2/mesonbuild/environment.py", line 1565, in compiler_from_language
        comp = self.detect_cuda_compiler(for_machine)
      File "/build/meson/src/meson-0.53.2/mesonbuild/environment.py", line 1131, in detect_cuda_compiler
        linker = CudaLinker(compiler, for_machine, 'nvlink', CudaCompiler.LINKER_PREFIX, [], version=CudaLinker.parse_version())
      File "/build/meson/src/meson-0.53.2/mesonbuild/linkers.py", line 963, in __init__
        super().__init__('nvlink', *args, **kwargs)
    TypeError: __init__() takes 6 positional arguments but 7 positional arguments (and 1 keyword-only argument) were given

Fixes: c708c52ca2 ("linkers: Update the linker names to be more consistent")
2020-02-28 10:07:26 -08:00
Dylan Baker 654f427759 compilers/linkers: Add a representation for wasm-ld
Emscripten does have a stand alone linker, wasm-ld. This patch adds the
linker, adds detection for the linker, and removes the IsLinkerMixin for
emscripten. This is a little more correct, and makes the code a lot
cleaner and more robust.
2020-02-27 16:35:02 -08:00
Jussi Pakkanen 9c604320a0
Merge pull request #6637 from mesonbuild/nirbheek/implement-symbolextractor-windows
Implement symbolextractor on windows + some cleanups/fixes
2020-02-23 20:23:03 +02:00
Nirbheek Chauhan be486a2ec8 ninjabackend: List PDBs in output list for targets
This is more correct, and forces the target(s) to be rebuilt if the
PDB files are missing. Increases the minimum required Ninja to 1.7,
which is available in Ubuntu 16.04 under backports.

We can't do the same for import libraries, because it is impossible
for us to know at configure time whether or not an import library will
be generated for a given DLL.
2020-02-22 06:49:34 +05:30