aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
AgeCommit message (Collapse)AuthorFilesLines
2025-06-23vala: Also add --target-glib if glib is built as subprojectFlorian "sp1rit"​3-5/+35
Previously, meson would only check if glib was part of target.external_dependencies and add --target-glib appropriately. This however had the downside of meson not adding --target-glib if glib was included as a subproject, potentially breaking otherwise builds. Instead of checking external_dependencies, check target.added_deps for an occurrence of 'glib-2.0' and then pick the appropriate codepath (either from the external dependency based on version_reqs or for the internal dependency based on the actual version, potentially downgraded to the latest release version) Related-to: #14694
2025-06-23compilers: Implement get_cxx_interoperability_argsAlbert Tang1-0/+3
As is the case with most other methods, it must be overriden in another compiler for it to have any use. Only the Swift compiler uses this method at this time.
2025-06-23swift: Add support for C++/Objective-C++ interoperabilityAlbert Tang3-0/+14
As of Swift 5.9, C++/Objective-C++ code can be mixed with Swift, and C++ APIs can be imported to Swift. However, this must be explicitly enabled, as it is disabled by default. Xcode 15 introduces a new setting for this, so only set it on Xcode 15 and above.
2025-06-21gnome.generate_gir: Use rspfiles on Windows when possibleL. E. Segovia1-1/+7
I ran into GStreamer's CI being overwhelmed by a 5k long command line to g-ir-scanner. This will help bypass the limitation. See https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/532 See #6710
2025-06-20mconf: print overrides specific to the main projectPaolo Bonzini1-5/+6
Those were hidden, because the global options look at subproject `None` rather than `''`. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-20mconf: print sections lazilyPaolo Bonzini1-2/+11
To the user, toplevel project options are the same as global options because they are not prefixed by ":". So, even if we starting printing toplevel project overrides, we want to keep project options outside of that section. Then one would end up with: ... Project options --------------- Main project: Subproject foo: The "Main project" line is printed because '' is in self.all_subprojects, but there is nothing below because project options have been printed before. To fix this, print section names lazily, together with their first content item. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-20mconf: print global compiler optionsPaolo Bonzini1-2/+2
Fixes: #14476 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-20options: do not store duplicate UserOptionsPaolo Bonzini1-6/+6
These options are never looked up except by "meson configure" and introspection, because option values are taken from self.augments[] instead. Fixes: #14558 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18options: fix option orderingPaolo Bonzini2-21/+34
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18interpreter: bump priority of default_library=static that comes from fallbackPaolo Bonzini2-6/+14
We're about to lower the priority of the default_options that were passed to subproject() and dependency() below that of machine files and command line options. Whenever a static dependency is falling back to a subproject, however, do not do that. It makes no sense to build a shared library in that case. Another possibility however could be to just make it an error. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18options: all inputs to OptionStore are OptionKeysPaolo Bonzini3-48/+26
Thanks to several fixes applied between commit d37d649b0 ("Make all Meson level options overridable per subproject.", 2025-02-13) and now, OptionStore never gets a string key. Tighten the type of OptionDict, and use it whenever possible. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18coredata: use OptionKey for the keys of cmd_line_optionsPaolo Bonzini2-14/+15
The cmd_line_options dictionary is described as having OptionKey keys, so make sure that cmd_the keys do have the correct type. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18options: remove double assignmentPaolo Bonzini1-1/+0
self.project_options is set already a couple lines above. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18options: do not use always-true variablePaolo Bonzini1-3/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18options: reuse set_option_maybe_rootPaolo Bonzini1-39/+20
There is common logic hiding between project() and "meson configure": the complication that the comment mentions for the "default_options" case actually applies to "meson configure", to machine files, to command line options and to project options. Reuse the same function in all four cases. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18options: use nicer type annotation T.ContainerPaolo Bonzini1-1/+1
Suggested-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18options: accept backend options as pending on first invocationPaolo Bonzini1-1/+4
They must be there when running re-configuring, because the backend cannot be changed, but they can be pending on the first invocation. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18options: print option name before "as_root()" in errorsPaolo Bonzini1-6/+10
Starting with Meson 1.8.0, "meson configure" prints some options as ":foo" instead of "foo". Print the option as it was passed by the user. While at it, make errors more consistent and/or correct (e.g. "Unknown option" instead of "Unknown options"). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18interpreter: fix incorrect _do_subproject* annotationPaolo Bonzini1-5/+6
Use the type that is produced by the converter, and fix the type for methods_map which has a wrongly-placed bracket. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18interpreter: use correct type for project_default_optionsPaolo Bonzini1-5/+2
The converter in DEFAULT_OPTIONS makes a mapping from OptionKey to Python values, so use the correct type. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-18compilers: pgi: fix preprocessing argumentsPaolo Bonzini1-0/+6
Based on reports from the users, PGI compilers need an explicit "-o -" on the command line to emit preprocessed output on stdout. Override the methods in the PGICompiler mixin to add it when output goes to stdout but not when output goes elsewhere. Fixes: #13216 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-17Test serialization: Simplify determination of Windows extra pathsLuca Bacci1-5/+1
Pointed out by Charles Brunet
2025-06-17Test serialization: Also look for depends when setting PATH on WindowsLuca Bacci1-0/+1
Fixes https://github.com/mesonbuild/meson/issues/4668
2025-06-17Test serialization: set LD_LIBRARY_PATH also on DarwinLuca Bacci1-1/+7
It's needed on Darwin for the same reason it's needed on generic UNIX. Darwin supports both LD_LIBRARY_PATH and DYLD_LIBRARY_PATH, but the two are not quite equivalent [1], so we set both. [1] https://github.com/ffi/ffi/blob/29ad900a/lib/ffi/dynamic_library.rb#L40
2025-06-17interpreterbase: remove per-object method dispatchingPaolo Bonzini1-11/+0
Only support class-based dispatch, all objects have been converted.
2025-06-17modules: convert custom holders to InterpreterObject.methodPaolo Bonzini2-19/+13
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-17interpreter: convert remaining objects to InterpreterObject.methodPaolo Bonzini1-86/+70
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-17interpreter: convert compiler to InterpreterObject.methodPaolo Bonzini1-40/+38
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-17interpreter: convert mesonmain to InterpreterObject.methodPaolo Bonzini1-33/+32
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-17interpreter: make methods per-class for primitivesPaolo Bonzini6-67/+60
Do not call update() and Enum.__hash__ a gazillion times; operators are the same for every instance of the class. In order to access the class, just mark the methods using a decorator and build METHODS later using __init_subclass__. Non-primitive objects are not converted yet to keep the patch small. They are created a lot less than other objects, especially strings and booleans. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-17interpreter: make operators per-classPaolo Bonzini8-62/+57
Do not call update() and Enum.__hash__ a gazillion times; operators are the same for every instance of the class. In order to access the class for non-trivial operators, the operators are first marked using a decorator, and then OPERATORS is built via __init_subclass__. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-17interpreter: make trivial_operators per-classPaolo Bonzini6-63/+81
Do not call update() and Enum.__hash__ a gazillion times; trivial operators are the same for every instance of the class. Introduce the infrastructure to build the MRO-resolved operators (so the outcome same as if one called super().__init__) for each subclass of InterpreterObject. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-17interpreter: make operator functions binaryPaolo Bonzini8-53/+63
In preparation for moving them to the class, make the operator functions binary. Adjust the lambdas for trivial operators, and store unbound methods for non-trivial ones. Note that this requires adding operators manually for every override, even subclasses. It's decidedly ugly at this temporary stage; later it will result in just an extra @InterpreterObject.operator decorator on the subclasses. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-17interpreter: fix a couple FeatureNew messagesPaolo Bonzini1-2/+2
2025-06-09AstInterpreter: Fix dead-code-crashVolker Weißmann3-10/+26
Without this commit, the rewriter and the static introspection tool crash if `meson.build` contains something like ```meson if false foo = not_defined endif ``` or ```meson if false message(not_defined) endif ``` While it could be argued, that you should not write stuff like this, this used to raise a `MesonBugException`, which we have to fix. Fixes #14667
2025-06-09modules/gnome: Allow to generate markdown and reStructuredText dbus docCorentin Noël1-0/+66
gdbus-docgen supports reStructuredText output since 2.71.1 and markdown since 2.75.2, allow to simply generate it.
2025-06-08replace regex implementation for cmake with a parserJan2001011-50/+93
cmake does preprocessing in a linear pass through the entire file this allows recursive variable lookups which cannot be supported by a basic regex implementation.
2025-06-08handle empty curly braces correctlyJan2001011-1/+1
in cmake variables are pure strings with no minimal required length so an empty string is a valid key and ${} needs to be handled accordingly.
2025-06-08handle spacing between # and cmakedefineJan2001011-4/+5
just as with C defines cmakedefine supports a variable amount of whitespace between the # symbol and the actual token.
2025-06-06Fix Flang stdlib linking for LLVM toolchain versions >= 19Mugundanmcw1-1/+5
2025-06-05swift: Pass C base compile options to swiftcKatalin Rebhan1-1/+7
2025-06-05vala: Pass --shared-library to valac when generating a .gir fileCorentin Noël1-0/+3
This is required to make sure that the generated .gir file actually contains all the information to be used dynamically. Valac supports this argument since 0.29.3 released in 2015.
2025-06-05build: Fix tasking compiler b_lto detection for overridesDylan Baker1-1/+7
Actually take an override into account, ie: ```meson library( ... override_options : {'b_lto' : false}, ) ```
2025-06-05backend: fix tasking compiler support after option refactorgerioldman1-3/+3
2025-06-05build: fix tasking compiler b_lto support after option refactorDylan Baker1-4/+4
The weird format is to minimize the diff in the next fixup patch.
2025-06-05vsbackend: detect toolset and SDK version at generate() timePaolo Bonzini7-0/+16
Compilers are not ready at the time the backend is created. Do not look at them until generate() runs. Fixes: 4e9fac15d ("interpreter: add backend options before validating the command line options", 2025-05-16) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-05ninjabackend: clear allow_thin_archives[] at generate() timePaolo Bonzini1-5/+6
Compilers are not ready at the time the backend is created. Do not look at them until generate() runs. Fixes: 4e9fac15d ("interpreter: add backend options before validating the command line options", 2025-05-16) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-05Add eld as default linker for Qualcomm Hexagon compilerKushal Pal2-1/+7
Signed-off-by: Kushal Pal <kushpal@qti.qualcomm.com>
2025-06-05Add ELD linkerKushal Pal1-0/+6
ELD is Qualcomm's open-source embedded linker. https://github.com/qualcomm/eld Signed-off-by: Kushal Pal <kushpal@qti.qualcomm.com>
2025-06-04utils: Support VCSs that can have file repodirsDylan Baker1-3/+16
When git is used with worktrees, `.git` will be a file containing a link to the original repo. Currently, we say that this is not git because `.git` isn't a directory.