-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
225 lines (179 loc) · 10.1 KB
/
CMakeLists.txt
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
cmake_minimum_required (VERSION 2.8.11)
project (nyumaya)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS_RELEASE " -O3 -march=x86-64 -mtune=generic -fPIC -funsafe-math-optimizations -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK -s")
#Faster build on your own target
#set(CMAKE_CXX_FLAGS_RELEASE " -O3 -march=native -mtune=native -fPIC -funsafe-math-optimizations -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK -s")
# PiZero
#set(CMAKE_CXX_FLAGS_RELEASE " -O3 -march=native -no-pie -funsafe-math-optimizations -s")
#set(CMAKE_C_FLAGS_RELEASE " -O3 -march=native -no-pie -funsafe-math-optimizations -s -DPFFFT_SIMD_DISABLE")
# Pi3
#set(CMAKE_CXX_FLAGS_RELEASE " -O3 -march=native -no-pie -funsafe-math-optimizations -mfpu=neon-vfpv4 -DUSE_NEON -s")
#set(CMAKE_C_FLAGS_RELEASE " -O3 -march=native -no-pie -funsafe-math-optimizations -mfpu=neon-vfpv4 -DUSE_NEON -s")
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed -Wl,--gc-sections -Wl,--exclude-libs,ALL -Wl,--no-export-dynamic")
if(APPLE)
set (CMAKE_SHARED_LINKER_FLAGS "-Wl")
endif(APPLE)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
Set(BENCHMARK_SOURCES
${CMAKE_SOURCE_DIR}/../tensorflow/lite/tools/benchmark/benchmark_tflite_model.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/tools/benchmark/benchmark_params.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/tools/benchmark/benchmark_model.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/tools/benchmark/benchmark_main.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/tools/command_line_flags.cc
)
Set(SOURCES
${CMAKE_SOURCE_DIR}/../tensorflow/lite/profiling/time.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/profiling/profile_summarizer.cc
${CMAKE_SOURCE_DIR}/../tensorflow/core/util/stats_calculator.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/allocation.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/arena_planner.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/graph_info.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/interpreter.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/mmap_allocation.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/mmap_allocation_disabled.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/model.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/mutable_op_resolver.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/nnapi_delegate.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/nnapi_delegate_disabled.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/optional_debug_tools.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/simple_memory_arena.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/stderr_reporter.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/string_util.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/util.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/minimal_logging.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/minimal_logging_default.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/c/c_api_internal.c
${CMAKE_SOURCE_DIR}/../tensorflow/lite/core/api/error_reporter.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/core/api/flatbuffer_conversions.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/core/api/op_resolver.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/core/subgraph.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/activations.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/add.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/arg_min_max.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/basic_rnn.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/batch_to_space_nd.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/bidirectional_sequence_lstm.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/bidirectional_sequence_rnn.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/cast.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/comparisons.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/concatenation.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/conv.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/depthwise_conv.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/dequantize.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/detection_postprocess.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/div.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/eigen_support.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/elementwise.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/embedding_lookup.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/embedding_lookup_sparse.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/expand_dims.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/exp.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/fake_quant.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/floor.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/floor_div.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/fully_connected.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/gather.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/gemmlowp_support.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/hashtable_lookup.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/kernel_util.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/l2norm.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/layer_norm_lstm.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/local_response_norm.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/logical.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/lsh_projection.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/lstm.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/lstm_eval.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/maximum_minimum.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/mul.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/neg.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/one_hot.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/pack.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/pad.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/pooling.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/pow.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/reduce.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/register.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/relu1.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/reshape.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/resize_bilinear.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/select.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/shape.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/skip_gram.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/slice.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/space_to_batch_nd.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/space_to_depth.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/sparse_to_dense.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/split.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/squeeze.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/strided_slice.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/sub.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/svdf.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/tile.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/topk_v2.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/transpose.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/transpose_conv.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/unidirectional_sequence_lstm.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/unidirectional_sequence_rnn.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/unpack.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/zeros_like.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/internal/kernel_utils.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/internal/quantization_util.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/internal/tensor_utils.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/internal/optimized/neon_tensor_utils.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/internal/reference/portable_tensor_utils.cc
${CMAKE_SOURCE_DIR}/../tensorflow/lite/tools/make/downloads/farmhash/src/farmhash.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/internal/test_util.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/test_util.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/internal/mfcc.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/internal/mfcc_dct.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/internal/mfcc_dct.h
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/internal/mfcc.h
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/internal/mfcc_mel_filterbank.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/internal/mfcc_mel_filterbank.h
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/internal/spectrogram.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/mfcc.cc
#${CMAKE_SOURCE_DIR}/../tensorflow/lite/kernels/audio_spectrogram.cc
#${CMAKE_SOURCE_DIR}/kissfft/kiss_fft.c
#${CMAKE_SOURCE_DIR}/kissfft/tools/kiss_fftr.c
${CMAKE_SOURCE_DIR}/pffft.c
)
add_library(nyumaya SHARED ${SOURCES} lib.cpp AudioRecognitionImpl.cpp SpeakerVerificationImpl.cpp feature_extract.cpp)
add_executable(benchmark ${SOURCES} ${BENCHMARK_SOURCES})
add_executable(test test.cpp)
target_link_libraries(nyumaya Threads::Threads)
if(APPLE)
target_link_libraries(nyumaya m -static-libstdc++ )
else()
target_link_libraries(nyumaya m -static-libgcc -static-libstdc++ )
endif()
target_link_libraries(nyumaya z)
target_link_libraries(benchmark Threads::Threads)
target_link_libraries(benchmark m)
target_link_libraries(benchmark z)
target_link_libraries(test nyumaya)
target_include_directories(nyumaya
PUBLIC ../
INTERFACE ../tensorflow/lite/
PUBLIC ../tensorflow/lite/tools/make/downloads/flatbuffers/include
PUBLIC ../tensorflow/lite/tools/make/downloads/eigen
PUBLIC ../tensorflow/lite/tools/make/downloads/gemmlowp
PUBLIC ../tensorflow/lite/tools/make/downloads/farmhash/src
PUBLIC ../tensorflow/lite/tools/make/downloads/neon_2_sse
PUBLIC ../tensorflow/lite/tools/make/downloads/absl
PUBLIC ./kissfft
)
target_include_directories(benchmark
PUBLIC ../
PUBLIC ../tensorflow/lite/tools/benchmark/
INTERFACE ../tensorflow/lite/
PUBLIC ../tensorflow/lite/tools/make/downloads/flatbuffers/include
PUBLIC ../tensorflow/lite/tools/make/downloads/eigen
PUBLIC ../tensorflow/lite/tools/make/downloads/gemmlowp
PUBLIC ../tensorflow/lite/tools/make/downloads/farmhash/src
PUBLIC ../tensorflow/lite/tools/make/downloads/neon_2_sse
PUBLIC ../tensorflow/lite/tools/make/downloads/absl
PUBLIC ./kissfft
)