-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
158 lines (145 loc) · 4.19 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
project('dpdk-nfv', ['c', 'cpp'], default_options: [
'buildtype=release',
'optimization=3',
'debug=true',
#'b_lto=true',
'cpp_std=gnu++20',
'warning_level=3',
],
)
rust_src_path = meson.source_root() + '/rust-nfv/'
# Set global flags.
cpp_args = [
'-ggdb',
'-g3',
'-fno-omit-frame-pointer',
'-mtune=native',
'-march=native',
'-Wno-pedantic',
'-Wno-error=pedantic',
'-Wno-deprecated-declarations'
]
if get_option('papi')
cpp_args += ['-DPAPI']
endif
# Pass args to compiler.
add_project_arguments(cpp_args, language: 'cpp')
# Add SIMD disabling flags if simd is false.
rust_target = []
if not get_option('simd')
simd_disabling_args = [
'-mno-mmx',
'-mno-sse',
'-mno-sse2',
'-mno-sse3',
'-mno-ssse3',
'-mno-sse4',
'-mno-sse4a',
'-mno-sse4.1',
'-mno-sse4.2',
'-mno-avx',
'-mno-avx2',
'-mno-avx512f',
'-mno-avx512pf',
'-mno-avx512er',
'-mno-avx512cd',
'-mno-avx512vl',
'-mno-avx512bw',
'-mno-avx512dq',
'-mno-avx512ifma',
'-mno-avx512vbmi',
'-msoft-float',
'-lsoft-fp']
cpp_args += simd_disabling_args
# We don't add it to the entire project. Main uses STD, which uses SIMD.
#add_project_arguments(simd_disabling_args, language: 'cpp')
rust_target = ['--target', rust_src_path + '/x86_64-unknown-linux-gnu-nosimd.json']
else
rust_target = ['--target', rust_src_path + '/x86_64-unknown-linux-gnu.json']
endif
# Load subdirectories.
sources = []
subdir('src')
# Build librust_nfv.
rust_nfv_lib = custom_target(
'rust_nfv',
output: 'librust_nfv.a',
build_always_stale: true,
command: ['env', 'RUSTFLAGS=-C target-cpu=native', 'cargo', 'build'] + rust_target + ['-Zbuild-std', '--manifest-path', rust_src_path + '/Cargo.toml', '--release', '--out-dir', '.', '-Zunstable-options', '--color', 'always'],
)
# Find common dependencies.
cpp = meson.get_compiler('cpp')
dependencies = [
cpp.find_library('pthread'),
cpp.find_library('dl'),
dependency('libdpdk'),
dependency('absl_flags', default_options: ['werror=false', 'warning_level=1', 'debug=true']),
]
if get_option('papi')
dependencies += [dependency('papi')]
endif
rust_dependencies = dependencies
# Find cpp dependencies.
cpp_dependencies = dependencies + []
include_directories = [
libnfv_inc,
libtrampoline_inc,
]
cpp_link_with = [
libnfv,
]
# Declare executables.
if get_option('simd')
name_postfix = ''
else
name_postfix = '_no_simd'
endif
foreach batch_size : ['1', '4', '8', '16', '32']
cpp_args = ['-DBATCH_SIZE=' + batch_size]
executable('nfv-notrampoline-' + batch_size,
sources,
dependencies: cpp_dependencies,
include_directories: include_directories,
link_with: cpp_link_with + [
libtrampoline_no_trampoline,
],
cpp_args: cpp_args + ['-DNAME=notrampoline' + name_postfix],
link_args: [
'-T' + meson.source_root() + '/user-trampoline/ls.ld'
]
)
executable('nfv-nofxsave-' + batch_size,
sources,
dependencies: cpp_dependencies,
include_directories: include_directories,
link_with: cpp_link_with + [
libtrampoline_no_fxsave,
],
cpp_args: cpp_args + ['-DNAME=nofxsave' + name_postfix],
link_args: [
'-T' + meson.source_root() + '/user-trampoline/ls.ld'
]
)
executable('nfv-fxsave-' + batch_size,
sources,
dependencies: cpp_dependencies,
include_directories: include_directories,
link_with: cpp_link_with + [
libtrampoline_fxsave,
],
cpp_args: cpp_args + ['-DNAME=fxsave' + name_postfix],
link_args: [
'-T' + meson.source_root() + '/user-trampoline/ls.ld'
]
)
executable('nfv-rust-' + batch_size,
sources,
include_directories: include_directories,
dependencies: rust_dependencies,
link_with: rust_nfv_lib,
cpp_args: cpp_args + ['-DNAME=rust' + name_postfix],
link_args: [
'-T' + meson.source_root() + '/user-trampoline/ls.ld'
]
)
endforeach