Commit Graph

9851 Commits

Author SHA1 Message Date
Zephyr Lykos 26bd805dd7 vs2010backend: Initial MASM language support 2025-05-15 23:33:03 +03:00
Paolo Bonzini 979805fdc1 coredata: remove unused arguments
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15 10:10:49 -07:00
Paolo Bonzini 8dfecd2ad8 coredata: assert compiler OptionKeys have the right shape
The subproject and machine should already be correct, thanks
to form_compileropt_key.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15 10:10:49 -07:00
Paolo Bonzini 4cdff788e7 introspection: do not reinvent process_compiler_options
Let add_compiler_options and process_compiler_options handle subprojects,
and also run it for the main project to ensure that pending_options are
properly processed.

This exposes a bug because "comp" could have been None, so fix that.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15 10:10:49 -07:00
Paolo Bonzini 203078f396 options: "custom" buildtype does not trigger changes in debug or optimization options
Fixes: #14603
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15 02:08:22 -04:00
Paolo Bonzini 2f6fc30df1 msetup: update coredata if options are passed together with --reconfigure
This makes "meson setup --reconfigure" behave quite literally the same as
"meson configure" + "meson setup"; except that saving coredata and
cmdline file is delayed until the setup succeeds.

Fixes: #14575
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15 02:05:18 -04:00
Paolo Bonzini d8defe8ecd mconf: extract option processing to CoreData.set_from_configure_command
Prepare to reuse the logic in "meson setup --reconfigure".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15 02:05:18 -04:00
Paolo Bonzini 625184335f mconf: remove dead function
This was the pre-refactoring implementation of `-D`, which is now unused.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15 02:05:18 -04:00
Paolo Bonzini 2d1c67f095 options: restore special behavior of CFLAGS vs. c_args
For compatibility with Autotools, CFLAGS is added to the linker command
line if the compiler acts as a linker driver.  However, this behavior
was lost in commit d37d649b0 ("Make all Meson level options overridable
per subproject.", 2025-02-13).

The issue is that (for example) c_link_args is stored in env.options, and
from that point on it is treated as a machine-file option.  This includes
not being able to override it in compilers.get_global_options:

- initialize_from_top_level_project_call places it in pending_options

- add_lang_args passes the right value to add_compiler_option

- add_compiler_option calls add_system_option_internal

- add_system_option_internal fishes the value out of pending_options
  and ignores what get_global_options provided.

Instead, store the putative values of the compiler options coming from
the environment in a separate dictionary, that is only accessed by
get_global_options. This way it never appears in pending_options, and
also there is no internal *_env_args variable anymore.

Fixes: #14533
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15 02:03:46 -04:00
Paolo Bonzini d11fa36196 environment: move a comment around
Make space for moving the larger comment about *_env_args, which will be before
the for loop once *_env_args is removed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15 02:03:46 -04:00
Paolo Bonzini 938690eef7 environment: split list of important environment variables to a constant
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-15 02:03:46 -04:00
Charles Brunet 0ca85ebf2e devenv: do not use os.execv on Windows
On Windows, os.execv spawn the process in background and returns 0.
Therefore, it prevents devenv to return proper exit code from the
called process. (see https://github.com/python/cpython/issues/63323
for reference.)

The solution is to call subprocess.run instead, on Windows, at the
price of keeping the meson python process alive while the devenv
subprocess runs.
2025-05-14 23:08:55 +03:00
Paolo Bonzini 14010f4dfd rust: skip doctests when build machine cannot run host binaries
"rustdoc --test" relies on running host binaries, and has no way of wrapping
them with Meson's exe_wrapper.  Just skip the doctests in that case.

Fixes: #14583
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-13 11:52:07 -07:00
Peter Harris 043ff22fc7 cpp: Fix cpp_std=vc++14
Fixes a regression introduced in commit d37d649b08 "Make all Meson level
options overridable per subproject." This change results in every file
printing the warning "cl : Command line warning D9002 : ignoring unknown
option '/std:vc++14'"

Now that "get_option_..." is called before overwriting the option (instead
of after), we have to operate on compiler options, not meson options.

There is no such compiler option as /std:vc++14 (the meson option vc++xx is
split into /std:c++xx for the C++ standard version, and a separate flag
that enables Microsoft extensions). Remove the mapping from c++14 to
vc++14.
2025-05-13 09:44:22 -07:00
Henrik Lindström 25854d7584 mdist.py: Import gzip only when needed
This is already done for bz2 and lzma, but even gzip is not always available
in a minimal Python installation. For example, this happens when building
Python from source without having zlib available.
2025-05-11 15:58:40 -04:00
Daniel Foster 24d7c347f5 compilers/rust: fix syntax of has_argument checks 2025-05-11 03:04:52 -04:00
Paolo Bonzini 5558453e18 interpreter: reintroduce a convertor for override_options and default_options
Replace optlist2optdict with a convertor.  However, while default_options
should use OptionKeys like it did before the option refactoring,
override_options keeps using strings.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-07 09:43:43 -07:00
Paolo Bonzini 3a020bbd65 interpreterbase: allow any return type for convertors
A convertor will *accept* something that is definitely a TYPE_var; but the
output can be any Python object that the evaluation function desires.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-07 09:43:43 -07:00
Paolo Bonzini 614aa835ed options: store augments as OptionKeys
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-07 09:43:43 -07:00
Paolo Bonzini 9bff9de834 options: do not go back to list representation
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-07 09:43:43 -07:00
Paolo Bonzini 8f55a24cfb options: support non-string data types in more places
Allow OptionStringLikeDict to use non-string data types, and use it
as much as possible instead of string-valued dictionaries.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-07 09:43:43 -07:00
Paolo Bonzini 26870c2bdc ast: clean up handling of default options
Do not go through string first and OptionKey second.  Just pass the OptionKeys
down.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-07 09:43:43 -07:00
Paolo Bonzini 82bcab13d3 options: early convert project default options to dictionary
This makes it possible to remove all list cases from first_handle_prefix
and callees.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-07 09:43:43 -07:00
Paolo Bonzini e092bed1a4 options: fix type for OptionStore.augments 2025-05-07 09:43:43 -07:00
Paolo Bonzini 950ea873d0 options: tighten types for validating options
Make the validators accept any object since that is where the type
checking is done.  The same is true for listify_array_value, which
also performs type checking.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-07 09:43:43 -07:00
Paolo Bonzini 4219f0e978 options: machine_file_options keys are always OptionKeys
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-07 09:43:43 -07:00
Paolo Bonzini 01da0686f6 interpreter: rename default_project_options
It is assigned to invoker_method_default_options for clarity, use that name
everywhere.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-07 09:43:43 -07:00
Paolo Bonzini c1b7ef4218 options: fix "deprecated" with dictionary argument and non-string types
Since opt.deprecated is a dictionary with string keys, the lookup must use
str() around the user-provided value; with some care because booleans
will be the meson-ic 'true' and 'false' instead of Python's 'True' and
'False'.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-07 09:43:43 -07:00
Paolo Bonzini 42d531da65 interpreter: allow passing default default_options to do_subproject
Apply the default_library=... default after the default options have been
converted to a dictionary, to avoid having to deal with all the possible types
of the default_options keyword argument.

Fixes: #14532
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-06 13:21:24 -07:00
Paolo Bonzini bc825b805d interpreter: convert subproject default options to dictionary
Always use a dictionary (even though later OptionStore will convert it back to list
for hackish historical reasons) to make it easy to apply overrides.  Long term
we probably want OptionStore to not know about T.List[str] at all, anyway.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-06 13:21:24 -07:00
Paolo Bonzini d55364fba7 options: fix types for initialize_from_subproject_call
No code changes, just making mypy annotations truthful.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-06 13:21:24 -07:00
Paolo Bonzini 8e2e5c52d0 options: allow setting subproject options in subproject() call
Something like

   subproject('sub', default_options: ['sub2:from_subp=true'])

will cause an assertion failure due to "key.subproject is None"
obviously being false.  Just support this, since it's easy to do so.
2025-05-06 13:21:24 -07:00
Paolo Bonzini 1a6a9d6032 options: set subproject options as augments
Fixes: #14528
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-06 13:21:24 -07:00
Daniele Nicolodi 96e0c4bf4a dependencies/python: Fix Framework Python when pkg-config is installed
In this case, self.raw_link_args is None.

Fixes #14534.
2025-05-06 21:22:40 +03:00
Daniele Nicolodi a343b01d1b dependencies/python: Replace non-breakable space with space 2025-05-06 21:22:40 +03:00
Charles Brunet fde514ccb0 Add license keyword to pkgconfig generate
Fixes #14270.
2025-05-06 15:38:00 +03:00
Charles Brunet c4c5a1b9c3 do not use len to check emptyness 2025-05-06 15:38:00 +03:00
Eli Schwartz f36d680b00
parser: update position when reporting lexer errors for unrecognized token
By default we point to the start of the most recent token we parsed.
This is used when erroring out on parser issues, to print the line that
caused the error, with a pointer to where we were when we got the error.

In this particular case, the pointer pointed to the start of the last
token we successfully parsed (col), but was not updated if we hit a
token we didn't understand at all. Instead use a pointer to the
unrecognized token itself.

Fixes: https://github.com/mesonbuild/meson/issues/14415
2025-05-05 18:42:55 -04:00
Charles Brunet 2d22385aa4
more explicit error message for unrecognized lexer token
Fixes #14415
2025-05-05 18:42:55 -04:00
Paolo Bonzini 1b3263c893 cmake: include_directories() returns an array
See the way that it is created:

            dir_node = assign(dir_var, function(include_directories, tgt.includes))
            sys_node = assign(sys_var, function(include_directories, tgt.sys_includes, {is_system: True}))
            inc_node = assign(inc_var, array([id_node(dir_var), id_node(sys_var)]))

Due to incorrect documentation, commit 1f4bb3737 ("modules/cmake: Make fully type
safe", 2025-04-02) added an incorrect assertion.  Fix both.

Fixes: #14530
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-05 10:39:26 -07:00
Russell Keith-Magee c98cd76956 Add framework linking for iOS builds. 2025-05-04 17:34:42 -04:00
heather7283 f01ae767d5 templates: add missing space to cpp template 2025-05-04 19:31:58 +03:00
Martin Dørum a16ec8b0fb cpp: fix _LIBCPP_ENABLE_ASSERTIONS warning
libc++ deprecated _LIBCPP_ENABLE_ASSERTIONS from version 18.
However, the libc++ shipped with Apple Clang backported that
deprecation in version 17 already,
which is the version which Apple currently ships for macOS.
This PR changes the _LIBCPP_ENABLE_ASSERTIONS deprecation check
to use version ">=17" on Apple Clang.
2025-05-02 15:27:58 +03:00
Paolo Bonzini 6d134ef999 interpreter: add backend options before validating the command line options
Allow specifying e.g. -Dbackend_max_links on the command line.

Fixes: #14524
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-01 22:24:00 +03:00
Paolo Bonzini e22fba20db options: extract validation of command line options
Which command line options are valid is not entirely known until the backend
option is processed.  Split the validation to a separate function so that it
can be done later, and while at it mention all unknown options instead of
just the first.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-01 22:24:00 +03:00
Paolo Bonzini d241394f8b options: tighten type of cmd_line_options
Based on the SharedCMDOptions protocol it is guaranteed to be a dictionary.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-01 22:24:00 +03:00
Paolo Bonzini 8e564f16ae compilers: introduce common helper for sanity checks
Avoid reinventing the wheel and instead use a single helper, taking care
of logging and cross compilation.

Fixes: #14373
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-04-30 00:14:44 +03:00
Paolo Bonzini 8909a09d2a compilers: clike: log output of sanity check
Particularly if using an exe_wrapper, it can be useful to have output
logged for debugging.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-04-30 00:14:44 +03:00
Will Ayd d028502e8f Fix meson format with multi line parenthesized expressions 2025-04-29 13:22:54 +03:00
Jussi Pakkanen 5e8d34b32f Bump version number for new development. 2025-04-28 20:30:01 +03:00