summaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
Commit message (Collapse)AuthorAgeFilesLines
...
* compilers: add fetching of define list for clangYevhenii Kolesnikov2020-05-221-1/+25
| | | | | | | | | | | | | | | 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>
* Fix outdated cross-compilation checksOle André Vadla RavnÄs2020-05-131-10/+10
|
* Improve Emscripten linker version detectionAndrei Alexeyev2020-05-101-6/+9
|
* switch python2 %s for python3 .formatMichael2020-04-211-4/+4
|
* Compiler options per langJohn Ericson2020-04-201-2/+2
| | | | | | | | | | | 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`.
* environment: "power machintosh" is ppcDylan Baker2020-03-291-4/+2
| | | | | | | | 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
* Clarify a workaround for older versions of LLD for MinGW (#6836) [skip ci]Martin Storsjö2020-03-241-1/+3
| | | | | | | 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.
* Fix legacy env var support with crossJohn Ericson2020-03-231-17/+18
| | | | Fix #3969
* -Add xc16 and c2000 C,Cpp toolchain supportalanNz2020-03-211-1/+35
|
* Fix bogus parameter passed to LLVMDynamicLinker (llvm-mingw regression)Andrei Alexeyev2020-03-191-1/+1
|
* Merge pull request #6356 from dcbaker/fix-d-compiler-abstractionsJussi Pakkanen2020-03-121-36/+54
|\ | | | | Fix d compiler abstractions
| * linkers: Allow optlink to be invoked indirectlyDylan Baker2020-03-091-1/+1
| |
| * Allow invoking the linker directly through dmdDylan Baker2020-03-091-11/+21
| | | | | | | | | | DMD is awful in a lot of ways. To change the linker you set an environment variable, which is pretty much impossible for us.
| * Allow invoking link.exe and lld-link.exe through ldc2Dylan Baker2020-03-091-24/+32
| | | | | | | | Like it wants
* | Improve regular expression for MSVC compiler target arch detectionLuca Bacci2020-03-101-1/+1
| | | | | | | | | | | | | | Did not work for some MSVC output language combinations. Now should work for every locale / output language. Fixes issue #6757
* | Merge pull request #6688 from dcbaker/emcc-linker-bugsJussi Pakkanen2020-03-081-1/+11
|\ \ | |/ |/| Emcc linker bugs and improvments
| * compilers/linkers: Add a representation for wasm-ldDylan Baker2020-02-271-1/+11
| | | | | | | | | | | | | | 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.
* | environment: Strip 'el' from the end of mips architecturesDylan Baker2020-02-291-0/+6
| | | | | | | | | | | | | | | | 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
* | environment: Fix construction of CudaLinkerJan Alexander Steffens (heftig)2020-02-281-1/+1
|/ | | | | | | | | | | | | | | | | | | 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: c708c52ca225 ("linkers: Update the linker names to be more consistent")
* Merge pull request #6637 from ↔Jussi Pakkanen2020-02-231-2/+2
|\ | | | | | | | | mesonbuild/nirbheek/implement-symbolextractor-windows Implement symbolextractor on windows + some cleanups/fixes
| * ninjabackend: List PDBs in output list for targetsNirbheek Chauhan2020-02-221-2/+2
| | | | | | | | | | | | | | | | | | | | 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.
* | linkers: Update the linker names to be more consistentDylan Baker2020-02-211-13/+13
|/ | | | | | | | | | | 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.
* add meson.get_native_property for native filesMichael Hirsch, Ph.D2020-02-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* environment: Handle cases of no cs compiler being installed correctlyDylan Baker2020-02-041-0/+2
|
* environment: Be stricter about detecting iclDylan Baker2020-02-031-1/+1
| | | | Only detect a compiler as icl if the name is "icl" or "icl.exe"
* Bringing back defines in Elbrus C compiler to simplify environment.pymakise-homura2020-01-271-10/+4
|
* ObjC/ObjC++ compilers are not available for Elbrus, so don't failmakise-homura2020-01-271-5/+13
|
* Fix missing 'defines' argumet for Elbrus compilermakise-homura2020-01-271-4/+11
| | | | ...But somehow it still remains in C++ compiler.
* environment: Fix initialization of compilers that don't use aDylan Baker2020-01-231-0/+5
| | | | | | _guess_linker method Fixes #6448
* tests: Add a test case for finding ldDylan Baker2020-01-221-3/+3
|
* environment: Replace LD with <LANG>LDDylan Baker2020-01-221-26/+40
| | | | | | | | | | | | | | | | | | | | | 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
* types: import typing as T (fixes #6333)Daniel Mensinger2020-01-081-12/+13
|
* environment: Fix detection of icc on macOSDylan Baker2020-01-071-6/+3
| | | | Which wouldn't call the function to detect c_args and friends.
* Updated linker MR (#6407)Jussi Pakkanen2020-01-061-10/+19
| | | | | | | | | | | | | | | | | | | * 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.
* Consider compiler arguments in linker detection logicDylan Baker2019-12-121-3/+13
| | | | | | | | | | | | | 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
* Allow setting <lang>_args before the compiler is detectedDylan Baker2019-12-121-0/+1
| | | | | This is required to be able to pass compiler and linker arguments to the methods that try to guess what linker to use.
* Merge pull request #6207 from dcbaker/linker-optionJussi Pakkanen2019-12-111-102/+155
|\ | | | | Add a way to select the dynamic linker meson uses
| * environment: Fix selecting the linker with rustcDylan Baker2019-12-031-28/+37
| |
| * Intel: Dump worthless Xild abstractionsDylan Baker2019-12-031-7/+6
| | | | | | | | | | | | | | | | | | 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.
| * environment: Add a special error case for getting GNU link.exeDylan Baker2019-12-021-0/+5
| | | | | | | | | | | | | | 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.
| * environment: unify platform detection logicDylan Baker2019-12-021-4/+2
| | | | | | | | | | I noticed this while I was here, it's not much, just a small cleanup to the platform detection logic.
| * environment: Remove duplicate argument from _guess_nix_linkerDylan Baker2019-12-021-32/+27
| | | | | | | | | | | | 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.
| * Allow selecting the dynamic linkerDylan Baker2019-12-021-80/+126
| | | | | | | | | | | | | | This uses the normal meson mechanisms, an LD environment variable or via cross/native files. Fixes: #6057
| * Fix detection of D linker in MSVC environmentsDylan Baker2019-12-021-4/+5
| | | | | | | | | | | | | | Rather than trying to figure out if we're using MSVC based on environment variables, then trying to get the C compiler and test some attributes, get the C compiler and see if it's MSVC. This is much more reliable and we were already doing it anyway.
* | Clean stray .o file that LDC creates during tests.Jussi Pakkanen2019-12-051-0/+8
|/
* Fix regular expression for MSVC target arch detectionLuca Bacci2019-11-301-1/+1
| | | | | | | Make it work regardless of MSVC output language Fixes #6128 See PR #6265
* Fix cross-compilation of D programsEric Le Bihan2019-11-191-71/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since version 9.1, GCC provides support for the D programming language. Thus it is easy to build a cross-compiler for D, such as aarch64-unknown-linux-gnu-gdc. However to cross-compile a Meson project using D, using a cross build definition such as the following is not enough: ``` [binaries] d = '/path/to/aarch64-unknown-linux-gnu-gdc' exe_wrapper = '/path/to/qemu-aarch64-static' [properties] needs_exe_wrapper = true [host_machine] system = 'linux' cpu_family = 'aarch64' cpu = 'cortex-a53' endian = 'little' ``` Indeed, "exe_wrapper" is not be taken into account. Build will fail with: ``` Executables created by D compiler /path/to/aarch64-uknown-linux-gnu-gdc are not runnable. ``` This patch fixes this by reworking: - detect_d_compiler() to properly get exe_wrapper and D compilers and detect the one available. - Dcompiler to properly handle exe_wrapper.
* environment: Only check compiler basename for compiler nameJan Tojnar2019-11-161-4/+6
| | | | | | | | Nix uses absolute paths to compilers in Nix store with Meson. Those store paths contain a hash, which can contain short strings like icl, resulting in incorrectly matching the compiler. https://github.com/NixOS/nixpkgs/issues/73417#issuecomment-554077964
* Raise an exception if we cannot detect the MSVC compiler target architectureLuca Bacci2019-11-121-2/+4
|
* Fix typos found by codespellWolfgang Stöggl2019-11-061-3/+3
| | | | - Typos were found by codespell v1.16.0