* meson: buildtype flags get overriden by CFLAGS
@ 2024-07-30 12:59 Petr Kubizňák - 2N
2026-02-04 15:48 ` [OE-core] " Richard Purdie
0 siblings, 1 reply; 2+ messages in thread
From: Petr Kubizňák - 2N @ 2024-07-30 12:59 UTC (permalink / raw)
To: openembedded-core@lists.openembedded.org
I have issues with setting optimization flags in meson-built project.
1. In do_write_config task, meson.cross is generated with `c = ${CC}` and `c_args = ${CFLAGS}`.
2. In do_configure, meson setup is called with recipe-defined buildtype and generated meson.cross file.
3. In do_compile, compile commands are composed roughly as `$c <meson_flags> $c_args`, i.e. `${CC} <meson_flags> ${CFLAGS}`. Recipe-defined buildtype propagates as optimization flags into <meson_flags> (based on https://mesonbuild.com/Builtin-options.html#details-for-buildtype mapping).
CFLAGS is composed of TARGET_CFLAGS, which is in turn composed of SELECTED_OPTIMIZATION, which equals either DEBUG_OPTIMIZATION ("-Og ${DEBUG_FLAGS} -pipe") or FULL_OPTIMIZATION ("-O2 -pipe ${DEBUG_FLAGS}"), based on value of DEBUG_BUILD. In any case, CFLAGS features optimization flags including -Ox.
As a result, the -Oy flag in <meson_flags> does not have any effect because it is always overriden by ${CFLAGS}.
Is it intentional that meson buildtype has in fact no effect? Or am I missing something?
/Petr
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [OE-core] meson: buildtype flags get overriden by CFLAGS
2024-07-30 12:59 meson: buildtype flags get overriden by CFLAGS Petr Kubizňák - 2N
@ 2026-02-04 15:48 ` Richard Purdie
0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2026-02-04 15:48 UTC (permalink / raw)
To: kubiznak, openembedded-core@lists.openembedded.org
On Tue, 2024-07-30 at 12:59 +0000, Petr Kubizňák via
lists.openembedded.org wrote:
> I have issues with setting optimization flags in meson-built project.
>
> 1. In do_write_config task, meson.cross is generated with `c = ${CC}`
> and `c_args = ${CFLAGS}`.
> 2. In do_configure, meson setup is called with recipe-defined
> buildtype and generated meson.cross file.
> 3. In do_compile, compile commands are composed roughly as `$c
> <meson_flags> $c_args`, i.e. `${CC} <meson_flags> ${CFLAGS}`. Recipe-
> defined buildtype propagates as optimization flags into <meson_flags>
> (based on
> https://mesonbuild.com/Builtin-options.html#details-for-buildtype map
> ping).
>
> CFLAGS is composed of TARGET_CFLAGS, which is in turn composed of
> SELECTED_OPTIMIZATION, which equals either DEBUG_OPTIMIZATION ("-Og
> ${DEBUG_FLAGS} -pipe") or FULL_OPTIMIZATION ("-O2 -pipe
> ${DEBUG_FLAGS}"), based on value of DEBUG_BUILD. In any case, CFLAGS
> features optimization flags including -Ox.
>
> As a result, the -Oy flag in <meson_flags> does not have any effect
> because it is always overriden by ${CFLAGS}.
>
> Is it intentional that meson buildtype has in fact no effect? Or am I
> missing something?
I suspect most users would want OE's flags to win over meson's ideas on
which ones might apply so that doesn't seem unreasonable. We might want
to document that we effectively override the buildtype in the class
though?
Cheers,
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-04 15:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-30 12:59 meson: buildtype flags get overriden by CFLAGS Petr Kubizňák - 2N
2026-02-04 15:48 ` [OE-core] " Richard Purdie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox