-
Notifications
You must be signed in to change notification settings - Fork 29
/
meson.build
197 lines (153 loc) · 4.17 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
project('MVTools', 'c', 'cpp',
version: '24',
default_options: ['c_std=c99', 'cpp_std=c++11', 'buildtype=release', 'b_lto=true'],
meson_version: '>=0.46')
warnings = [
'-Wall',
'-Wextra',
'-Wshadow',
]
cflags = [
warnings,
'-fvisibility=hidden',
'-DPACKAGE_VERSION="@0@"'.format(meson.project_version()),
]
ldflags = [
]
nasm_flags = [
'-I@0@'.format(join_paths(meson.current_source_dir(), 'src/asm/include/')),
'-w',
'-Worphan-labels',
'-Wunrecognized-char',
'-Dprivate_prefix=mvtools',
'-DHIGH_BIT_DEPTH=0',
'-DBIT_DEPTH=8',
]
vapoursynth_dep = dependency('vapoursynth').partial_dependency(includes: true, compile_args: true)
sources = [
'src/CopyCode.cpp',
'src/CPU.c',
'src/DCTFFTW.cpp',
'src/EntryPoint.c',
'src/Fakery.c',
'src/GroupOfPlanes.c',
'src/Luma.cpp',
'src/MaskFun.cpp',
'src/MVAnalyse.c',
'src/MVAnalysisData.c',
'src/MVBlockFPS.c',
'src/MVCompensate.c',
'src/MVDegrains.cpp',
'src/MVDepan.cpp',
'src/MVFinest.c',
'src/MVFlow.cpp',
'src/MVFlowBlur.c',
'src/MVFlowFPS.c',
'src/MVFlowFPSHelper.c',
'src/MVFlowInter.c',
'src/MVFrame.cpp',
'src/MVMask.c',
'src/MVRecalculate.c',
'src/MVSCDetection.c',
'src/MVSuper.c',
'src/Overlap.cpp',
'src/PlaneOfBlocks.cpp',
'src/SADFunctions.cpp',
'src/SimpleResize.cpp',
]
debug_build = get_option('buildtype').startswith('debug')
host_cpu_family = host_machine.cpu_family()
if host_cpu_family == 'x86'
host_bits = 32
elif host_cpu_family == 'x86_64'
host_bits = 64
elif host_cpu_family == 'arm'
host_bits = 32
elif host_cpu_family == 'aarch64'
host_bits = 64
endif
host_system = host_machine.system()
if host_system == 'windows' or host_system == 'cygwin'
if host_cpu_family == 'x86'
cflags += '-mstackrealign'
ldflags += '-Wl,--kill-at'
nasm_flags += '-DPREFIX'
endif
nasm_flags += ['-f', 'win@0@'.format(host_bits)]
elif host_system == 'linux' or host_system == 'bsd' # The BSDs are close enough, right?
if debug_build
nasm_flags += '-gdwarf'
endif
nasm_flags += ['-f', 'elf@0@'.format(host_bits)]
elif host_system == 'darwin'
if debug_build
nasm_flags += '-gdwarf'
endif
nasm_flags += ['-DPREFIX', '-f', 'macho@0@'.format(host_bits)]
cflags += ['-DPREFIX']
else
error('Unknown host system "@0@".'.format(host_system))
endif
helper_libs = []
if host_cpu_family.startswith('x86')
cflags += ['-mfpmath=sse', '-msse2', '-DMVTOOLS_X86=1']
nasm_sources = [
'src/asm/const-a.asm',
'src/asm/cpu-a.asm',
'src/asm/pixel-a.asm',
'src/asm/sad-a.asm',
]
if host_cpu_family == 'x86'
nasm_flags += '-DARCH_X86_64=0'
nasm_sources += [
'src/asm/pixel-32.asm',
]
else
nasm_flags += ['-DARCH_X86_64=1', '-DPIC']
endif
nasm = find_program(get_option('with_nasm'))
outputname = '@[email protected]'
if host_system == 'windows'
outputname = '@[email protected]'
endif
nasm_gen = generator(nasm,
output: outputname,
arguments: nasm_flags + ['@INPUT@', '-o', '@OUTPUT@'])
sources += nasm_gen.process(nasm_sources)
libavx2_sources = [
'src/MaskFun_AVX2.cpp',
'src/MVDegrains_AVX2.cpp',
'src/MVFrame_AVX2.cpp',
'src/Overlap_AVX2.cpp',
'src/SADFunctions_AVX2.cpp',
'src/SimpleResize_AVX2.cpp',
]
helper_libs += static_library('avx2',
libavx2_sources,
dependencies: vapoursynth_dep,
cpp_args: [cflags, '-mavx2', '-mtune=haswell'],
install: false)
endif
if host_cpu_family.startswith('arm') or host_cpu_family.startswith('aarch64')
cflags += ['-DMVTOOLS_ARM=1']
if host_cpu_family.startswith('aarch64')
asm_sources = [
'src/asm/aarch64-pixel-a.S',
]
sources += asm_sources
endif
endif
cxx = meson.get_compiler('cpp')
deps = [
vapoursynth_dep,
dependency('fftw3f'),
cxx.find_library('m', required: false),
]
shared_module('mvtools',
sources,
dependencies: deps,
link_args: ldflags,
c_args: cflags,
cpp_args: cflags,
link_with: helper_libs,
install: true)