aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build25
1 files changed, 20 insertions, 5 deletions
diff --git a/meson.build b/meson.build
index 2e034b2..5bcfb02 100644
--- a/meson.build
+++ b/meson.build
@@ -4,6 +4,7 @@ project('libmg2d', 'c',
add_project_arguments('-D_XOPEN_SOURCE=700', language : 'c')
lib_src = [
+ 'cpu.c',
'ell_relax.c',
'log.c',
'mg2d.c',
@@ -17,15 +18,28 @@ dep_tp = declare_dependency(link_args : '-lthreadpool')
deps = [dep_tp]
-# x86 SIMD
+cdata = configuration_data()
+cdata.set10('ARCH_X86', false)
+cdata.set10('ARCH_X86_64', false)
+cdata.set10('HAVE_EXTERNAL_ASM', false)
+
arch = host_machine.cpu_family()
-if arch == 'x86_64'
- nasm = find_program('nasm', required : false)
- if not nasm.found()
- warning('nasm not found, no SIMD will be built')
+if arch.startswith('x86')
+ cdata.set10('ARCH_X86', true)
+
+ if arch == 'x86_64'
+ cdata.set10('ARCH_X86_64', true)
+ nasm = find_program('nasm', required : get_option('nasm'))
+ if nasm.found()
+ cdata.set10('HAVE_EXTERNAL_ASM', true)
+ else
+ warning('nasm not found, no SIMD will be built')
+ endif
endif
endif
+configure_file(output : 'config.h', output_format : 'c', configuration : cdata)
+
if nasm.found()
cdata_asm = configuration_data()
cdata_asm.set10('ARCH_X86', true)
@@ -57,6 +71,7 @@ if nasm.found()
)
nasm_sources = files(
+ 'cpuid.asm',
)
lib_obj += nasm_gen.process(nasm_sources)