public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* 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

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