Skip to content
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

Update buildtype from debug and optimization #12699

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bruchar1
Copy link
Member

@bruchar1 bruchar1 commented Jan 4, 2024

By adding a flag to indicate whether an option was explicitly set or not, it is now possible to update the value of buildtype from the values of debug and optimization, without modifying options that are explicitly set.

Fixes #11645
Fixes #10487
Fixes #5814 (maybe this one was already fixed, but at least a test proves it works)

By adding a flag to indicate whether an option was explicitly set or
not, it is now possible to update the value of `buildtype` from the
values of `debug` and `optimization`, without modifying options that are
explicitly set.

Fixes mesonbuild#11645
Fixes mesonbuild#5814 (maybe this one was already fixed, but at least a test
proves it works)
@bruchar1 bruchar1 force-pushed the make-buildtype-true-alias branch from 2e057b9 to 2fba5af Compare February 22, 2024 03:06
Remove warning about setting both buildtype and optimization or debug.
This is no longer true, as you may want to change the optimization level
but keep other behaviors derived from the buildtype.
@bruchar1 bruchar1 force-pushed the make-buildtype-true-alias branch from 2fba5af to dd9314b Compare February 22, 2024 12:33
@jpakkane
Copy link
Member

FWICT the description means that if you set, for example, optimization to 2 and debug to true, it would update buildtype to debugoptimized. If that is the case, then I don't really like this behaviour. The linked documentation says that buildtype sets opt and debug and "vice versa". It really should not say that (or do it, for that matter).

Buildtype is conceptually at a higher level than optimization and debug options. It means, roughly, "the current build setup will be used for purpose X, configure yourself accordingly". Resetting the latter to "expected defaults" when changing build type is reasonable and expected, whereas the opposite is not.

If we were starting from scratch, then having a build dir set up for debugoptimized and changing optimization level from 2 to, say, 3 should be permitted and not change the build type. This is in fact needed, since minsize might require the use of optimization level s, z, or even 2. The former means "configure your source code to use algorithms etc that minimized code size" whereas the latter is merely tells the compiler "optimized based on target property X".

The way the documentation specifies things is not good and we should change it to this more sensible approach if we can get away with it without breaking backwards compatibility too much.

@bruchar1
Copy link
Member Author

The subtilty is that buildtype will be set from debug and optimization only if it is not explicitly set. It doesn't prevent setting a different optimization when buildtype is explicitly set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants