This repository has been archived by the owner on Sep 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
meson.build
62 lines (50 loc) · 1.97 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
## meson.build for t1ha v2.0.1
project('t1ha', 'c')
cc = meson.get_compiler('c')
t1ha_sources = files(
'src/t1ha0.c',
'src/t1ha1.c',
'src/t1ha2.c')
t1ha_objects = []
t1ha_c_args = []
t1ha_link_with = []
foreach a : ['-Wall', '-ffunction-sections', '-std=c99']
if cc.has_argument(a)
t1ha_c_args += a
endif
endforeach
if true
t1ha_c_args = ['-Dt1ha_EXPORTS']
if cc.has_argument('-fvisibility=hidden')
t1ha_c_args += '-fvisibility=hidden'
endif
endif
if target_machine.cpu_family().startswith('x86')
t1ha_ia32aes_noavx_c_args = t1ha_c_args
t1ha_ia32aes_avx_c_args = t1ha_c_args
t1ha_ia32aes_avx2_c_args = t1ha_c_args
if cc.get_id() == 'msvc'
t1ha_ia32aes_avx_c_args += '/arch:AVX'
t1ha_ia32aes_avx2_c_args += '/arch:AVX2'
else
t1ha_ia32aes_noavx_c_args += ['-mno-avx2', '-mno-avx', '-maes', '-mtune=native']
t1ha_ia32aes_avx_c_args += ['-mno-avx2', '-mavx', '-maes', '-mtune=native']
t1ha_ia32aes_avx2_c_args += ['-mavx2', '-mavx', '-maes', '-mtune=native']
endif
# Need a staging lib since meson cannot set c_args per object.
# Need all versions since th1a0 hash checks processor and chooses
# the appropriate version at runtime.
lib = static_library('t1ha_ia32aes_noavx_stage',
'src/t1ha0_ia32aes_noavx.c', c_args: t1ha_ia32aes_noavx_c_args)
t1ha_objects += lib.extract_objects('src/t1ha0_ia32aes_noavx.c')
lib = static_library('t1ha_ia32aes_avx_stage',
'src/t1ha0_ia32aes_avx.c', c_args: t1ha_ia32aes_avx_c_args)
t1ha_objects += lib.extract_objects('src/t1ha0_ia32aes_avx.c')
lib = static_library('t1ha_ia32aes_avx2_stage',
'src/t1ha0_ia32aes_avx2.c', c_args: t1ha_ia32aes_avx2_c_args)
t1ha_objects += lib.extract_objects('src/t1ha0_ia32aes_avx2.c')
endif
libt1ha = static_library('t1ha', t1ha_sources, c_args: t1ha_c_args, objects: t1ha_objects)
## this makes it possible to use the source and objects in parent project without using libt1ha directly.
#lib_objects += t1ha_objects
#lib_sources += t1ha_sources