forked from sfztools/sfizz
-
Notifications
You must be signed in to change notification settings - Fork 1
/
common.mk
379 lines (323 loc) · 11.1 KB
/
common.mk
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# Common definitions for builds based on GNU Make
ifndef SFIZZ_DIR
$(error sfizz: The source directory must be set before including)
endif
### Options
SFIZZ_USE_SNDFILE ?= 0
###
SFIZZ_MACHINE := $(shell $(CC) -dumpmachine)
SFIZZ_PROCESSOR := $(firstword $(subst -, ,$(SFIZZ_MACHINE)))
ifneq (,$(filter i%86,$(SFIZZ_PROCESSOR)))
SFIZZ_CPU_I386 := 1
SFIZZ_CPU_I386_OR_X86_64 := 1
endif
ifneq (,$(filter x86_64,$(SFIZZ_PROCESSOR)))
SFIZZ_CPU_X86_64 := 1
SFIZZ_CPU_I386_OR_X86_64 := 1
endif
ifneq (,$(filter arm%,$(SFIZZ_PROCESSOR)))
SFIZZ_CPU_ARM := 1
SFIZZ_CPU_ARM_OR_AARCH64 := 1
endif
ifneq (,$(filter aarch64%,$(SFIZZ_PROCESSOR)))
SFIZZ_CPU_AARCH64 := 1
SFIZZ_CPU_ARM_OR_AARCH64 := 1
endif
ifneq (,$(findstring linux,$(SFIZZ_MACHINE)))
SFIZZ_OS_LINUX := 1
endif
ifneq (,$(findstring apple,$(SFIZZ_MACHINE)))
SFIZZ_OS_APPLE := 1
endif
ifneq (,$(findstring mingw,$(SFIZZ_MACHINE)))
SFIZZ_OS_WINDOWS := 1
endif
###
SFIZZ_C_FLAGS = -I$(SFIZZ_DIR)/src
SFIZZ_CXX_FLAGS = $(SFIZZ_C_FLAGS)
SFIZZ_SOURCES = \
src/sfizz/ADSREnvelope.cpp \
src/sfizz/AudioReader.cpp \
src/sfizz/BeatClock.cpp \
src/sfizz/Curve.cpp \
src/sfizz/Defaults.cpp \
src/sfizz/effects/Apan.cpp \
src/sfizz/Effects.cpp \
src/sfizz/modulations/ModId.cpp \
src/sfizz/modulations/ModKey.cpp \
src/sfizz/modulations/ModKeyHash.cpp \
src/sfizz/modulations/ModMatrix.cpp \
src/sfizz/modulations/sources/ADSREnvelope.cpp \
src/sfizz/modulations/sources/ChannelAftertouch.cpp \
src/sfizz/modulations/sources/PolyAftertouch.cpp \
src/sfizz/modulations/sources/Controller.cpp \
src/sfizz/modulations/sources/FlexEnvelope.cpp \
src/sfizz/modulations/sources/LFO.cpp \
src/sfizz/effects/Compressor.cpp \
src/sfizz/effects/Disto.cpp \
src/sfizz/effects/Eq.cpp \
src/sfizz/effects/Filter.cpp \
src/sfizz/effects/Fverb.cpp \
src/sfizz/effects/Gain.cpp \
src/sfizz/effects/Gate.cpp \
src/sfizz/effects/impl/ResonantArrayAVX.cpp \
src/sfizz/effects/impl/ResonantArray.cpp \
src/sfizz/effects/impl/ResonantArraySSE.cpp \
src/sfizz/effects/impl/ResonantStringAVX.cpp \
src/sfizz/effects/impl/ResonantString.cpp \
src/sfizz/effects/impl/ResonantStringSSE.cpp \
src/sfizz/effects/Limiter.cpp \
src/sfizz/effects/Lofi.cpp \
src/sfizz/effects/Nothing.cpp \
src/sfizz/effects/Rectify.cpp \
src/sfizz/effects/Strings.cpp \
src/sfizz/effects/Width.cpp \
src/sfizz/EQPool.cpp \
src/sfizz/FileId.cpp \
src/sfizz/FileMetadata.cpp \
src/sfizz/FilePool.cpp \
src/sfizz/FilterPool.cpp \
src/sfizz/FlexEGDescription.cpp \
src/sfizz/FlexEnvelope.cpp \
src/sfizz/Interpolators.cpp \
src/sfizz/Layer.cpp \
src/sfizz/LFO.cpp \
src/sfizz/LFODescription.cpp \
src/sfizz/Messaging.cpp \
src/sfizz/Metronome.cpp \
src/sfizz/MidiState.cpp \
src/sfizz/OpcodeCleanup.cpp \
src/sfizz/Opcode.cpp \
src/sfizz/Oversampler.cpp \
src/sfizz/Panning.cpp \
src/sfizz/parser/Parser.cpp \
src/sfizz/parser/ParserPrivate.cpp \
src/sfizz/PolyphonyGroup.cpp \
src/sfizz/PowerFollower.cpp \
src/sfizz/Region.cpp \
src/sfizz/RegionSet.cpp \
src/sfizz/RegionStateful.cpp \
src/sfizz/Resources.cpp \
src/sfizz/RTSemaphore.cpp \
src/sfizz/ScopedFTZ.cpp \
src/sfizz/sfizz.cpp \
src/sfizz/sfizz_wrapper.cpp \
src/sfizz/SfzFilter.cpp \
src/sfizz/SIMDHelpers.cpp \
src/sfizz/simd/HelpersSSE.cpp \
src/sfizz/simd/HelpersAVX.cpp \
src/sfizz/Smoothers.cpp \
src/sfizz/Synth.cpp \
src/sfizz/SynthMessaging.cpp \
src/sfizz/Tuning.cpp \
src/sfizz/utility/spin_mutex/SpinMutex.cpp \
src/sfizz/Voice.cpp \
src/sfizz/VoiceManager.cpp \
src/sfizz/VoiceStealing.cpp \
src/sfizz/Wavetables.cpp \
src/sfizz/WindowedSinc.cpp
### Other internal
SFIZZ_C_FLAGS += \
-I$(SFIZZ_DIR)/src/sfizz \
-I$(SFIZZ_DIR)/src/sfizz/utility/bit_array \
-I$(SFIZZ_DIR)/src/sfizz/utility/spin_mutex
# Pkg-config dependency
SFIZZ_PKG_CONFIG ?= pkg-config
# Sndfile dependency
ifeq ($(SFIZZ_USE_SNDFILE),1)
SFIZZ_SNDFILE_C_FLAGS ?= $(shell $(SFIZZ_PKG_CONFIG) --cflags sndfile)
SFIZZ_SNDFILE_CXX_FLAGS ?= $(SFIZZ_SNDFILE_C_FLAGS)
SFIZZ_SNDFILE_LINK_FLAGS ?= $(shell $(SFIZZ_PKG_CONFIG) --libs sndfile)
SFIZZ_C_FLAGS += -DSFIZZ_USE_SNDFILE=1
SFIZZ_CXX_FLAGS += -DSFIZZ_USE_SNDFILE=1
endif
# st_audiofile dependency
SFIZZ_SOURCES += \
external/st_audiofile/src/st_audiofile.c \
external/st_audiofile/src/st_audiofile_common.c \
external/st_audiofile/src/st_audiofile_libs.c \
external/st_audiofile/src/st_audiofile_sndfile.c
ifneq ($(SFIZZ_USE_SNDFILE),1)
SFIZZ_SOURCES += \
external/st_audiofile/src/st_audiofile_libs.c
endif
SFIZZ_C_FLAGS += \
-I$(SFIZZ_DIR)/external/st_audiofile/src \
-I$(SFIZZ_DIR)/external/st_audiofile/thirdparty/dr_libs \
-I$(SFIZZ_DIR)/external/st_audiofile/thirdparty/stb_vorbis
SFIZZ_CXX_FLAGS += \
-I$(SFIZZ_DIR)/external/st_audiofile/src \
-I$(SFIZZ_DIR)/external/st_audiofile/thirdparty/dr_libs \
-I$(SFIZZ_DIR)/external/st_audiofile/thirdparty/stb_vorbis
ifeq ($(SFIZZ_USE_SNDFILE),1)
SFIZZ_C_FLAGS += $(SFIZZ_SNDFILE_C_FLAGS) -DST_AUDIO_FILE_USE_SNDFILE=1
SFIZZ_CXX_FLAGS += $(SFIZZ_SNDFILE_CXX_FLAGS) -DST_AUDIO_FILE_USE_SNDFILE=1
SFIZZ_LINK_FLAGS += $(SFIZZ_SNDFILE_LINK_FLAGS)
endif
# libaiff dependency
ifneq ($(SFIZZ_USE_SNDFILE),1)
SFIZZ_SOURCES += \
external/st_audiofile/thirdparty/libaiff/libaiff.all.c
SFIZZ_C_FLAGS += \
-I$(SFIZZ_DIR)/external/st_audiofile/thirdparty/libaiff
SFIZZ_CXX_FLAGS += \
-I$(SFIZZ_DIR)/external/st_audiofile/thirdparty/libaiff
endif
# hiir dependency
SFIZZ_CXX_FLAGS += -I$(SFIZZ_DIR)/src/external/hiir
# threadpool dependency
SFIZZ_CXX_FLAGS += -I$(SFIZZ_DIR)/external/threadpool
# atomic_queue dependency
SFIZZ_CXX_FLAGS += -I$(SFIZZ_DIR)/external/atomic_queue/include
# ghc::filesystem dependency
SFIZZ_CXX_FLAGS += -I$(SFIZZ_DIR)/external/filesystem/include
### Abseil dependency
SFIZZ_C_FLAGS += -I$(SFIZZ_DIR)/external/abseil-cpp
# absl::base
SFIZZ_SOURCES += \
external/abseil-cpp/absl/base/internal/cycleclock.cc \
external/abseil-cpp/absl/base/internal/spinlock.cc \
external/abseil-cpp/absl/base/internal/sysinfo.cc \
external/abseil-cpp/absl/base/internal/thread_identity.cc \
external/abseil-cpp/absl/base/internal/unscaledcycleclock.cc
# absl::malloc_internal
SFIZZ_SOURCES += \
external/abseil-cpp/absl/base/internal/low_level_alloc.cc
# absl::raw_logging_internal
SFIZZ_SOURCES += \
external/abseil-cpp/absl/base/internal/raw_logging.cc
# absl::spinlock_wait
SFIZZ_SOURCES += \
external/abseil-cpp/absl/base/internal/spinlock_wait.cc
# absl::throw_delegate
SFIZZ_SOURCES += \
external/abseil-cpp/absl/base/internal/throw_delegate.cc
# absl::strings
SFIZZ_SOURCES += \
external/abseil-cpp/absl/strings/ascii.cc \
external/abseil-cpp/absl/strings/charconv.cc \
external/abseil-cpp/absl/strings/escaping.cc \
external/abseil-cpp/absl/strings/internal/charconv_bigint.cc \
external/abseil-cpp/absl/strings/internal/charconv_parse.cc \
external/abseil-cpp/absl/strings/internal/memutil.cc \
external/abseil-cpp/absl/strings/match.cc \
external/abseil-cpp/absl/strings/numbers.cc \
external/abseil-cpp/absl/strings/str_cat.cc \
external/abseil-cpp/absl/strings/str_replace.cc \
external/abseil-cpp/absl/strings/str_split.cc \
external/abseil-cpp/absl/strings/string_view.cc \
external/abseil-cpp/absl/strings/substitute.cc
# absl::hashtablez_sampler
SFIZZ_SOURCES += \
external/abseil-cpp/absl/container/internal/hashtablez_sampler.cc \
external/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc
# absl::raw_hash_set
SFIZZ_SOURCES += \
external/abseil-cpp/absl/container/internal/raw_hash_set.cc
# absl::synchronization
SFIZZ_SOURCES += \
external/abseil-cpp/absl/synchronization/barrier.cc \
external/abseil-cpp/absl/synchronization/blocking_counter.cc \
external/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc \
external/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc \
external/abseil-cpp/absl/synchronization/internal/waiter.cc \
external/abseil-cpp/absl/synchronization/notification.cc \
external/abseil-cpp/absl/synchronization/mutex.cc
# absl::graphcycles_internal
SFIZZ_SOURCES += \
external/abseil-cpp/absl/synchronization/internal/graphcycles.cc
# absl::time
SFIZZ_SOURCES += \
external/abseil-cpp/absl/time/civil_time.cc \
external/abseil-cpp/absl/time/clock.cc \
external/abseil-cpp/absl/time/duration.cc \
external/abseil-cpp/absl/time/format.cc \
external/abseil-cpp/absl/time/time.cc
# absl::time_zone
SFIZZ_SOURCES += \
external/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc \
external/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc \
external/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc \
external/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc \
external/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc \
external/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc \
external/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc \
external/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc \
external/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc
# absl::stacktrace
SFIZZ_SOURCES += \
external/abseil-cpp/absl/debugging/stacktrace.cc
# absl::symbolize
SFIZZ_SOURCES += \
external/abseil-cpp/absl/debugging/symbolize.cc
# absl::demangle_internal
SFIZZ_SOURCES += \
external/abseil-cpp/absl/debugging/internal/demangle.cc
# absl::debugging_internal
SFIZZ_SOURCES += \
external/abseil-cpp/absl/debugging/internal/address_is_readable.cc \
external/abseil-cpp/absl/debugging/internal/elf_mem_image.cc \
external/abseil-cpp/absl/debugging/internal/vdso_support.cc
# absl::hash
SFIZZ_SOURCES += \
external/abseil-cpp/absl/hash/internal/hash.cc
# absl::city
SFIZZ_SOURCES += \
external/abseil-cpp/absl/hash/internal/city.cc
# absl::low_level_hash
SFIZZ_SOURCES += \
external/abseil-cpp/absl/hash/internal/low_level_hash.cc
# absl::int128
SFIZZ_SOURCES += \
external/abseil-cpp/absl/numeric/int128.cc
ifdef SFIZZ_OS_WINDOWS
SFIZZ_LINK_FLAGS += -ldbghelp
endif
### Spline dependency
SFIZZ_C_FLAGS += -I$(SFIZZ_DIR)/src/external/spline
SFIZZ_SOURCES += src/external/spline/spline/spline.cpp
### Cpuid dependency
SFIZZ_C_FLAGS += \
-I$(SFIZZ_DIR)/src/external/cpuid/src \
-I$(SFIZZ_DIR)/src/external/cpuid/platform/src
SFIZZ_SOURCES += \
src/external/cpuid/src/cpuid/cpuinfo.cpp \
src/external/cpuid/src/cpuid/version.cpp
### simde dependency
SFIZZ_C_FLAGS += \
-I$(SFIZZ_DIR)/external/simde
### Pugixml dependency
SFIZZ_C_FLAGS += -I$(SFIZZ_DIR)/src/external/pugixml/src
SFIZZ_SOURCES += src/external/pugixml/src/pugixml.cpp
### Kissfft dependency
SFIZZ_C_FLAGS += \
-I$(SFIZZ_DIR)/src/external/kiss_fft
SFIZZ_SOURCES += \
src/external/kiss_fft/kiss_fft.c \
src/external/kiss_fft/kiss_fftr.c
### Surge tuning library dependency
SFIZZ_CXX_FLAGS += \
-I$(SFIZZ_DIR)/src/external/tunings/include
SFIZZ_SOURCES += \
src/external/tunings/src/Tunings.cpp
### jsl dependency
SFIZZ_CXX_FLAGS += \
-I$(SFIZZ_DIR)/external/jsl/include
### cephes dependency
SFIZZ_SOURCES += \
external/cephes/src/chbevl.c \
external/cephes/src/i0.c
### math dependency
ifdef SFIZZ_OS_LINUX
SFIZZ_LINK_FLAGS += -lm
endif
### pthread dependency
ifdef SFIZZ_OS_LINUX
SFIZZ_C_FLAGS += -pthread
SFIZZ_CXX_FLAGS += -pthread
SFIZZ_LINK_FLAGS += -pthread
endif
### OpenMP dependency
SFIZZ_C_FLAGS += -fopenmp
SFIZZ_CXX_FLAGS += -fopenmp
SFIZZ_LINK_FLAGS += -fopenmp