forked from madskjeldgaard/Birdhouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
executable file
·212 lines (180 loc) · 7.48 KB
/
Copy pathCMakeLists.txt
File metadata and controls
executable file
·212 lines (180 loc) · 7.48 KB
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
# 3.24.1 is bundled in Visual Studio 2022 v17.4 3.24.1 is also bundled in CLion
# as of 2023
cmake_minimum_required(VERSION 3.24.1)
# This tells cmake we have goodies in the /cmake folder
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake-include/sudara-cmake")
include(PamplejuceVersion)
# Configures universal binaries and decides which version of macOS to support
include(PamplejuceMacOS)
# Change me! This is the internal name of the project and the name of JUCE's
# shared code target Note: This cannot have spaces (it may be 2024, but you
# can't have it all!) Worry not, JUCE's PRODUCT_NAME can have spaces (and is
# what DAWs display)
set(PROJECT_NAME "BirdHouse")
# Worry not, JUCE's PRODUCT_NAME can have spaces (and is what DAWs will display)
# You can also just have it be the same thing as PROJECT_NAME You may want to
# append the major version on the end of this (and PROJECT_NAME) ala:
# set(PROJECT_NAME "MyPlugin_v${MAJOR_VERSION}") Doing so enables major versions
# to show up in IDEs and DAWs as separate plugins allowing you to change
# parameters and behavior without breaking existing user projects
set(PRODUCT_NAME "BirdHouse")
# Change me! Used for the MacOS bundle name and Installers
set(COMPANY_NAME "MadsKjeldgaard")
# Change me! Used for the MacOS bundle identifier (and signing)
set(BUNDLE_ID "com.madskjeldgaard.birdhouse")
# Change me! Set the plugin formats you want built Valid choices: AAX Unity VST
# VST3 AU AUv3 Standalone
set(FORMATS Standalone VST3)
# Option to build CLAP
option(BUILD_CLAP "Build CLAP version of project" ON)
# For simplicity, the name of the CMake project is also the name of the target
project(${PROJECT_NAME} VERSION ${CURRENT_VERSION})
# Couple tweaks that IMO should be JUCE defaults
include(JUCEDefaults)
# Compile Commands
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# JUCE is setup as a submodule in the /JUCE folder Locally, you must run `git
# submodule update --init --recursive` once and later `git submodule update
# --remote --merge` to keep it up to date On Github Actions, this is done as a
# part of actions/checkout
add_subdirectory(libs/JUCE)
# Add any other modules you want modules here, before the juce_add_plugin call
# juce_add_module(modules/my_module)
# This adds the melatonin inspector module
add_subdirectory(modules/melatonin_inspector)
# See `docs/CMake API.md` in the JUCE repo for all config options
juce_add_plugin(
"${PROJECT_NAME}"
# Icons for the standalone app
ICON_BIG
"${CMAKE_CURRENT_SOURCE_DIR}/packaging/icon.png"
COMPANY_NAME
"${COMPANY_NAME}"
BUNDLE_ID
"${BUNDLE_ID}"
# On MacOS, plugin is copied to ~/Users/yourname/Library/Audio/Plug-Ins/
COPY_PLUGIN_AFTER_BUILD
TRUE
# Change me! A four-character plugin id First character MUST be uppercase for
# AU formats
PLUGIN_MANUFACTURER_CODE
MADS
# Change me! A unique four-character plugin id Note: this must have at least
# one upper-case character
PLUGIN_CODE
BIRD
FORMATS
"${FORMATS}"
# The name of your final executable This is how it's listed in the DAW This
# can be different from PROJECT_NAME and can have spaces! You might want to
# use v${MAJOR_VERSION} here once you go to v2...
PRODUCT_NAME
"${PRODUCT_NAME}"
# If you don't need MIDI input, set this to FALSE
NEEDS_MIDI_INPUT
TRUE
# If you need MIDI output, set this to TRUE
NEEDS_MIDI_OUTPUT
TRUE
# If you are building a MIDI effect, set this to TRUE
IS_MIDI_EFFECT
TRUE
# NOTE: VST3 and AUv3 MIDI effects need to be marked as synths
IS_SYNTH
TRUE
# Categories
VST3_CATEGORIES
Tools
Fx
Modulation
AU_MAIN_TYPE
kAudioUnitType_MIDIProcessor)
if(BUILD_CLAP)
# Add clap support
add_subdirectory(cmake-include/clap-juce-extensions EXCLUDE_FROM_ALL)
clap_juce_extensions_plugin(
TARGET
"${PROJECT_NAME}"
CLAP_ID
"${BUNDLE_ID}"
# For a full list of features, see this:
# https://github.com/free-audio/clap/blob/main/include/clap/plugin-features.h
CLAP_FEATURES
"note-effect")
endif()
# This lets us use our code in both the JUCE targets and our Test target Without
# running into ODR violations
add_library(SharedCode INTERFACE)
# C++20, please Use cxx_std_23 for C++23 (as of CMake v 3.20)
target_compile_features(SharedCode INTERFACE cxx_std_20)
# Manually list all .h and .cpp files for the plugin If you are like me, you'll
# use globs for your sanity. Just ensure you employ CONFIGURE_DEPENDS so the
# build system picks up changes If you want to appease the CMake gods and avoid
# globs, manually add files like so: set(SourceFiles Source/PluginEditor.h
# Source/PluginProcessor.h Source/PluginEditor.cpp Source/PluginProcessor.cpp)
file(GLOB_RECURSE SourceFiles CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/source/*.h")
target_sources(SharedCode INTERFACE ${SourceFiles})
# Adds a BinaryData target for embedding assets into the binary
include(Assets)
# MacOS only: Cleans up folder and target organization on Xcode.
include(XcodePrettify)
# This is where you can set preprocessor definitions for JUCE and your plugin
target_compile_definitions(
SharedCode
INTERFACE # JUCE_WEB_BROWSER and JUCE_USE_CURL off by default
JUCE_WEB_BROWSER=0 # If you set this to 1, add `NEEDS_WEB_BROWSER
# TRUE` to the `juce_add_plugin` call
JUCE_USE_CURL=0 # If you set this to 1, add `NEEDS_CURL TRUE` to the
# `juce_add_plugin` call
JUCE_VST3_CAN_REPLACE_VST2=0
# Uncomment if you are paying for a an Indie/Pro license or
# releasing under GPLv3 JUCE_DISPLAY_SPLASH_SCREEN=0 lets the app
# known if we're Debug or Release
CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
VERSION="${CURRENT_VERSION}"
# JucePlugin_Name is for some reason doesn't use the nicer
# PRODUCT_NAME
PRODUCT_NAME_WITHOUT_VERSION="BirdHouse")
# Dependencies installed via CPM, see https://github.com/cpm-cmake/CPM.cmake for
# more info
include(cmake-include/CPM.cmake)
# CPMAddPackage("gh:fmtlib/fmt#7.1.3") target_link_libraries(SharedCode
# INTERFACE fmt::fmt)
# Link to any other modules you added (with juce_add_module) here! Usually JUCE
# modules must have PRIVATE visibility See
# https://github.com/juce-framework/JUCE/blob/master/docs/CMake%20API.md#juce_add_module
# However, with Pamplejuce, you'll link modules to SharedCode with INTERFACE
# visibility This allows the JUCE plugin targets and the Tests target to link
# against it
target_link_libraries(
SharedCode
INTERFACE Assets
juce_audio_utils
juce_audio_processors
juce_dsp
juce_gui_basics
juce_gui_extra
juce_osc
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags)
# Link the JUCE plugin targets our SharedCode target
target_link_libraries("${PROJECT_NAME}" PRIVATE SharedCode)
# IPP support, comment out to disable
# include(PamplejuceIPP)
# Everything related to the tests target
include(Tests)
# A separate target keeps the Tests target fast!
include(Benchmarks)
# Pass some config to GA (like our PRODUCT_NAME)
include(GitHubENV)
# we need these flags for notarization on MacOS
option(MACOS_RELEASE "Set build flags for MacOS Release" OFF)
if(MACOS_RELEASE)
message(STATUS "Setting MacOS release flags...")
set_target_properties(BirdHouse_Standalone
PROPERTIES XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES)
endif()