From c036eba207045966607bd5cf3d66132ec755eb6d Mon Sep 17 00:00:00 2001 From: Ell Date: Mon, 28 Oct 2019 07:59:34 +0200 Subject: [PATCH] meson: improve host cpu detection See gegl@6bcf95fd0f32cf5e8b1ddbe17b14d9ad049bded8. --- meson.build | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/meson.build b/meson.build index bd428b6..0befaef 100644 --- a/meson.build +++ b/meson.build @@ -80,31 +80,24 @@ platform_android = false platform_osx = false platform_win32 = false -host_cpu = host_machine.cpu() -message('Architecture: ' + host_cpu) +host_cpu_family = host_machine.cpu_family() +message('Host machine cpu family: ' + host_cpu_family) -if host_cpu.startswith('i') and host_cpu.endswith('86') +host_cpu_family = host_machine.cpu_family() +if host_cpu_family == 'x86' have_x86 = true - conf.set10('ARCH_X86', true, description: - 'Define to 1 if you are compiling for ix86.') -elif host_cpu == 'x86_64' + conf.set10('ARCH_X86', true) +elif host_cpu_family == 'x86_64' have_x86 = true - conf.set10('ARCH_X86', true, description: - 'Define to 1 if you are compiling for ix86.') - conf.set10('ARCH_X86_64', true, description: - 'Define to 1 if you are compiling for amd64.') -elif host_cpu == 'ppc' or host_cpu == 'powerpc' + conf.set10('ARCH_X86', true) + conf.set10('ARCH_X86_64', true) +elif host_cpu_family == 'ppc' have_ppc = true - conf.set10('ARCH_PPC', true, description: - 'Define to 1 if you are compiling for PowerPC.') -elif host_cpu == 'ppc64' or host_cpu == 'powerpc64' + conf.set10('ARCH_PPC', true) +elif host_cpu_family == 'ppc64' have_ppc = true - conf.set10('ARCH_PPC', true, description: - 'Define to 1 if you are compiling for PowerPC.') - conf.set10('ARCH_PPC64', true, description: - 'Define to 1 if you are compiling for PowerPC64.') -else - warning('Unknown host architecture') + conf.set10('ARCH_PPC', true) + conf.set10('ARCH_PPC64', true) endif host_os = host_machine.system() -- 2.30.2