forked from plugdata-team/plugdata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·468 lines (383 loc) · 19.9 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
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
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
cmake_minimum_required(VERSION 3.15)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(RUN_CLANG_TIDY "" OFF)
option(ENABLE_TESTING "" OFF)
option(ENABLE_SFONT "" ON)
option(VERBOSE "" OFF)
set (CMAKE_CXX_STANDARD 20)
function(message)
if (NOT MESSAGE_QUIET)
_message(${ARGN})
endif()
endfunction()
if(APPLE)
set(CMAKE_XCODE_BUILD_SYSTEM "12" CACHE STRING "" FORCE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "Minimum OS X deployment version")
if(RUN_CLANG_TIDY)
set(CMAKE_OSX_ARCHITECTURES "arm64;" CACHE STRING "" FORCE)
else()
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
endif()
endif()
if(RUN_CLANG_TIDY)
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
endif()
set(HARDENED_RUNTIME_ENABLED YES)
set(HARDENED_RUNTIME_OPTIONS "com.apple.security.device.audio-input")
set(JUCE_ENABLE_MODULE_SOURCE_GROUPS ON CACHE BOOL "" FORCE)
set_property(GLOBAL PROPERTY USE_FOLDERS YES)
project(plugdata VERSION 0.7.0 LANGUAGES C CXX)
add_subdirectory(Libraries/ EXCLUDE_FROM_ALL)
cmake_policy(SET CMP0091 NEW)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
message("-- Packaging resources")
execute_process(COMMAND python3 package_resources.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Scripts)
set(PLUGDATA_VERSION "0.7.0")
set(PLUGDATA_COMPANY_NAME "plugdata")
set(PLUGDATA_COMPANY_COPYRIGHT "plugdata by Timothy Schoen")
set(PLUGDATA_COMPANY_WEBSITE "github.com/plugdata-team/plugdata")
if(APPLE)
set(PLUGDATA_ICON_BIG "${CMAKE_CURRENT_SOURCE_DIR}/Resources/Icons/plugdata_logo_mac.png")
else()
set(PLUGDATA_ICON_BIG "${CMAKE_CURRENT_SOURCE_DIR}/Resources/Icons/plugdata_logo.png")
endif()
set(PLUGDATA_PLUGINS_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/Plugins")
set(SOURCES_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Source)
file(GLOB PlugDataGlobalSources
${CMAKE_CACHEFILE_DIR}/plugdata_artefacts/JuceLibraryCode/JuceHeader.h)
file(GLOB PlugDataSources
${SOURCES_DIRECTORY}/*.h
${SOURCES_DIRECTORY}/*.cpp
${SOURCES_DIRECTORY}/Utility/*.h
${SOURCES_DIRECTORY}/Utility/*.cpp
${SOURCES_DIRECTORY}/Objects/*.h
${SOURCES_DIRECTORY}/Objects/*.cpp
${SOURCES_DIRECTORY}/Sidebar/*.h
${SOURCES_DIRECTORY}/Sidebar/*.cpp
${SOURCES_DIRECTORY}/Dialogs/*.h
${SOURCES_DIRECTORY}/Dialogs/*.cpp
${SOURCES_DIRECTORY}/Pd/*.cpp
${SOURCES_DIRECTORY}/Pd/*.h
${SOURCES_DIRECTORY}/Heavy/*.cpp
${SOURCES_DIRECTORY}/Heavy/*.h
)
source_group("Source" FILES ${PlugDataGlobalSources})
if(APPLE)
list(APPEND PlugDataSources ${SOURCES_DIRECTORY}/Utility/FileSystemWatcher.mm ${SOURCES_DIRECTORY}/Utility/OSUtils.mm)
else()
list(APPEND PlugDataSources ${SOURCES_DIRECTORY}/Utility/FileSystemWatcher.cxx)
endif()
foreach(core_SOURCE ${PlugDataSources})
# Get the path of the file relative to the current source directory
file(RELATIVE_PATH core_SOURCE_relative "${SOURCES_DIRECTORY}" "${core_SOURCE}")
# Get the relative folder path
get_filename_component(core_SOURCE_dir "${core_SOURCE_relative}" PATH)
# Convert forward slashes to backslashes to get source group identifiers
string(REPLACE "/" "\\" core_SOURCE_group "${core_SOURCE_dir}")
source_group("Source\\${core_SOURCE_group}" FILES "${core_SOURCE}")
endforeach()
file(GLOB plugdata_standaloneSources
${SOURCES_DIRECTORY}/Standalone/*.cpp
${SOURCES_DIRECTORY}/Standalone/*.h)
source_group("Source\\Standalone" FILES ${plugdata_standaloneSources})
juce_add_gui_app(plugdata_standalone
PRODUCT_NAME "plugdata"
VERSION ${PLUGDATA_VERSION}
ICON_BIG ${PLUGDATA_ICON_BIG}
MICROPHONE_PERMISSION_ENABLED TRUE
HARDENED_RUNTIME_ENABLED ${HARDENED_RUNTIME_ENABLED}
HARDENED_RUNTIME_OPTIONS ${HARDENED_RUNTIME_OPTIONS}
DOCUMENT_BROWSER_ENABLED TRUE
DOCUMENT_EXTENSIONS .pd
BUNDLE_ID com.plugdata.plugdata
)
juce_add_plugin(plugdata
VERSION ${PLUGDATA_VERSION}
COMPANY_NAME ${PLUGDATA_COMPANY_NAME}
COMPANY_COPYRIGHT ${PLUGDATA_COMPANY_COPYRIGHT}
COMPANY_WEBSITE ${PLUGDATA_COMPANY_WEBSITE}
PLUGIN_DESCRIPTION "A plugin that loads Pure Data patches"
ICON_BIG ${PLUGDATA_ICON_BIG}
MICROPHONE_PERMISSION_ENABLED TRUE
HARDENED_RUNTIME_ENABLED ${HARDENED_RUNTIME_ENABLED}
HARDENED_RUNTIME_OPTIONS ${HARDENED_RUNTIME_OPTIONS}
IS_SYNTH TRUE
NEEDS_MIDI_INPUT TRUE
NEEDS_MIDI_OUTPUT TRUE
IS_MIDI_EFFECT FALSE
EDITOR_WANTS_KEYBOARD_FOCUS TRUE
COPY_PLUGIN_AFTER_BUILD FALSE
PLUGIN_MANUFACTURER_CODE PlDt
PLUGIN_CODE PdIn
FORMATS AU VST3 LV2 CLAP
LV2URI https://github.com/timothyschoen/plugdata
PRODUCT_NAME "plugdata"
AU_MAIN_TYPE kAudioUnitType_MusicDevice
VST3_CATEGORIES Instrument
VST2_CATEGORY kPlugCategSynth)
juce_add_plugin(plugdata_fx
VERSION ${PLUGDATA_VERSION}
COMPANY_NAME ${PLUGDATA_COMPANY_NAME}
COMPANY_COPYRIGHT ${PLUGDATA_COMPANY_COPYRIGHT}
COMPANY_WEBSITE ${PLUGDATA_COMPANY_WEBSITE}
ICON_BIG ${PLUGDATA_ICON_BIG}
HARDENED_RUNTIME_ENABLED ${HARDENED_RUNTIME_ENABLED}
HARDENED_RUNTIME_OPTIONS ${HARDENED_RUNTIME_OPTIONS}
PLUGIN_DESCRIPTION "A plugin that loads Pure Data patches"
IS_SYNTH FALSE
NEEDS_MIDI_INPUT TRUE
NEEDS_MIDI_OUTPUT TRUE
IS_MIDI_EFFECT FALSE
EDITOR_WANTS_KEYBOARD_FOCUS TRUE
COPY_PLUGIN_AFTER_BUILD FALSE
PLUGIN_MANUFACTURER_CODE PlDt
PLUGIN_CODE PdFx
FORMATS AU VST3 LV2 CLAP
LV2URI https://github.com/timothyschoen/plugdata-fx
PRODUCT_NAME "plugdata-fx"
AU_MAIN_TYPE kAudioUnitType_MusicEffect
VST3_CATEGORIES Fx
VST2_CATEGORY kPlugCategEffect)
if(APPLE)
juce_add_plugin(plugdata_midi
VERSION ${PLUGDATA_VERSION}
COMPANY_NAME ${PLUGDATA_COMPANY_NAME}
COMPANY_COPYRIGHT ${PLUGDATA_COMPANY_COPYRIGHT}
COMPANY_WEBSITE ${PLUGDATA_COMPANY_WEBSITE}
ICON_BIG ${PLUGDATA_ICON_BIG}
HARDENED_RUNTIME_ENABLED ${HARDENED_RUNTIME_ENABLED}
HARDENED_RUNTIME_OPTIONS ${HARDENED_RUNTIME_OPTIONS}
PLUGIN_DESCRIPTION "A plugin that loads Pure Data patches"
IS_SYNTH FALSE
NEEDS_MIDI_INPUT TRUE
NEEDS_MIDI_OUTPUT TRUE
IS_MIDI_EFFECT TRUE
EDITOR_WANTS_KEYBOARD_FOCUS TRUE
COPY_PLUGIN_AFTER_BUILD FALSE
PLUGIN_MANUFACTURER_CODE PlDt
PLUGIN_CODE PdMd
FORMATS AU
PRODUCT_NAME "plugdata-midi"
AU_MAIN_TYPE kAudioUnitType_MIDIProcessor)
endif()
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.21")
# Silence excessive messaging from juce-clap-extensions
# Enable verbose flag to see these messages
if(VERBOSE)
else()
set(MESSAGE_QUIET ON)
endif()
clap_juce_extensions_plugin(TARGET plugdata
CLAP_ID "com.timothyschoen.plugdata"
CLAP_FEATURES "instrument")
clap_juce_extensions_plugin(TARGET plugdata_fx
CLAP_ID "com.timothyschoen.plugdata-fx"
CLAP_FEATURES "effect")
if(VERBOSE)
else()
unset(MESSAGE_QUIET)
endif()
else()
message("\n-- Warning: Building CLAP plugins requires at least cmake 3.21, you have ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}")
message("-- CLAP plugin build will be disabed\n")
endif()
if(APPLE)
set_target_properties(plugdata PROPERTIES CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set_target_properties(plugdata_fx PROPERTIES CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
endif()
juce_generate_juce_header(plugdata_standalone)
set_target_properties(plugdata_standalone PROPERTIES CXX_STANDARD 20)
target_sources(plugdata_standalone PRIVATE ${PlugDataSources} ${plugdata_standaloneSources})
juce_generate_juce_header(plugdata)
set_target_properties(plugdata PROPERTIES CXX_STANDARD 20)
target_sources(plugdata PRIVATE ${PlugDataSources} ${plugdata_standaloneSources})
juce_generate_juce_header(plugdata_fx)
set_target_properties(plugdata_fx PROPERTIES CXX_STANDARD 20)
target_sources(plugdata_fx PRIVATE ${PlugDataSources})
if(APPLE)
juce_generate_juce_header(plugdata_midi)
set_target_properties(plugdata_midi PROPERTIES CXX_STANDARD 20)
set_target_properties(plugdata_midi PROPERTIES CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
target_sources(plugdata_midi PRIVATE ${PlugDataSources})
endif()
set(LIBPD_MULTI_COMPILE_DEFINITIONS
PDINSTANCE=1
PDTHREADS=1
)
set(STANDALONE_COMPILE_DEFINITIONS
JUCE_USE_CUSTOM_PLUGIN_STANDALONE_APP=1
PLUGDATA_STANDALONE=1)
set(PLUGDATA_COMPILE_DEFINITIONS
JUCE_APP_CONFIG_HEADER="${SOURCES_DIRECTORY}/PluginConfig.h"
JUCE_DONT_DECLARE_PROJECTINFO=1
JUCE_ALLOW_STATIC_NULL_VARIABLES=0
JUCE_DISPLAY_SPLASH_SCREEN=0
JUCE_VST3_CAN_REPLACE_VST2=0
JUCE_REPORT_APP_USAGE=0
JUCE_LOG_ASSERTIONS=1
JUCE_STRICT_REFCOUNTEDPOINTER=1
JUCE_WEB_BROWSER=0
PLUGDATA_VERSION="${PLUGDATA_VERSION}"
)
if(UNIX AND NOT APPLE)
set(PLUGDATA_COMPILE_DEFINITIONS
${PLUGDATA_COMPILE_DEFINITIONS}
JUCE_MODAL_LOOPS_PERMITTED=1
JUCE_USE_XRENDER=1
)
target_link_libraries(plugdata_standalone PUBLIC "-Wl,-export-dynamic")
endif()
target_compile_definitions(plugdata_standalone PUBLIC ${PLUGDATA_COMPILE_DEFINITIONS} ${STANDALONE_COMPILE_DEFINITIONS})
target_compile_definitions(plugdata PUBLIC ${PLUGDATA_COMPILE_DEFINITIONS})
target_compile_definitions(plugdata PUBLIC ${LIBPD_MULTI_COMPILE_DEFINITIONS})
target_compile_definitions(plugdata_fx PUBLIC ${PLUGDATA_COMPILE_DEFINITIONS})
target_compile_definitions(plugdata_fx PUBLIC ${LIBPD_MULTI_COMPILE_DEFINITIONS})
if(APPLE)
target_compile_definitions(plugdata_midi PUBLIC ${PLUGDATA_COMPILE_DEFINITIONS})
target_compile_definitions(plugdata_midi PUBLIC ${LIBPD_MULTI_COMPILE_DEFINITIONS})
endif()
list(APPEND PLUGDATA_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/ELSE/sfont~/")
list(APPEND PLUGDATA_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/pure-data/src")
list(APPEND PLUGDATA_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/libpd/")
list(APPEND PLUGDATA_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/concurrentqueue/")
list(APPEND PLUGDATA_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Source/")
target_include_directories(plugdata_standalone PUBLIC "$<BUILD_INTERFACE:${PLUGDATA_INCLUDE_DIRECTORY}>")
target_include_directories(plugdata PUBLIC "$<BUILD_INTERFACE:${PLUGDATA_INCLUDE_DIRECTORY}>")
target_include_directories(plugdata_fx PUBLIC "$<BUILD_INTERFACE:${PLUGDATA_INCLUDE_DIRECTORY}>")
if(APPLE)
target_include_directories(plugdata_midi PUBLIC "$<BUILD_INTERFACE:${PLUGDATA_INCLUDE_DIRECTORY}>")
endif()
file(GLOB PlugDataBinaryDataSources
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fonts/IconFont.ttf
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fonts/InterUnicode_*.ttf
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fonts/InterBold.ttf
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fonts/InterSemiBold.ttf
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fonts/InterThin.ttf
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fonts/IBMPlexMono.ttf
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fonts/GoNotoCurrent.ttf
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Icons/plugdata_logo.png
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Filesystem_*.zip
)
file(GLOB StandaloneBinarySources
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Extra/GeneralUser_GS.sf3
)
juce_add_binary_data(PlugDataBinaryData SOURCES ${PlugDataBinaryDataSources})
set_target_properties(PlugDataBinaryData PROPERTIES POSITION_INDEPENDENT_CODE ON)
juce_add_binary_data(StandaloneBinaryData HEADER_NAME "StandaloneBinaryData.h" NAMESPACE StandaloneBinaryData SOURCES ${StandaloneBinarySources} )
set_target_properties(StandaloneBinaryData PROPERTIES POSITION_INDEPENDENT_CODE ON)
set(libs
PlugDataBinaryData
juce::juce_audio_utils
juce::juce_audio_plugin_client
juce::juce_dsp
)
# Add pd file icons for mac
if(APPLE)
set_target_properties(plugdata_standalone PROPERTIES
RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Resources/Icons/pd-file.icns")
endif()
if(MSVC)
list(APPEND libs pthreadVC3)
elseif(APPLE)
target_link_libraries(plugdata_midi PRIVATE pd-multi ${libs})
elseif(UNIX AND NOT APPLE)
list(APPEND libs curl X11)
endif()
if(MSVC)
target_link_libraries(plugdata_standalone PRIVATE pd ${CMAKE_CURRENT_SOURCE_DIR}/Plugins/Standalone/pd.lib ${libs} StandaloneBinaryData)
else()
target_link_libraries(plugdata_standalone PRIVATE pd ${libs} StandaloneBinaryData)
endif()
target_link_libraries(plugdata PRIVATE pd-multi ${libs})
target_link_libraries(plugdata_fx PRIVATE pd-multi ${libs})
set_target_properties(plugdata_standalone PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/Standalone)
set_target_properties(plugdata_standalone PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/Standalone)
set_target_properties(plugdata_standalone PROPERTIES BUNDLE_OUTPUT_DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/Standalone)
set_target_properties(plugdata_standalone PROPERTIES BUNDLE_OUTPUT_DIRECTORY_DEBUG ${PLUGDATA_PLUGINS_LOCATION}/Standalone)
set_target_properties(plugdata_standalone PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PLUGDATA_PLUGINS_LOCATION}/Standalone)
set_target_properties(plugdata_standalone PROPERTIES LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PLUGDATA_PLUGINS_LOCATION}/Standalone)
set_target_properties(plugdata_standalone PROPERTIES BUNDLE_OUTPUT_DIRECTORY_RELEASE ${PLUGDATA_PLUGINS_LOCATION}/Standalone)
set_target_properties(plugdata_standalone PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PLUGDATA_PLUGINS_LOCATION}/Standalone)
set_target_properties(plugdata_standalone PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PLUGDATA_PLUGINS_LOCATION}/Standalone)
set_target_properties(plugdata PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PLUGDATA_PLUGINS_LOCATION})
set_target_properties(plugdata PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGDATA_PLUGINS_LOCATION})
set_target_properties(plugdata_fx PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PLUGDATA_PLUGINS_LOCATION})
set_target_properties(plugdata_fx PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGDATA_PLUGINS_LOCATION})
if(APPLE)
set_target_properties(plugdata_midi PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGDATA_PLUGINS_LOCATION})
set_target_properties(plugdata_midi PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGDATA_PLUGINS_LOCATION})
endif()
if(RUN_CLANG_TIDY)
find_program( CLANG_TIDY_EXE NAMES "clang-tidy" DOC "Path to clang-tidy executable" )
if(NOT CLANG_TIDY_EXE)
message(STATUS "clang-tidy not found.")
else()
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-checks=clang-diagnostic-*,clang-diagnostic-unused-value,clang-analyzer-*,bugprone-*,performance-*,readability-*,-readability-magic-numbers,-readability-braces-around-statements,-readability-inconsistent-declaration-parameter-name,-readability-named-parameter --header-filter='.*'")
endif()
set_target_properties(plugdata_standalone PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}")
endif()
# Set up testing framework
if(ENABLE_TESTING)
enable_testing()
if(APPLE)
file(GLOB_RECURSE TestFiles CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/Tests/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Tests/*.mm")
else()
file(GLOB_RECURSE TestFiles CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/Tests/*.cpp")
endif()
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Tests PREFIX "" FILES ${TestFiles})
# Include Catch2
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Libraries/Catch2)
set(Catch2_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Libraries/Catch2)
add_executable(Tests ${TestFiles})
set_target_properties(Tests PROPERTIES CXX_STANDARD 20)
target_link_libraries(Tests PRIVATE Catch2::Catch2WithMain plugdata ${libs})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Tests PREFIX "" FILES ${TestFiles})
include(${Catch2_SOURCE_DIR}/extras/Catch.cmake)
catch_discover_tests(Tests)
target_compile_definitions(Tests PUBLIC TESTING=1)
target_include_directories(Tests PUBLIC PLUGDATA_INCLUDE_DIRECTORY)
target_include_directories(Tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Tests/)
target_include_directories(Tests PUBLIC "$<BUILD_INTERFACE:${PLUGDATA_INCLUDE_DIRECTORY}>")
set_target_properties(Tests PROPERTIES PREFIX "")
set_target_properties(Tests PROPERTIES CMAKE_CXX_VISIBILITY_PRESET hidden)
set_target_properties(Tests PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGDATA_PLUGINS_LOCATION})
set_target_properties(Tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PLUGDATA_PLUGINS_LOCATION})
set_property(TARGET Tests PROPERTY CXX_VISIBILITY_PRESET hidden)
set_property(TARGET Tests PROPERTY VISIBILITY_INLINES_HIDDEN ON)
endif()
if(MSVC)
set_target_properties(pthreadVC3 pthreadVSE3 pthreadVCE3 PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
endif()
set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
WORLD_READ
WORLD_WRITE
WORLD_EXECUTE
)
if(APPLE)
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/VST3/plugdata.vst3 DESTINATION "/Library/Audio/Plug-ins/VST3")
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/VST3/plugdata-fx.vst3 DESTINATION "/Library/Audio/Plug-ins/VST3")
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/LV2/plugdata.lv2 DESTINATION "/Library/Audio/Plug-ins/LV2")
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/LV2/plugdata-fx.lv2 DESTINATION "/Library/Audio/Plug-ins/LV2")
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/AU/plugdata.component DESTINATION "/Library/Audio/Plug-ins/Components")
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/AU/plugdata-fx.component DESTINATION "/Library/Audio/Plug-ins/Components")
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/AU/plugdata-midi.component DESTINATION "/Library/Audio/Plug-ins/Components")
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/Standalone/plugdata.app DESTINATION "/Applications")
elseif(WIN32)
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/VST3/plugdata.vst3 DESTINATION "$ENV{PROGRAMFILES}/Common Files/VST3")
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/VST3/plugdata-fx.vst3 DESTINATION "$ENV{PROGRAMFILES}/Common Files/VST3")
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/LV2/plugdata.lv2 DESTINATION "$ENV{PROGRAMFILES}/Common Files/LV2")
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/LV2/plugdata-fx.lv2 DESTINATION "$ENV{PROGRAMFILES}/Common Files/LV2")
install(PROGRAMS ${PLUGDATA_PLUGINS_LOCATION}/Standalone/plugdata.exe DESTINATION "$ENV{PROGRAMFILES}/plugdata/")
install(PROGRAMS ${PLUGDATA_PLUGINS_LOCATION}/LV2/pd.dll DESTINATION "$ENV{PROGRAMFILES}/plugdata/")
elseif(UNIX AND NOT APPLE) # Linux or BSD
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/VST3/plugdata.vst3 DESTINATION "$ENV{HOME}/.vst3")
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/VST3/plugdata-fx.vst3 DESTINATION "$ENV{HOME}/.vst3")
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/LV2/plugdata.lv2 DESTINATION "$ENV{HOME}/.lv2")
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/LV2/plugdata-fx.lv2 DESTINATION "$ENV{HOME}/.lv2")
#TODO: install standalone and Kott's .desktop file
endif()
#add_custom_target(plugdata_standalone ALL)
#