summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/detect.py
AgeCommit message (Collapse)Author
2025-12-18compilers: fix direction of cross-build testPaolo Bonzini
This used to be if for_machine is MachineChoice.BUILD and not is_cross: so it needed to be negated. This is also clearly wrong because "env.is_cross_build(for_machine)" has no effect - it is only true if for_machine is MachineChoice.HOST, in which case key.as_host() does nothing. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-11-19compilers: Remove Environment parameter from Compiler.sanity_checkDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.compiles()Dylan Baker
2025-11-19linkers: Store a reference to the Environment in the DynamicLinkerDylan Baker
For the same reason that the StaticLinker needs this, we need it in the DynamicLinker as well.
2025-11-19linkers: Store a reference to the Environment in the StaticLinkerDylan Baker
There are a number of places where we treat StaticLinker and Compiler as polymorphic, as such the StaticLinker cannot need extra parameters.
2025-11-19compilers: Stop passing `is_cross`Dylan Baker
This is calculated by `Environment().is_cross_build(for_machine)`. Since we have that in the Compiler class, just calculate it in the Compiler initializer
2025-11-19compilers: Pass Environment instead of MachineInfoDylan Baker
We end up needing it everywhere, so just store it. This patch is huge already, so it's just the conversion to passing Environment, more cleanups to come.
2025-11-14Add `os2_emxomf' option to generate OMF files on OS/2KO Myung-Hun
1. Generate OMF objs with `-Zomf' compiler flags 2. Generate OMF libs with `.lib' suffix using `emxomfar' as a librarian
2025-10-30Add ifx to list of Fortran compilers on WindowsMads Bach Villadsen
Intel's oneAPI installation, as of 2025.3, no longer provides the classic ifort compiler, only the newer llvm-based ifx compiler.
2025-10-29compilers: add Microchip XC32 compilerLiza Chevalier
The Microchip XC32 compiler is a GCC-based compiler implemented using existing GNU compiler classes. As the XC32 version and GCC version do not match mixins have been implemented to override versions used in versions checks where applicable.
2025-10-29environment: move detection functions to envconfig.pyPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-29compilers/asm: Move arch support check to initializerDylan Baker
It really isn't a sanity check that a specific compiler doesn't work on a specific platform. This re-implements the check as a shared component in the ASMCompiler base class, which has the advantage of code sharing.
2025-10-06compilers: do not use coredata.set_optionsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-06Revert "compilers/asm: Store the C Compiler inside the Assembly Compilers"Dylan Baker
This reverts commit 8847c938dd1c9e2c6e64e3050eb58f7ec54fccb3.
2025-10-06compilers/asm: Store the C Compiler inside the Assembly CompilersDylan Baker
Such as NASM and MASM. These compilers don't actually do any linking, the just produce object files. As such, we need the C compiler to link the program in order to make things like sanity_check work.
2025-09-06compilers: Enable out-of-the-box MSVC compatibility with ccacheL. E. Segovia
ccache has been for a long time compatible with MSVC (since 4.6) but when using debug mode, the /Z7 flag must be passed instead of /Zi. See https://ccache.dev/releasenotes.html#_ccache_4_6
2025-07-10compilers: move CFLAGS/CXXFLAGS handling to EnvironmentPaolo Bonzini
That is where env_opts are stored, so make the compiler call back directly into the environment. Suggested-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15coredata: remove unused argumentsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-04-16linkers: pass system to DynamicLinker.__init__ for Darwin linkersPaolo Bonzini
Apple linkers need to use different arguments on macOS and iOS-like platforms. Pass the system to the constructor so that it can be examined. Co-authored-by: Russell Keith-Magee <russell@keith-magee.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-04-02compilers: introduce get_exe() and get_exe_args()Paolo Bonzini
This will be used by rustdoc tests because the Test objects takes a single string for the command and everything else goes in the args. But apart from this, the need to split the executable from the arguments is common so create new methods to do it. While at it, fix brokenness in the handling of the zig compiler, which is checking against "zig" but failing to detect e.g. "/usr/bin/zig". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-03-12mesonbuild/compilers/detect.py: Support Open D ldc and dmdAndrei Horodniceanu
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2025-02-27compilers/detect: Split -beta and -nightly suffixes from rustcDylan Baker
Store both a full version with the nightly and beta suffixes, and the version as just X.Y.Z. This sort of distinction is why full_version exists. This fixes an issue with the bindgen module where we pass invalid version of X.Y.Z-beta and X.Y.Z-nightly.
2025-01-27compilers: Check if GCC has support for ObjC and/or ObjC++Dylan Baker
Since this is optional, we should not accept that GCC is a valid ObjC or G++ is a valid ObjC++ Compiler unless we've tested that they can actually do a basic compile. This requires fixing a number of tests that have broken assumptions. In some cases I've split tests where issues with one language would hide the other. It would be great if we had a competent test framework that allowed subtests to skip, unfortunately we have python's unittest instead. Because of that we can't avoid extra tests by use of subtests.
2025-01-09Add Linear ASM compilerWu, Zhenyu
Fix #13670
2025-01-08First draft version of Tasking MIL linking with b_lto and prelinkinggerioldman
2025-01-08Add TASKING compiler supportgerioldman
2024-12-19rust: raise a warning if clippy is used instead of rustcPaolo Bonzini
clippy-driver is not meant to be a general-purpose compiler front-end. Since Meson can now provide natively the ability to invoke clippy, raise a warning if someone uses it that way. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-09-30compilers/detect: remove unsupported -cpp flag for Clang preprocessor detectionRaul Tambre
Clang's resource files, e.g. /usr/share/clang/clang++.cfg, can be used to bump the default standard level across the system. However due to llvm/llvm-project#61641 `clang++ -std=c++17 -E -dM -` doesn't work. The workaround is to pass the language explicitly. 4ad792e158b6059eb847dd0562aff9bd7029981f fixed the issue by passing the language explicitly, but started passing the `-cpp` flag, which Clang doesn't support. Basically Clang would always fallback to the second detection attempt as a result. Remove the unsupported flag and the above scenarios works now too. 🙂 See-also: https://github.com/llvm/llvm-project/issues/61641 Fixes: 4ad792e158b6059eb847dd0562aff9bd7029981f
2024-09-14Fix various incorrect uses of `its` vs `it's`.Andrew McNulty
These errors can make reading comments and documentation unnecessarily confusing for users and contributors who do not speak English as their first language.
2024-09-11Fix typosspaette
2024-09-06fix LDFLAGS for cudaZihua Wu
LDFLAGS may contain flags that nvcc is unable to handle and these flags need to be processed before we pass them to nvcc
2024-08-23Use proper array form in swiftc.Jussi Pakkanen
2024-08-23Discard swiftc linker detect outputslimeuniverse
"swiftc -Xlinker -v tmp.swift" command used to detect swift linker creates junk files in working directory. This fix forwards output to /dev/null
2024-08-08Fix compiling ObjC/ObjC++ on Windows/MinGWJonathan Schleifer
Co-Authored-By: L. E. Segovia <amy@amyspark.me>
2024-07-28add initial support for llvm-flangH. Vetinari
2024-06-24compilers: make lang_map publicSam James
2024-06-24compilers: detect: fix pre-processor scraping by defining languageSam James
_get_gnu_compiler_defines and _get_clang_compiler_defines were broken by not defining the language they used. Neither GCC nor Clang infer the language based on the driver name which means `self.defines` isn't populated correctly in compilers/cpp.py. e.g. ``` $ echo "" | g++ -E -dM - | grep -i cplus $ echo "" | g++ -x c++ -E -dM - | grep -i cplus #define __cplusplus 201703L ``` Fix that by passing '-cpp -x LANGUAGE' as a first pass. If it fails, try again without '-cpp -x LANGUAGE' as before, as its portability isn't certain. We do '-cpp' because during testing, I found Fortran needs this, although per below, I had to drop Fortran in the end and leave it to the fallback (existing) path. Without this change, a63739d394dd77314270f5a46f79171a8c544e77 is only partially effective. It works if the system has injected Clang options via /etc/clang configuration files, but not by e.g. patching the driver (or for GCC there too). Unfortunately, we have to wimp out for Fortran and fallback to the old method because you need the language standard (e.g. -x f95).
2024-06-24compilers: detect: fix comment/error string in _get_gnu_compiler_definesSam James
Make the debug & error message strings consistent between the GCC and Clang probes. Copy-paste error. Here, we're scraping pre-processor tokens, not checking for the compiler type.
2024-06-24compilers: detect: fix typo in commentSam James
2024-05-22add cross-compile argument for ldc linker guessingAxel Ricard
2024-05-22fix sanity check for d cross-compilationAxel Ricard
2024-05-15Merge pull request #11421 from mon/ti-armclangJussi Pakkanen
Basic support for TI Arm Clang toolchain
2024-04-28Prefer Clang over GCC for Objective-C(++)Jonathan Schleifer
GCC only has very limited support for Objective-C and doesn't support any of the modern features, so whenever Clang is available, it should be used instead. Essentially, the only reason to ever use GCC for Objective-C is that Clang simply does not support the target system.
2024-04-26nasm: Fallback to native compiler when cross compilingXavier Claessens
If nasm is not defined in cross file binaries we can fallback to build machine nasm. When cross compiling C code we need a different gcc binary for native and cross targets, e.g. `gcc` and `x86_64-w64-mingw32-gcc`. But when cross compiling NASM code the compiler is the same, it is the source code that has to be made for the target platform. We can thus use nasm from build machine's PATH to cross compile for Windows on Linux for example. The difference is the arguments Meson will pass when invoking nasm e.g. `-fwin64`. That is already handled by NasmCompiler class.
2024-04-15Don't sanitize a None path when checking for, but could not find, ↵William D. Jones
unsupported cl clones.
2024-04-03Fix regression in TI CGT supportWill Toohey
When C6000 support was added in #12246, TI compilers were given the correct version argument. This broke the previous check which relied on an error being thrown by the compiler.
2024-03-15compilers: No need to pass exe_wrapper everywhereXavier Claessens
Places where compiler needs it already have access to Environment object and can use it directly. This fixes mypy complaining that not all compilers have self.exe_wrapper in run() method that got moved to base class.
2024-03-12Added support for Texas Instruments C6000 compiler.Petr Machacek
2024-03-10fix reconfigure subproject base optionsCharles Brunet
2024-03-01Fix base and compiler options not reconfigurable.Charles Brunet
Fixes #12920.