Currently we have both cpu_family and cpu set to TARGET_ARCH which is wrong. As mentioned before cpu is more specific. E.g where cpu_family='x86-64' cpu='nehalem'.
Projects using Meson can query for the host_machine.cpu() and expect a more specific CPU type. Here's one example: https://github.com/DPDK/dpdk/blob/74f4d6424da1297bd6e83dcb7bd84444ca8c59dd/config/meson.build#L69 On Wed, Jul 29, 2020 at 9:55 PM Khem Raj <[email protected]> wrote: > > > On 7/25/20 6:56 PM, Ruslan Babayev wrote: > > 'cpu' unlike 'cpu_family' must be a more specific subtype for the CPU. > > > > since mcpu/march should provide the right values already, do we need > this additional logic in meson? dont we get needed settings to meson > already? > > perhaps you can describe some missing cases this would address will help > understand the usecase > > > Signed-off-by: Ruslan Babayev <[email protected]> > > --- > > meta/classes/meson.bbclass | 14 ++++++++++++-- > > .../meson/nativesdk-meson_0.53.2.bb | 12 +++++++++++- > > 2 files changed, 23 insertions(+), 3 deletions(-) > > > > diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass > > index ff52d20e56..0caa7a37c2 100644 > > --- a/meta/classes/meson.bbclass > > +++ b/meta/classes/meson.bbclass > > @@ -62,6 +62,16 @@ def meson_cpu_family(var, d): > > else: > > return arch > > > > +def meson_cpu(prefix, d): > > + import re > > + arch = d.getVar(prefix + "_ARCH") > > + tune_ccargs = d.getVar("TUNE_CCARGS") > > + m = re.search(r"(?<=-march=)\w+|(?<=-mcpu=)\w+", tune_ccargs) > > + if m: > > + return m.group(0) > > + else: > > + return arch > > + > > # Map our OS values to what Meson expects: > > # https://mesonbuild.com/Reference-tables.html#operating-system-names > > def meson_operating_system(var, d): > > @@ -110,13 +120,13 @@ gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper' > > [host_machine] > > system = '${@meson_operating_system('HOST_OS', d)}' > > cpu_family = '${@meson_cpu_family('HOST_ARCH', d)}' > > -cpu = '${HOST_ARCH}' > > +cpu = '${@meson_cpu('HOST', d)}' > > endian = '${@meson_endian('HOST', d)}' > > > > [target_machine] > > system = '${@meson_operating_system('TARGET_OS', d)}' > > cpu_family = '${@meson_cpu_family('TARGET_ARCH', d)}' > > -cpu = '${TARGET_ARCH}' > > +cpu = '${@meson_cpu('TARGET', d)}' > > endian = '${@meson_endian('TARGET', d)}' > > EOF > > } > > diff --git a/meta/recipes-devtools/meson/nativesdk-meson_0.53.2.bb > b/meta/recipes-devtools/meson/nativesdk-meson_0.53.2.bb > > index 67add2c25e..021bff0992 100644 > > --- a/meta/recipes-devtools/meson/nativesdk-meson_0.53.2.bb > > +++ b/meta/recipes-devtools/meson/nativesdk-meson_0.53.2.bb > > @@ -6,6 +6,16 @@ inherit siteinfo > > SRC_URI += "file://meson-setup.py \ > > file://meson-wrapper" > > > > +def meson_cpu(var, d): > > + import re > > + arch = d.getVar(var) > > + tune_ccargs = d.getVar("TUNE_CCARGS") > > + m = re.search(r"(?<=-march=)\w+|(?<=-mcpu=)\w+", tune_ccargs) > > + if m: > > + return m.group(0) > > + else: > > + return arch > > + > > def meson_endian(prefix, d): > > arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS") > > sitedata = siteinfo_data_for_machine(arch, os, d) > > @@ -44,7 +54,7 @@ cpp_link_args = @LDFLAGS > > [host_machine] > > system = '${SDK_OS}' > > cpu_family = '${SDK_ARCH}' > > -cpu = '${SDK_ARCH}' > > +cpu = '${@meson_cpu("SDK_ARCH", d)}' > > endian = '${@meson_endian("SDK", d)}' > > EOF > > > > > > > > > > >
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#141116): https://lists.openembedded.org/g/openembedded-core/message/141116 Mute This Topic: https://lists.openembedded.org/mt/75796683/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
