aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/cmake
AgeCommit message (Collapse)AuthorFilesLines
2025-07-18cmake: Use the `cm\_` prefix for names starting with digitsKonstantin Seurer1-1/+1
Avoids errors like `ERROR: Invalid variable name: 16bit_arithmetic_dir`.
2025-07-09Add -F compiler flag for included MacOS frameworksmattbsage1-0/+1
Currently, when using frameworks on MacOS systems, Meson will send the appropriate flags to the linker but fails to pass flags to the compiler, resulting in the headers not being found for the included frameworks. This patch adds the required "-F{framework}" flag to the compiler options, so that the compiler can find the headers of included frameworks. See: https://github.com/mesonbuild/meson/issues/14641
2025-06-03cmake: Fix target_link_libraries against project targetsL. E. Segovia2-5/+23
These were supported for shared libraries, but for static libraries the link_with property was never populated with `LINK_LIBRARIES` or `INTERFACE_LINK_LIBRARIES`. Fixes #13101
2025-05-23cmake: Fix toolchain including unsupported languagesL. E. Segovia2-2/+8
The most egregious cases are Nasm (which needs to be transformed to `ASM_NASM`) and Rust (which is not yet supported by CMake). See https://cmake.org/cmake/help/v4.0/command/project.html
2025-04-05cmake/interpreter: Don't add __CMake_build to includesTomi LÀhteenmÀki1-2/+1
Don't add "<project_source_dir>/<subproject>/__CMake_build" directory to include directories. Fixes #12351
2025-04-04cmake: filter and order clib_compiler languagesAndrei Alexeyev1-6/+11
2025-04-04cmake: pass clib_compiler to resolve_cmake_trace_targets()Andrei Alexeyev1-1/+7
This is required to resolve ambiguous LINK_LIBRARIES passed as bare names.
2025-04-02compilers: introduce get_exe() and get_exe_args()Paolo Bonzini1-1/+2
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-10coredata: replace get_option with optstore.get_value_forDylan Baker2-2/+2
This is an old method, that is now just a wrapper around the OptionStore method, that doesn't add any value. It's also an option related method attached to the CoreData instead of the OptionStore, so useless and a layering violation.
2025-02-13Make all Meson level options overridable per subproject.Jussi Pakkanen2-6/+7
2025-02-05options: Add an EnumeratedUserOption classDylan Baker1-8/+4
This will allow us to take choices out of the UserOption class, which doesn't actually use this attribute.
2024-11-04CMakeToolchain: Log output on compiler state failureFrank Richter1-1/+6
2024-10-11toolchain.py minimum CMake 3.10 to avoid deprecation warningscivision1-1/+1
ref: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9875
2024-10-04Turn off CMake compile launcher when using zigElliott Sales de Andrade1-0/+2
This setting is for things like `ccache`, but if Meson treats zig that way, then it will expand the second argument to become: ``` /usr/bin/zig /usr/lib64/ccache/cc ``` in CMake and `/usr/lib64/ccache/cc` is _not_ an argument to `zig`. If you run ``` $ CC='zig cc' CXX='zig c++' ./meson.py setup 'test cases/cmake/1 basic' build ``` then CMake will fail to compile a "simple test program" and setup fails.
2024-09-30cmake/traceparser: fix typoStephan Lachnit1-1/+1
2024-09-12cmake: actually print the cycle in the error messageDylan Baker1-1/+3
2024-09-11Fix typosspaette2-2/+2
2024-08-26cmake/interpreter: Remove None from values we promise wont have NoneDylan Baker1-10/+9
We've documented these lists as being `List[Path]`, but then we have the potential to insert a None into them via the `rel_path()` function, which can return `None` in some cases. Currently we fix some (but not all) of these later, but we should actually remove them from the list before we assign, so that it's actually a `List[Path]` at all times. While we're here I've simplified the logic a bit. Closes: #13551
2024-08-26cmake/interpreter: Fix some incorrect and missing annotationsDylan Baker1-2/+2
2024-08-26cmake/interpreter: clear up some ambiguous Optional handlingDylan Baker1-5/+4
It may have all been correct, but mypy and pyright couldn't be sure of that.
2024-08-08Fix compiling ObjC/ObjC++ on Windows/MinGWJonathan Schleifer1-0/+2
Co-Authored-By: L. E. Segovia <amy@amyspark.me>
2024-07-30mypy: fix broken logic checks that used "if func"Eli Schwartz1-1/+1
It's always true because the func is always a real, truthy func object. In the cmake case, the logic seems to be broken because if a path is not a file, then that includes the case where it does not exist. It also clearly meant "or" instead of "and". What actually ended up happening was that this check never fired at all. Because "if not func and not ..." would always fail, because "not func" is always false. Maybe we don't need this logic at all...
2024-07-17Remove language (AKA compiler) type from OptionKey.Jussi Pakkanen1-1/+1
2024-07-15cmake: Only propagate interface link flags in depJonathon Anderson2-2/+12
CMake has two target properties, LINK_OPTIONS and INTERFACE_LINK_OPTIONS. The former is for link flags that apply only to the target (PRIVATE). The latter is used for link flags that propagate to dependents (PUBLIC or INTERFACE). Meson currently propagates all flags, PUBLIC and PRIVATE, as part of the generated dependency() which causes problems when some of the private flags are highly disruptive, e.g. `-Wl,--version-script`. Tease apart the two kinds of link flags and, for non-static libraries, only propagate the PUBLIC/INTERFACE flags and not the PRIVATE ones.
2024-07-11Move OptionKey in the option source file.Jussi Pakkanen3-3/+6
2024-06-23Recast CMake's IMPORTED_LOCATION into framework flags (#13299)Kai Pastor1-2/+2
* Explicitly look for 'OpenAL' with method: 'cmake' This test was added for testing cmake depenencies, so no other method must be accepted here, and the spelling must match FindOpenAL.cmake. * Resolve frameworks in IMPORTED_LOCATION The IMPORTED_LOCATION property of CMake targets may contain macOS framework paths. These must be processed into flags. By putting the values in the list of targets, they will be processed as if they appeared in INTERFACE_LINK_LIBRARIES.
2024-06-14Replace direct indexing with named methods.Jussi Pakkanen3-3/+3
2024-06-14Rename option variable to optstore to make it unique.Jussi Pakkanen3-4/+4
2024-04-24cmake/interpreter: Annotate and style module-level constantsJouke Witteveen1-23/+25
2024-04-11cmake: best-effort build type propagationJouke Witteveen1-0/+13
2024-02-25cmake: Allow recasting a CMake dependency into an Apple frameworkL. E. Segovia1-6/+44
Fixes #12160
2024-01-16cmake: Fix blunt target filtering skipping GENERATED dependenciesL. E. Segovia1-1/+9
GENERATED files can be used as dependencies for other targets, so it's misguided (at best) to filter them with a blunt whitelist. However, there does exist an extension that needs to be skipped: on Windows + MSVC, CMake will by default try to generate a Visual Studio project, and there dependencies with no inputs are instead tied to a dummy .rule input file which is created by the generation step. The fileapi will still report those, so it will cause Meson to bail out when it realises there's no such file in the build tree. Fixes #11607
2023-12-21cmake/interperter: Add missing type annotationDylan Baker1-1/+1
Which mypy is suddenly complaining about.
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker9-98/+9
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-12-12cmake: parse project versionNicolas Werner2-2/+18
This properly sets the project version in projects meson generates from cmake projects. This allows dependency fallbacks to properly check the version constraints in dependency calls when falling back to a cmake subproject. Before this would fail, because the project version was undefined.
2023-12-01cmake: Handle compiler.find_library returning NoneDylan Baker1-1/+5
I'm not 100% sure that warning is the appropriate action, but it's better than failing with a backtrace. Fixes: #12555
2023-10-04Remove type comments in run_project_tests.pyTristan Partin1-1/+1
2023-09-22CMakeInterpreter: Remove useless argumentsXavier Claessens1-4/+2
2023-09-11parser: simplify other node constructorsCharles Brunet1-3/+3
2023-09-11parser: simplify Assignment and PlusAssignment nodesCharles Brunet1-1/+1
2023-09-11parser: add SymbolNode to preserve operatorsCharles Brunet1-5/+9
2023-09-11parser: use IdNode for function name and assignment nameCharles Brunet1-3/+3
2023-09-11parser: preserve escape chars in stringsCharles Brunet1-1/+1
use separate Node for multiline strings
2023-09-11parser: preserve number baseCharles Brunet1-1/+1
2023-08-11treewide: automatic rewriting of all comment-style type annotationsEli Schwartz6-51/+51
Performed using https://github.com/ilevkivskyi/com2ann This has no actual effect on the codebase as type checkers (still) support both and negligible effect on runtime performance since __future__ annotations ameliorates that. Technically, the bytecode would be bigger for non function-local annotations, of which we have many either way. So if it doesn't really matter, why do a large-scale refactor? Simple: because people keep wanting to, but it's getting nickle-and-dimed. If we're going to do this we might as well do it consistently in one shot, using tooling that guarantees repeatability and correctness. Repeat with: ``` com2ann mesonbuild/ ```
2023-08-11remove useless type annotationsEli Schwartz3-21/+21
These annotations all had a default initializer of the correct type, or a parent class annotation.
2023-07-19cmake: fix empty BOOL generator expression evaluating to truekiwixz1-1/+1
2023-07-19cmake: find dependencies with bare library names on all platformskiwixz1-2/+2
2023-06-26WIP: cmake: do not re-export unused top-level objectsEli Schwartz1-12/+3
We should try to figure out what is a cross-submodule object and what isn't.
2023-05-03cmake module: use more typed_pos_args for consistencyEli Schwartz1-6/+2
It's shorter and more descriptive. Although we always enforce the same rules either way, a unified decorator is one less line of code for each location, and also tells you how many "too few" arguments you *did* pass.