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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#230549):
https://lists.openembedded.org/g/openembedded-core/message/230549
Mute This Topic: https://lists.openembedded.org/mt/107626791/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-