-
Notifications
You must be signed in to change notification settings - Fork 59
/
meson.build
102 lines (92 loc) · 3.4 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
project('x86-simd-sort', 'cpp',
version : '6.0.x',
license : 'BSD 3-clause',
default_options : ['cpp_std=c++17'])
fs = import('fs')
cpp = meson.get_compiler('cpp')
src = include_directories('src')
lib = include_directories('lib')
bench = include_directories('benchmarks')
utils = include_directories('utils')
tests = include_directories('tests')
# Add IPP sort to benchmarks:
benchipp = false
ipplink = []
if get_option('build_ippbench')
benchipp = true
ipplink = ['-lipps', '-lippcore']
endif
# Add google vqsort to benchmarks:
benchvq = false
if get_option('build_vqsortbench')
benchvq = true
endif
fp16code = '''#include<immintrin.h>
int main() {
__m512h temp = _mm512_set1_ph(1.0f);
__m512h var2 = _mm512_min_ph(temp, temp);
return 0;
}
'''
cancompilefp16 = cpp.compiles(fp16code, args:'-march=sapphirerapids')
subdir('lib')
if get_option('lib_type') == 'shared'
libsimdsort = shared_library('x86simdsortcpp',
'lib/x86simdsort.cpp',
include_directories : [src, utils, lib],
link_args : [openmpflags],
link_with : [libtargets],
gnu_symbol_visibility : 'inlineshidden',
install : true,
soversion : 1,
)
else
libsimdsort = static_library('x86simdsortcpp',
'lib/x86simdsort.cpp',
include_directories : [src, utils, lib],
link_args : [openmpflags],
link_with : [libtargets],
gnu_symbol_visibility : 'inlineshidden',
install : true,
pic: true,
)
endif
pkg_mod = import('pkgconfig')
pkg_mod.generate(libraries : libsimdsort,
version : '4.0',
name : 'libx86simdsortcpp',
filebase : 'x86simdsortcpp',
description : 'C++ template library for high performance SIMD based sorting routines.')
# Build test suite if option build_tests set to true
if get_option('build_tests')
gtest_dep = dependency('gtest_main', required : true, static: false)
subdir('tests')
testexe = executable('testexe',
include_directories : [lib, utils],
dependencies : gtest_dep,
link_whole : [libtests],
link_with : libsimdsort,
)
test('x86 simd sort tests', testexe)
endif
# Build benchmarking suite if option build_benchmarks is set to true
if get_option('build_benchmarks')
gbench_dep = dependency('benchmark', required : true, static: false)
thread_dep = dependency('threads') # libbenchmark could need pthread_create
subdir('benchmarks')
benchexe = executable('benchexe',
include_directories : [src, lib, utils, bench],
dependencies : [gbench_dep, thread_dep],
link_args: ['-lbenchmark_main', ipplink],
link_whole : [libbench],
link_with : libsimdsort,
)
endif
summary({
'Can compile AVX-512 FP16 ISA': cancompilefp16,
'Build test content': get_option('build_tests'),
'Build benchmarks': get_option('build_benchmarks'),
},
section: 'Configuration',
bool_yn: true
)