meson: improve host cpu detection
authorEll <ell_se@yahoo.com>
Mon, 28 Oct 2019 05:59:34 +0000 (07:59 +0200)
committerEll <ell_se@yahoo.com>
Mon, 28 Oct 2019 06:02:42 +0000 (08:02 +0200)
See gegl@6bcf95fd0f32cf5e8b1ddbe17b14d9ad049bded8.

meson.build

index bd428b6ffa4fd4ee1f696bfafcb2ac673542f454..0befaefc6be2955a29eaabedff6a444e12504eed 100644 (file)
@@ -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()