Fixing Meson build types in a mostly backwards-compatible manner #10808
Replies: 4 comments 12 replies
-
I definitely think the minsize being debug=true by default is wrong based on the logic in your argument. |
Beta Was this translation helpful? Give feedback.
-
One thing I considered was creating a new option, say |
Beta Was this translation helpful? Give feedback.
-
Having both a release-with-debuginfo and plain release is the one thing I really wish I hadn't copied from CMake directly. It makes absolutely no sense to build a release without debug info. You pretty much always need it because otherwise you can't debug crashes from the field. It sorta makes sense for CMake because they don't have individual toggles for optimization and debug info but because we do the situation is not great. And further ...
We do provide |
Beta Was this translation helpful? Give feedback.
-
My vision for better buildtype would include a way for projects to define their own, declaratively (presets for options), since I believe it is pretty hopeless to come up with the one true set of build types that fit every circumstance. |
Beta Was this translation helpful? Give feedback.
-
Let's discuss Jussi's blog post Making decision without all the information is tricky, a case study, which is a response to my Rule #4: Be Very Careful with Meson’s Build Types. There are several problems with Meson's current build types, but the most serious problem is that
debug
means different things on different platforms. Consider this table from my blog post:debug
OptionThis is already messy before you consider that everything is different on Windows than it is everywhere else. (That table does not apply to Windows.) In my blog post, I recommend projects distinguish between production builds and development builds and follow the following rule: you have a non-production (debug) build if debug is true and if optimization is 0 or g; otherwise, you have a production build. This works everywhere except Windows, but it is very confusing and we can do better.
Here is my strawman proposal to improve things without breaking backwards-compatibility too much:
debuginfo
variable that will be separate fromdebug
to eliminate confusion about the meaning ofdebug
. Currently, thedebug
variable means "debuginfo" on most platforms but "debug checks" on Windows. That's inconsistent.debugoptimized
build type without changing its behavior.releasewithdebuginfo
build type which setsdebug
tofalse
,debuginfo
totrue
, andoptimization
to2
. This replacesdebugoptimized
.minsize
to setdebug
tofalse
by default. This is not quite backwards-compatible, but it seems like the right choice because debuginfo is huge, and it doesn't make sense to have it in a minsize build unless you have infrastructure to split it out, which Meson does not provide. It's also needed for the next step. Alternative: if worried about backwards-compatibility, deprecateminsize
and introduce a newminsizerelease
.Then we have the following non-deprecated build types, which work the same on Windows as everywhere else:
debug
Optiondebuginfo
OptionAnd now everything works nicely, assuming you do not use the deprecated
debugoptimized
build type, which would work as well as it does today.This is surely not what Jussi would design if starting from square one, but it seems like a minimally-invasive way to significantly improve what we have now. We could do even better if willing to make bigger changes.
Beta Was this translation helpful? Give feedback.
All reactions