-
-
Notifications
You must be signed in to change notification settings - Fork 155
/
Makefile.base.mk
197 lines (160 loc) · 5.24 KB
/
Makefile.base.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
#!/usr/bin/make -f
# Makefile for Cardinal #
# --------------------- #
# Created by falkTX
#
ifeq ($(ROOT),)
$(error invalid usage)
endif
ifeq ($(NOSIMD),true)
ifneq (,$(findstring -msse,$(CXXFLAGS)))
$(error NOSIMD build requested but -msse compiler flag is present in CXXFLAGS)
endif
endif
# -----------------------------------------------------------------------------
# Import base definitions
export DISTRHO_NAMESPACE = CardinalDISTRHO
export DGL_NAMESPACE = CardinalDGL
export NVG_DISABLE_SKIPPING_WHITESPACE = true
export NVG_FONT_TEXTURE_FLAGS = NVG_IMAGE_NEAREST
export USE_FILE_BROWSER = true
export USE_NANOVG_FBO = true
export WASM_EXCEPTIONS = true
export WINDOWS_ICON_ID = 401
export X11_WINDOW_ICON_NAME = gCardinalX11Icon
export X11_WINDOW_ICON_SIZE = 18950
include $(ROOT)/dpf/Makefile.base.mk
DGL_EXTRA_ARGS = \
DISTRHO_NAMESPACE=$(DISTRHO_NAMESPACE) \
DGL_NAMESPACE=$(DGL_NAMESPACE) \
NVG_DISABLE_SKIPPING_WHITESPACE=$(NVG_DISABLE_SKIPPING_WHITESPACE) \
NVG_FONT_TEXTURE_FLAGS=$(NVG_FONT_TEXTURE_FLAGS) \
USE_FILE_BROWSER=$(USE_FILE_BROWSER) \
USE_NANOVG_FBO=$(USE_NANOVG_FBO) \
WASM_EXCEPTIONS=$(WASM_EXCEPTIONS) \
WINDOWS_ICON_ID=$(WINDOWS_ICON_ID) \
X11_WINDOW_ICON_NAME=$(X11_WINDOW_ICON_NAME) \
X11_WINDOW_ICON_SIZE=$(X11_WINDOW_ICON_SIZE)
# -----------------------------------------------------------------------------
# Build config
ifeq ($(BSD),true)
SYSDEPS ?= true
else
SYSDEPS ?= false
endif
ifeq ($(SYSDEPS),true)
RACK_DEP_PATH = $(abspath $(ROOT)/deps/sysroot)
else
RACK_DEP_PATH = $(abspath $(ROOT)/src/Rack/dep)
endif
# -----------------------------------------------------------------------------
# Custom build flags
BASE_FLAGS += -DUSING_CARDINAL_NOT_RACK
BASE_FLAGS += -I$(abspath $(ROOT)/include)
BASE_FLAGS += -I$(abspath $(ROOT)/include/simd-compat)
BASE_FLAGS += -I$(RACK_DEP_PATH)/include
ifeq ($(MOD_BUILD),true)
BASE_FLAGS += -DSIMDE_ENABLE_OPENMP -fopenmp
LINK_FLAGS += -fopenmp
endif
ifeq ($(NOSIMD),true)
BASE_FLAGS += -DCARDINAL_NOSIMD
else ifeq ($(WASM),true)
BASE_FLAGS += -msse -msse2 -msse3 -msimd128
else ifeq ($(CPU_ARM32),true)
BASE_FLAGS += -mfpu=neon-vfpv4 -mfloat-abi=hard
else ifeq ($(CPU_I386_OR_X86_64),true)
BASE_FLAGS += -msse -msse2 -msse3
endif
ifeq ($(SYSDEPS),true)
BASE_FLAGS += -DCARDINAL_SYSDEPS
BASE_FLAGS += $(shell $(PKG_CONFIG) --cflags jansson libarchive samplerate speexdsp)
else
BASE_FLAGS += -DZSTDLIB_VISIBILITY=
endif
ifeq ($(BSD)$(HAIKU),true)
BASE_FLAGS += -DCLOCK_MONOTONIC_RAW=CLOCK_MONOTONIC
endif
ifeq ($(HAIKU)$(WASM),true)
BASE_FLAGS += -I$(abspath $(ROOT)/include/linux-compat)
else
BASE_FLAGS += -pthread
endif
ifeq ($(WINDOWS),true)
BASE_FLAGS += -D_USE_MATH_DEFINES
BASE_FLAGS += -DWIN32_LEAN_AND_MEAN
BASE_FLAGS += -D_WIN32_WINNT=0x0600
BASE_FLAGS += -I$(abspath $(ROOT)/include/mingw-compat)
endif
# make sure these flags always end up last
BUILD_C_FLAGS += -fno-finite-math-only -fno-strict-aliasing
BUILD_CXX_FLAGS += -fno-finite-math-only -fno-strict-aliasing
# -----------------------------------------------------------------------------
# simde flags
BASE_FLAGS += -I$(abspath $(ROOT)/src/Rack/dep/simde)
BASE_FLAGS += -DSIMDE_ACCURACY_PREFERENCE=0
BASE_FLAGS += -DSIMDE_FAST_CONVERSION_RANGE
BASE_FLAGS += -DSIMDE_FAST_MATH
BASE_FLAGS += -DSIMDE_FAST_NANS
BASE_FLAGS += -DSIMDE_FAST_ROUND_MODE
BASE_FLAGS += -DSIMDE_FAST_ROUND_TIES
# -----------------------------------------------------------------------------
# Rack build flags
ifeq ($(BUILDING_RACK),true)
# Rack code is not tested for this flag, unset it
BUILD_CXX_FLAGS += -U_GLIBCXX_ASSERTIONS -Wp,-U_GLIBCXX_ASSERTIONS
# Ignore bad behaviour from Rack API
BUILD_CXX_FLAGS += -Wno-format-security
# Ignore warnings from simde
ifeq ($(MOD_BUILD),true)
BUILD_CXX_FLAGS += -Wno-overflow
endif
# lots of warnings from VCV side
BASE_FLAGS += -Wno-unused-parameter
BASE_FLAGS += -Wno-unused-variable
ifeq ($(CPU_ARM_OR_ARM64)$(CPU_RISCV64),true)
BASE_FLAGS += -Wno-attributes
endif
ifeq ($(MACOS),true)
BASE_FLAGS += -DARCH_MAC
else ifeq ($(WINDOWS),true)
BASE_FLAGS += -DARCH_WIN
else
BASE_FLAGS += -DARCH_LIN
endif
ifeq ($(DEBUG),true)
BASE_FLAGS += -UDEBUG
endif
ifeq ($(HEADLESS),true)
BASE_FLAGS += -DHEADLESS
endif
ifeq ($(USE_GLES3),true)
BASE_FLAGS += -DNANOVG_GLES3_FORCED
else ifeq ($(USE_GLES2),true)
BASE_FLAGS += -DNANOVG_GLES2_FORCED
endif
# needed for enabling SSE in pffft
ifeq ($(CPU_I386),true)
BASE_FLAGS += -Di386
endif
BASE_FLAGS += -I$(abspath $(ROOT)/dpf/dgl/src/nanovg)
BASE_FLAGS += -I$(abspath $(ROOT)/dpf/distrho)
BASE_FLAGS += -I$(abspath $(ROOT)/src)
BASE_FLAGS += -I$(abspath $(ROOT)/src/Rack/include)
BASE_FLAGS += -I$(abspath $(ROOT)/src/Rack/include/dsp)
BASE_FLAGS += -I$(abspath $(ROOT)/src/Rack/dep/filesystem/include)
BASE_FLAGS += -I$(abspath $(ROOT)/src/Rack/dep/fuzzysearchdatabase/src)
BASE_FLAGS += -I$(abspath $(ROOT)/src/Rack/dep/glfw/include)
BASE_FLAGS += -I$(abspath $(ROOT)/src/Rack/dep/nanosvg/src)
BASE_FLAGS += -I$(abspath $(ROOT)/src/Rack/dep/oui-blendish)
BASE_FLAGS += -I$(abspath $(ROOT)/src/Rack/dep/pffft)
BASE_FLAGS += -I$(abspath $(ROOT)/src/Rack/dep/tinyexpr)
BUILD_C_FLAGS += -std=gnu11
ifneq ($(MACOS),true)
BUILD_CXX_FLAGS += -faligned-new -Wno-abi
ifeq ($(MOD_BUILD),true)
BUILD_CXX_FLAGS += -std=gnu++17
endif
endif
endif
# -----------------------------------------------------------------------------