Commit Graph

408 Commits

Author SHA1 Message Date
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
Dylan Baker 48f3e72493 linkers: Update the linker names to be more consistent
This makes two basic changes, 1 it moves the name of the linker into the
linker class, this should reduce the number of errors and typos, and
ensure that a linker always has one name. This then renames the linkers
to have more consistent names.

Posix/gnu linkers are called ld.<name>: ld.gold, ld.lld, ld.solaris.

Apple linkers are renamed ld64.
2020-02-21 05:15:25 +05:30
Michael Hirsch, Ph.D c2e6565029
add meson.get_native_property for native files
This allows Meson native-file [properties] to be used.
This avoids the need to call meson from a script file or have a
long command line invocation of `meson setup`

The method meson.get_native_property('prop', 'fallback') is added.
The native file can contain properties like

```
[properties]
myprop1 = 'foo'
mydir2 = 'lib/custom'
```

Then from within `meson.build`

```meson
x1 = meson.get_native_property('myprop1')

thedir = meson.get_native_property('mydir2', 'libs')
```

fallback values are optional
2020-02-05 13:23:55 -05:00
Dylan Baker 7097d8a021 environment: Handle cases of no cs compiler being installed correctly 2020-02-04 20:47:49 +02:00
Dylan Baker 97dd522476 environment: Be stricter about detecting icl
Only detect a compiler as icl if the name is "icl" or "icl.exe"
2020-02-03 09:14:46 -08:00
makise-homura ee6c2c87fc Bringing back defines in Elbrus C compiler to simplify environment.py 2020-01-27 22:37:21 +03:00
makise-homura 7ca53e40a3 ObjC/ObjC++ compilers are not available for Elbrus, so don't fail 2020-01-27 22:35:26 +03:00
makise-homura 7321cc776a Fix missing 'defines' argumet for Elbrus compiler
...But somehow it still remains in C++ compiler.
2020-01-27 22:35:26 +03:00
Dylan Baker a55e3434c5 environment: Fix initialization of compilers that don't use a
_guess_linker method

Fixes #6448
2020-01-23 01:59:31 +02:00
Dylan Baker 255fa5a320 tests: Add a test case for finding ld 2020-01-22 23:39:33 +02:00
Dylan Baker 730a7b296f environment: Replace LD with <LANG>LD
The rust code is ugly, because rust is annoying. It doesn't invoke a
linker directly (unless that linker is link.exe or lld-link.exe),
instead it invokes the C compiler (gcc or clang usually) to do it's
linking. Meson doesn't have good abstractions for this, though we
probably should because some of the D compilers do the same thing.
Either that or we should just call the c compiler directly, like vala
does.

This changes the public interface for meson, which we don't do unless we
absolutely have to. In this case I think we need to do it. A fair number
of projects have already been using 'ld' in their cross/native files to
get the ld binary and call it directly in custom_targets or generators,
and we broke that. While we could hit this problem again names like
`c_ld` and `cpp_ld` are far less likely to cause collisions than `ld`.
Additionally this gives a way to set the linker on a per-compiler basis,
which is probably in itself very useful.

Fixes #6442
2020-01-22 23:39:33 +02:00
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Dylan Baker a8caf988c6 environment: Fix detection of icc on macOS
Which wouldn't call the function to detect c_args and friends.
2020-01-07 00:51:29 +02:00
Jussi Pakkanen 7ec3af95e5
Updated linker MR (#6407)
* environment: Fix passing always args to a number of less common linkers

These are mostly (oops xilink) proprietary linkers I can't use for
various reasons.

Fixes: #6332

* Add intelfix from scivision.

* Ifort fix from scivision.

* PGI fix from scivision.

* Cuda fix from scivision.

* Fix linker passing for armclang.
2020-01-06 16:49:34 +02:00
Dylan Baker 47dfe34c85 Consider compiler arguments in linker detection logic
If a user passes -fuse-ld=gold to gcc or clang, they expect that they'll
get ld.gold, not whatever the default is. Meson currently doesn't do
that, because it doesn't pass these arguments to the linker detection
logic. This patch fixes that. Another case that this is needed is with
clang's --target option

This is a bad solution, honestly, and it would be better to use $LD or a
cross/native file but this is needed for backwards compatability.

Fixes #6057
2019-12-12 10:57:27 -08:00
Dylan Baker 87766b3727 Allow setting <lang>_args before the compiler is detected
This is required to be able to pass compiler and linker arguments to the
methods that try to guess what linker to use.
2019-12-12 10:52:07 -08:00
Jussi Pakkanen 17dd9e5bff
Merge pull request #6207 from dcbaker/linker-option
Add a way to select the dynamic linker meson uses
2019-12-11 23:29:33 +02:00
Jussi Pakkanen 63bea704dd Clean stray .o file that LDC creates during tests. 2019-12-05 21:06:58 +02:00
Dylan Baker d856118006 environment: Fix selecting the linker with rustc 2019-12-03 13:08:42 -08:00
Dylan Baker 8091b4c744 Intel: Dump worthless Xild abstractions
This dumps xild on mac and linux. After a lot of reading and banging my
head I've discovered we (meson) don't care about xild, xild is only
useful if your invoke ld directly (not through icc/icpc) and you want to
do ipo/lto/wpo. Instead just make icc report what it's actually doing,
invoking ld or ld64 (for linux and mac respectively) directly. This
allows us to get -fuse-ld working on linux.
2019-12-03 13:08:42 -08:00
Dylan Baker 0ae911d893 environment: Add a special error case for getting GNU link.exe
Since I spent three days banging my head against this it seems
reasonable that other people might also run into this problem. It can
happen if you're trying to use microsoft's link.exe, but also have the
dmd bin directory at the tail of your %PATH%, among other reasons.
2019-12-02 16:39:06 -08:00
Dylan Baker ab5ea9e8b6 environment: unify platform detection logic
I noticed this while I was here, it's not much, just a small cleanup to
the platform detection logic.
2019-12-02 16:39:06 -08:00
Dylan Baker 8761ca7b7d environment: Remove duplicate argument from _guess_nix_linker
Since we pass the whole compiler class (as a type()) we don't need to
also pass it's LINKER_PREFIX attribute, we can just get it from the
type we're passing.
2019-12-02 16:39:06 -08:00
Dylan Baker ef9aeb188e Allow selecting the dynamic linker
This uses the normal meson mechanisms, an LD environment variable or via
cross/native files.

Fixes: #6057
2019-12-02 16:39:06 -08:00