-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
244 lines (205 loc) · 7.64 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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
cmake_minimum_required(VERSION 3.21.0)
set(CMAKE_CXX_STANDARD 20)
set(ABSL_PROPAGATE_CXX_STD ON)
project(sidebands)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include(NuGet)
# Third party packages are pulled in via FetchContent
include(FetchContent)
# VST3SDK
FetchContent_Declare(
vst3sdk
GIT_REPOSITORY https://github.com/steinbergmedia/vst3sdk.git
GIT_SHALLOW 1
)
FetchContent_MakeAvailable(vst3sdk)
#set(SMTG_CREATE_BUNDLE_FOR_WINDOWS OFF)
set(SMTG_ENABLE_TARGET_VARS_LOG ON)
# The samples were useful for looking at, but now they're bloating the build dir.
set(SMTG_ADD_VST3_PLUGINS_SAMPLES OFF)
set(SMTG_ADD_VST3_HOSTING_SAMPLES OFF)
set(SMTG_CREATE_PLUGIN_LINK ON)
# If validation is on then the execution of the host in debug seems to fail
set(SMTG_RUN_VST_VALIDATOR OFF)
# We don't want VSTGUI to bloat the binary.
set(SMTG_ADD_VSTGUI OFF)
# Abseil (and probably others) will fail in VST load if shared libs are on.
set(BUILD_SHARED_LIBS FALSE)
# Abseil link on Linux will fail without this.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(SMTG_CREATE_MODULE_INFO OFF)
if (NOT vst3sdk_SOURCE_DIR)
message(FATAL_ERROR "Path to VST3 SDK is empty!")
endif ()
# Glog
FetchContent_Declare(
glog
GIT_REPOSITORY https://github.com/google/glog.git
GIT_SHALLOW 1
)
FetchContent_MakeAvailable(glog)
# Abseil
FetchContent_Declare(
abseil
GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git
GIT_TAG c2ef7033380a3d8661fee76465097422170fb653
)
FetchContent_MakeAvailable(abseil)
# json
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.10.5/json.tar.xz)
FetchContent_MakeAvailable(json)
# vectorclass
FetchContent_Declare(
vectorclass
GIT_REPOSITORY https://github.com/vectorclass/version2.git
GIT_SHALLOW 1
)
FetchContent_MakeAvailable(vectorclass)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.11.0
GIT_SHALLOW 1
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
set(BUILD_GTEST ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
# vstwebview
FetchContent_Declare(
vstwebview
GIT_REPOSITORY https://github.com/rdaum/vstwebview.git
GIT_TAG main
)
FetchContent_MakeAvailable(vstwebview)
# sigslot
FetchContent_Declare(
sigslot
GIT_REPOSITORY https://github.com/palacaze/sigslot.git
)
FetchContent_MakeAvailable(sigslot)
IF (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast /arch:AVX2 /DINSTRSET=7 /await")
elseif(UNIX)
if(NOT APPLE)
add_compile_options(-ffast-math -mavx2 -fabi-version=0)
else()
add_compile_options(--std=c++17)
endif()
endif()
add_custom_target(npm-dependencies-install
COMMAND npm install -D
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/source/controller/webui)
add_custom_target(perform-webpack
COMMAND npx webpack --config ${CMAKE_SOURCE_DIR}/source/controller/webui/webpack.config.js --env outdir=${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/source/controller/webui
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/dist/main.js
)
add_dependencies(perform-webpack npm-dependencies-install)
smtg_enable_vst3_sdk()
smtg_add_vst3plugin(sidebands
source/constants.h
source/globals.h
source/globals.cc
source/tags.h
source/tags.cc
source/version.h
source/sidebands_cids.h
source/sidebands_entry.cc
source/processor/sidebands_processor.h
source/processor/sidebands_processor.cc
source/processor/patch_processor.h
source/processor/patch_processor.cc
source/processor/events.h
source/processor/util/processor_param_value.h
source/processor/util/parameter.cc
source/processor/util/parameter.h
source/processor/util/sample_accurate_value.h
source/processor/util/sample_accurate_value.cc
source/processor/util/parameter.cc
source/processor/util/parameter.h
source/processor/util/processor_param_value.h
source/dsp/oscbuffer.cc
source/dsp/oscbuffer.h
source/dsp/integrator.h
source/dsp/integrator.cc
source/dsp/dc_block.h
source/dsp/dc_block.cc
source/dsp/fft.cc
source/dsp/fft.h
source/processor/synthesis/envgen.h
source/processor/synthesis/envgen.cc
source/processor/synthesis/lfo.h
source/processor/synthesis/lfo.cc
source/processor/synthesis/oscillator.h
source/processor/synthesis/oscillator.cc
source/processor/synthesis/generator.h
source/processor/synthesis/generator.cc
source/processor/synthesis/player.h
source/processor/synthesis/player.cc
source/processor/synthesis/voice.h
source/processor/synthesis/voice.cc
source/processor/synthesis/modulation_source.h
source/controller/sidebands_controller.h
source/controller/sidebands_controller.cc
source/controller/patch_controller.h
source/controller/patch_controller.cc
source/controller/webui/index.ts
source/controller/webui/view/pureknob.ts
source/controller/webui/view/templates.tsx
source/controller/webui/view/controls.ts
source/controller/webui/view/envelope_editor_view.ts
source/controller/webui/view/generator_tab_view.ts
source/controller/webui/view/main_view.ts
source/controller/webui/view/views.ts
source/controller/webui/model/sidebands_model.ts
source/controller/webui/model/vst_model.ts
source/controller/webui/style.css
source/controller/webui/index.html
)
add_dependencies(sidebands perform-webpack)
add_dependencies(sidebands vstwebview)
smtg_target_add_plugin_resource(sidebands source/controller/webui/index.html)
smtg_target_add_plugin_resource(sidebands source/controller/webui/style.css)
smtg_target_add_plugin_resource(sidebands resource/MetalSwitchOff.png)
smtg_target_add_plugin_resource(sidebands resource/MetalSwitchOn.png)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/dist/main.js PROPERTIES GENERATED TRUE)
smtg_target_add_plugin_resource(sidebands ${CMAKE_CURRENT_BINARY_DIR}/dist/main.js)
smtg_target_add_plugin_snapshots(sidebands
RESOURCES
resource/7A5DD92AB0615F028293F8308139D3CE_snapshot.png
resource/7A5DD92AB0615F028293F8308139D3CE_snapshot_2.0x.png
)
target_link_libraries(sidebands
PRIVATE
vstwebview
sdk
glog
absl::strings
absl::statusor
nlohmann_json::nlohmann_json
${PLATFORM_LIBRARIES}
)
target_include_directories(sidebands PRIVATE source ${vectorclass_SOURCE_DIR} ${sigslot_SOURCE_DIR}/include)
if (SMTG_MAC)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12)
smtg_target_set_bundle(sidebands
BUNDLE_IDENTIFIER com.thimbleware.sidebands
INFOPLIST "${CMAKE_CURRENT_LIST_DIR}/resource/Info.plist" PREPROCESS
)
smtg_target_set_debug_executable(sidebands
"/Applications/VST3PluginTestHost.app"
"--pluginfolder;$(BUILT_PRODUCTS_DIR)"
)
elseif (SMTG_WIN)
target_sources(sidebands PRIVATE
resource/win32resource.rc
)
if (MSVC)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT sidebands)
smtg_target_set_debug_executable(sidebands
"$(ProgramW6432)/Steinberg/VST3PluginTestHost/VST3PluginTestHost.exe"
"--pluginfolder \"$(OutDir)/\""
)
endif ()
endif (SMTG_MAC)