Skip to content

Forward builtin options to subprojects #14498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 24, 2025
Merged

Conversation

bonzini
Copy link
Collaborator

@bonzini bonzini commented Apr 19, 2025

There are several issues here:

  • builtin options were not added globally whenever a subproject needed them, so there was no way for the subproject to retrieve them
  • Meson actually didn't even try to add the global value to the subproject when specified with -D

Some of these issues were masked by usage of env.options, which should not be needed anymore after the option refactoring; all the required information is stored in OptionStore's pending_options after the project() call.

Let's see how much this breaks.

Fixes: #14497

@bonzini bonzini added the options Meson configuration options label Apr 19, 2025
@bonzini bonzini added this to the optionrefactor milestone Apr 19, 2025
@bonzini bonzini force-pushed the fix14497 branch 3 times, most recently from fdf860d to 69249c9 Compare April 19, 2025 14:47
@bonzini bonzini marked this pull request as ready for review April 19, 2025 15:44
@bonzini bonzini requested a review from jpakkane as a code owner April 19, 2025 15:44
@bonzini bonzini modified the milestones: optionrefactor, 1.8 Apr 19, 2025
@jpakkane
Copy link
Member

OptionStore is the one class that has been designed to be unit testable. It would be nice to get a unit test for this in optiontests.py.

Copy link
Member

@dcbaker dcbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic looks right to me, but we should be using evolve here.

@bonzini bonzini force-pushed the fix14497 branch 2 times, most recently from 3d0658f to e437547 Compare April 22, 2025 04:42
@bonzini
Copy link
Collaborator Author

bonzini commented Apr 22, 2025

OptionStore is the one class that has been designed to be unit testable. It would be nice to get a unit test for this in optiontests.py.

Added a unit test (and verified that it fails without the changes).

Prepare for adding more complex logic to add_system_option_internal, in
order to handle inheritance of global options to subprojects.

Do the same in add_project_option to make the similarities and differences
evident.

Signed-off-by: Paolo Bonzini <[email protected]>
bonzini added 5 commits April 23, 2025 11:11
Because system options apply to all subprojects, they need to be
present globally whenever a subproject needs them.

Signed-off-by: Paolo Bonzini <[email protected]>
The data is already available in the OptionStore's pending_options and
add_compiler_option() will pick it from there.

Signed-off-by: Paolo Bonzini <[email protected]>
@jpakkane jpakkane merged commit 475bfba into mesonbuild:master Apr 24, 2025
32 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
options Meson configuration options regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Builtin options not forwarded correctly to subprojects
3 participants