forked from surge-synthesizer/b-step
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
298 lines (262 loc) · 9.52 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
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
# This file was generated by FRUT's Jucer2CMake from "g-step.jucer"
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE STRING "Minimum macOS version")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project("B-Step" VERSION 2.1.0 LANGUAGES C CXX ASM)
# Calculate bitness
math(EXPR BITS "8*${CMAKE_SIZEOF_VOID_P}")
message(STATUS "Targeting ${BITS}-bit configuration")
option(BSTEP_COPY_PLUGIN_AFTER_BUILD "Copy JUCE Plugins after built" OFF)
option(BSTEP_RELIABLE_VERSION_INFO "Update version info on every build (off: generate only at configuration time)" ON)
set(BSTEP_JUCE_PATH "${CMAKE_SOURCE_DIR}/libs/JUCE" CACHE STRING "Path to JUCE library source tree")
add_subdirectory(${BSTEP_JUCE_PATH} ${CMAKE_BINARY_DIR}/JUCE EXCLUDE_FROM_ALL)
add_subdirectory(libs/clap-juce-extensions EXCLUDE_FROM_ALL)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_STANDARD 17)
set(BSTEP_JUCE_FORMATS VST3 Standalone)
if(APPLE)
list(APPEND BSTEP_JUCE_FORMATS AU)
endif()
if(DEFINED ENV{VST2SDK_DIR})
file(TO_CMAKE_PATH "$ENV{VST2SDK_DIR}" JUCE_VST2_DIR)
juce_set_vst2_sdk_path(${JUCE_VST2_DIR})
list(APPEND BSTEP_JUCE_FORMATS VST)
message(STATUS "VST2 SDK found at $ENV{VST2SDK_DIR}")
# VST2 headers are invalid UTF-8
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/wd4828>)
endif()
if(JUCE_SUPPORTS_LV2)
list(APPEND BSTEP_JUCE_FORMATS LV2)
message(STATUS "Including JUCE LV2 support. You will need the LV2 fork of JUCE!")
message(STATUS "Turning off deprecation warning to error, since JUCE LV2 uses deprecated APIs")
add_compile_options(-Wno-error=deprecated-declarations)
endif()
if(EXISTS ${BSTEP_JUCE_PATH}/modules/juce_audio_plugin_client/LV2/juce_LV2_Client.cpp)
message(STATUS "JUCE7 LV2 support present; activating LV2")
list(APPEND BSTEP_JUCE_FORMATS LV2)
endif()
message(STATUS "Building B-Step in formats: ${BSTEP_JUCE_FORMATS}")
juce_add_plugin(B-Step
VERSION "2.1"
BUNDLE_ID "org.surge-synth-team.bstep"
COMPANY_NAME "Surge Synth Team"
PLUGIN_MANUFACTURER_CODE "VmbA"
COMPANY_COPYRIGHT "Copyright Thomas Arndt and Authors in Github, 2010-2022"
COMPANY_WEBSITE "https://surge-synth-team.org"
FORMATS ${BSTEP_JUCE_FORMATS}
NEEDS_MIDI_INPUT TRUE
NEEDS_MIDI_OUTPUT TRUE
IS_MIDI_EFFECT TRUE
IS_SYNTH TRUE
PLUGIN_NAME "B-Step Sequencer"
DESCRIPTION "Step Sequencer"
PLUGIN_MANUFACTURER_CODE "VmbA"
PLUGIN_CODE "bPlg"
AU_EXPORT_PREFIX "bstepAU"
LV2URI "https://surge-synthesizer.github.io/lv2/b-step"
ICON_BIG "${CMAKE_SOURCE_DIR}/resources/Images/b-step-appicon.png"
COPY_PLUGIN_AFTER_BUILD ${BSTEP_COPY_PLUGIN_AFTER_BUILD}
)
clap_juce_extensions_plugin(TARGET B-Step
CLAP_ID "org.sure-synth-team.bstep"
CLAP_FEATURES "note-effect" sequencer "step sequencer")
if(BSTEP_RELIABLE_VERSION_INFO)
message(STATUS "VERSION IS ${CMAKE_PROJECT_VERSION_MAJOR} ${CMAKE_PROJECT_VERSION_MINOR}")
add_custom_target(version-info BYPRODUCTS ${CMAKE_BINARY_DIR}/geninclude/version.cpp
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -D CMAKE_PROJECT_VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR}
-D CMAKE_PROJECT_VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR}
-D BSTEPSRC=${CMAKE_SOURCE_DIR} -D BSTEPBLD=${CMAKE_BINARY_DIR}
-D AZURE_PIPELINE=${AZURE_PIPELINE}
-D WIN32=${WIN32}
-D CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-D CMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}
-D CMAKE_CXX_COMPILER_VERSION=${CMAKE_CXX_COMPILER_VERSION}
-P ${CMAKE_SOURCE_DIR}/cmake/versiontools.cmake
)
add_dependencies(${PROJECT_NAME} version-info)
else()
set(BSTEPSRC ${CMAKE_SOURCE_DIR})
set(BSTEPBLD ${CMAKE_BINARY_DIR})
include(${CMAKE_SOURCE_DIR}/cmake/versiontools.cmake)
endif()
target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_BINARY_DIR}/geninclude/version.cpp)
message(STATUS " FIXME - We obvioulsy over-glob here")
file(GLOB_RECURSE BSTEP_RESOURCES
LIST_DIRECTORIES false
${CMAKE_SOURCE_DIR}/resources/*)
juce_add_binary_data(B-Step-Binary SOURCES ${BSTEP_RESOURCES})
target_compile_definitions(B-Step PUBLIC
JUCE_ALSA=1
JUCE_CHECK_MEMORY_LEAKS=0
JUCE_DIRECTSOUND=1
JUCE_ENABLE_LIVE_CONSTANT_EDITOR=0
JUCE_FORCE_DEBUG=0
JUCE_JACK=1
JUCE_LOG_ASSERTIONS=0
JUCE_PLUGINHOST_AU=0
JUCE_PLUGINHOST_VST3=0
JUCE_PLUGINHOST_VST=0
JUCE_QUICKTIME=0
JUCE_USE_ANDROID_OPENSLES=0
JUCE_USE_CDBURNER=0
JUCE_USE_CDREADER=0
JUCE_USE_COREIMAGE_LOADER=1
JUCE_USE_CURL=0
JUCE_USE_DIRECTWRITE=1
JUCE_USE_FLAC=1
JUCE_USE_LAME_AUDIO_FORMAT=1
JUCE_USE_MP3AUDIOFORMAT=1
JUCE_USE_OGGVORBIS=1
JUCE_USE_WINDOWS_MEDIA_FORMAT=1
JUCE_WASAPI=1
JUCE_WEB_BROWSER=0
JUCE_VST3_CAN_REPLACE_VST2=0
# Note if you are building the code under MIT you need a license to use JUCE to set this to 0
JUCE_DISPLAY_SPLASH_SCREEN=0
JUCE_REPORT_APP_USAGE=0
JUCE_MODAL_LOOPS_PERMITTED=1
FIXMEPORT=jassertfalse
)
if(DEFINED ENV{ASIOSDK_DIR} OR BUILD_USING_MY_ASIO_LICENSE)
if(BUILD_USING_MY_ASIO_LICENSE)
message(STATUS "** BUILD USING OWN ASIO LICENSE **")
message(STATUS "The resulting B-Step standalone executable is not licensed for distribution!")
message(STATUS "Fetching ASIO SDK...")
set(ASIOSDK_DIR ${CMAKE_BINARY_DIR}/asio/asiosdk)
add_custom_target(bstep-get-local-asio)
add_custom_command(
TARGET bstep-get-local-asio
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/asio
COMMAND ${CMAKE_COMMAND} -D ASIO_SDK_DESTINATION=${CMAKE_BINARY_DIR}/asio -P cmake/get-asio.cmake
)
add_dependencies(${PROJECT_NAME} bstep-get-local-asio)
else()
file(TO_CMAKE_PATH "$ENV{ASIOSDK_DIR}" ASIOSDK_DIR)
message(STATUS "ASIO SDK found at ${ASIOSDK_DIR}")
message(STATUS "The resulting B-Step standalone executable is not licensed for distribution!")
endif()
target_compile_definitions(${PROJECT_NAME} PUBLIC JUCE_ASIO=1)
target_include_directories(${PROJECT_NAME} PUBLIC ${ASIOSDK_DIR}/common)
set(JUCE_ASIO_SUPPORT TRUE)
endif()
target_include_directories(B-Step PRIVATE src)
target_sources(B-Step PRIVATE
"src/AppInstanceStore.cpp"
"src/AppParameterList.cpp"
"src/AppStyleEditor.cpp"
"src/AppStyles.cpp"
"src/Controller.cpp"
"src/ControllerMidiLearn.cpp"
"src/CoreDatastructure.cpp"
"src/CoreLaunchpad.cpp"
"src/CoreSequencer.cpp"
"src/DoYouKnow.cpp"
"src/FileIO.cpp"
"src/MIDIIO.cpp"
"src/MIDILearn.cpp"
"src/MenuBarLeft.cpp"
"src/MenuBarRight.cpp"
"src/Parameter.cpp"
"src/PluginProcessor.cpp"
"src/SliderValuePopup.cpp"
"src/UIEditorToolbar.cpp"
"src/UIHtmlView.cpp"
"src/UI_Button.cpp"
"src/UI_Label.cpp"
"src/UI_Slider.cpp"
"src/UI_Tools.cpp"
"src/UiChordEditorChordOffset.cpp"
"src/UiChordEditorStringOffset.cpp"
"src/UiColumn16.cpp"
"src/UiColumnWrapper.cpp"
"src/UiDualAudioPlayer.cpp"
"src/UiDualDownload.cpp"
"src/UiEditorAbout.cpp"
"src/UiEditorChords.cpp"
"src/UiEditorClipboard.cpp"
"src/UiEditorFileManager.cpp"
"src/UiEditorInputPopup.cpp"
"src/UiEditorKeyboard.cpp"
"src/UiEditorMidiLearn.cpp"
"src/UiEditorRightMainwindows.cpp"
"src/UiEditorSettings.cpp"
"src/UiEditorSetup.cpp"
"src/UiFileView.cpp"
"src/UiLeftsideCC.cpp"
"src/UiLeftsideLabel.cpp"
"src/UiLeftsideLabelModel.cpp"
"src/UiLeftsideModelLabel.cpp"
"src/UiLeftsideStartStopPause.cpp"
"src/UiLookAndFeel.cpp"
"src/UiMainWindow.cpp"
"src/UiNotificationAnimation.cpp"
"src/UiQuestionIsYourFriend.cpp"
"src/UiSettings.cpp"
"src/UiTextImExport.cpp"
src/ticker.cpp
)
if(APPLE)
# these all need fixing obviously. The strategy I've used on mac here is
# 1: Turn off the juce suggested warning flags
# 2: Turn on werror (mac only)
# 3: Turn off every no-blah which stops me building (and apply these on linux too)
#
# Then one by one we should document each of these and decide if we want to
# keep them or fix them. Most probably fix.
message(STATUS "Turning off a collection of legitimate compiler warnings")
target_compile_options(${PROJECT_NAME} PUBLIC
#-Werror
-Wlogical-op-parentheses
-Wno-deprecated-declarations
-Wno-implicit-float-conversion
-Wno-inconsistent-missing-destructor-override
-Wno-inconsistent-missing-override
-Wno-switch-enum
)
elseif(UNIX)
message(STATUS "Turning off a collection of legitimate compiler warnings")
target_compile_options(${PROJECT_NAME} PUBLIC
#-Werror
-Wno-deprecated-declarations
)
endif()
target_link_libraries(B-Step
PRIVATE
juce::juce_audio_basics
juce::juce_audio_devices
juce::juce_audio_formats
juce::juce_audio_plugin_client
juce::juce_audio_processors
juce::juce_audio_utils
juce::juce_core
juce::juce_data_structures
juce::juce_events
juce::juce_graphics
juce::juce_gui_basics
juce::juce_gui_extra
B-Step-Binary
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
# juce::juce_recommended_warning_flags
)
include(cmake/basic-installer.cmake)
# clang-format pipeline check
add_custom_target(code-quality-pipeline-checks)
set(CLANG_FORMAT_DIRS src)
set(CLANG_FORMAT_EXTS cpp h)
foreach(dir ${CLANG_FORMAT_DIRS})
foreach(ext ${CLANG_FORMAT_EXTS})
list(APPEND CLANG_FORMAT_GLOBS "':(glob)${dir}/**/*.${ext}'")
endforeach()
endforeach()
add_custom_command(TARGET code-quality-pipeline-checks
POST_BUILD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E echo About to check clang-format using clang-format-12
COMMAND git ls-files -- ${CLANG_FORMAT_GLOBS} | xargs clang-format-12 --dry-run --Werror
)