-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
113 lines (102 loc) · 5.05 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
cmake_minimum_required(VERSION 3.11)
project(osccontrol-light VERSION 0.0.1)
find_package(JUCE CONFIG REQUIRED)
find_package(yaml-cpp REQUIRED)
function(add_osccontrol_target TARGET FORMATS)
juce_add_plugin(${TARGET}
# VERSION ... # Set this if the plugin version is different to the project version
# ICON_BIG ... # ICON_* arguments specify a path to an image file to use as an icon for the Standalone
# ICON_SMALL ...
COMPANY_NAME drlight # Specify the name of the plugin's author
IS_SYNTH FALSE # Is this a synth or an effect?
NEEDS_MIDI_INPUT FALSE # Does the plugin need midi input?
NEEDS_MIDI_OUTPUT FALSE # Does the plugin need midi output?
IS_MIDI_EFFECT FALSE # Is this plugin a MIDI effect?
# EDITOR_WANTS_KEYBOARD_FOCUS TRUE/FALSE # Does the editor need keyboard focus?
COPY_PLUGIN_AFTER_BUILD FALSE # Should the plugin be installed to a default location after building?
PLUGIN_MANUFACTURER_CODE drLt # A four-character manufacturer id with at least one upper-case character
# PLUGIN_CODE oscL # A unique four-character plugin id with at least one upper-case character
PLUGIN_NAME "${TARGET}"
FORMATS "${FORMATS}" # The formats to build. Other valid formats are: AAX Unity VST AU AUv3
PRODUCT_NAME "${TARGET}") # The name of the final executable, which can differ from the target name
endfunction()
function(configure_osccontrol_target TARGET)
juce_generate_juce_header(${TARGET})
target_sources(${TARGET} PRIVATE
Source/ControlContainer.cpp
Source/ControlContainer.h
Source/ControlElement.cpp
Source/ControlElementFactory.cpp
Source/ControlElementFactory.h
Source/ControlElement.h
Source/ControlElementHost.cpp
Source/ControlElementHost.h
Source/ControlElementKnob.cpp
Source/ControlElementKnob.h
Source/ControlElementToggle.cpp
Source/ControlElementToggle.h
Source/ControlElementUI.cpp
Source/ControlElementUI.h
Source/LayoutHints.cpp
Source/LayoutHints.h
Source/PluginEditor.cpp
Source/PluginEditor.h
Source/PluginProcessor.cpp
Source/PluginProcessor.h
Source/PresetPage.cpp
Source/PresetPage.h
Source/PresetParser.cpp
Source/PresetParser.h
Source/UIComponentFactory.cpp
Source/UIComponentFactory.h
)
target_compile_definitions(${TARGET} PUBLIC
# JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_plugin` call
JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_plugin` call
JUCE_VST3_CAN_REPLACE_VST2=0
JUCE_MODAL_LOOPS_PERMITTED=1 # allow modal loops for now to enable file chooser dialog
YAML_CPP_STATIC_DEFINE=1
)
if(EMBED_PRESETS AND NOT "${TARGET}" STREQUAL "osccontrol-light")
STRING(REGEX REPLACE "^osc-" "" PRESET ${TARGET})
target_compile_definitions("${TARGET}" PUBLIC EMBED_PRESET)
juce_add_binary_data("${TARGET}-data"
HEADER_NAME "EmbeddedPreset.h"
NAMESPACE "osccontrol_embedded_preset"
SOURCES "Presets/${PRESET}.yaml"
)
set_target_properties("${TARGET}-data" PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
target_link_libraries(${TARGET} PRIVATE "${TARGET}-data")
endif()
target_link_libraries(${TARGET} PRIVATE
osccontrol-light-data
juce::juce_audio_utils
juce::juce_osc
juce::juce_cryptography
yaml-cpp
)
endfunction()
# create the binary data target that is shared by all plugin instances
juce_add_binary_data(osccontrol-light-data SOURCES
Resources/drlight-eyesclosed.png
Resources/drlight-shout.png
Resources/list-icon.png
Resources/preset-folder-icon.png
Resources/reset-icon.png
Resources/SourceCodePro-Regular.otf
)
set_target_properties(osccontrol-light-data PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
# we always build the interactive gui version of the plugin as VST3 and standalone application
message("creating build target for osccontrol-light (Standalone)")
message("creating build target for osccontrol-light (VST3)")
add_osccontrol_target(osccontrol-light "Standalone;VST3")
configure_osccontrol_target(osccontrol-light)
set(PRESETS "" CACHE STRING "list of presets for which a plugin is built")
set(EMBED_PRESETS "" CACHE BOOL "embed preset definition at build time")
foreach(PRESET ${PRESETS})
message("creating build target for ${PRESET} preset (VST3)")
set(PRESET_TARGET "osc-${PRESET}")
add_osccontrol_target(${PRESET_TARGET} "VST3")
configure_osccontrol_target(${PRESET_TARGET})
endforeach()