-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
141 lines (117 loc) · 5.36 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
# 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)
# Change this to the name of your plugin
# This cannot have spaces (but PRODUCT_NAME can)
set(PROJECT_NAME "LilyChorus")
# Set the plugin formats you'll be building here.
# Valid formats: AAX Unity VST AU AUv3 Standalone
# set(FORMATS AU VST3 Standalone)
set(FORMATS VST3 Standalone)
# This must be set before the project() call
# see: https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_DEPLOYMENT_TARGET.html
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Support macOS down to High Sierra")
# Reads in VERSION file and sticks in it CURRENT_VERSION variable
# Be sure the file has no newlines
file(STRINGS VERSION CURRENT_VERSION)
# For simplicity, the name of the project is also the name of the target
project(${PROJECT_NAME} VERSION ${CURRENT_VERSION})
# By default we don't want Xcode schemes to be made for modules, etc
set(CMAKE_XCODE_GENERATE_SCHEME OFF)
# Adds all the module sources so they appear correctly in the IDE
# Must be set before JUCE is added as a sub-dir (or any targets are made)
# https://github.com/juce-framework/JUCE/commit/6b1b4cf7f6b1008db44411f2c8887d71a3348889
set_property(GLOBAL PROPERTY USE_FOLDERS YES)
# Create a /Modules directory in the IDE with the JUCE Module code
option(JUCE_ENABLE_MODULE_SOURCE_GROUPS "Show all module sources in IDE projects" ON)
# JUCE is setup as a submodule in the /JUCE folder
# Locally, you'll need to run `git submodule update --init --recursive` once
# and `git submodule update --remote --merge` to keep it up to date
# On Github Actions, it's managed by actions/checkout
add_subdirectory(libs/JUCE)
# Check the readme at `docs/CMake API.md` in the JUCE repo for full config
juce_add_plugin("${PROJECT_NAME}"
# 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 "Lily's Nonexistent Company"
BUNDLE_ID com.LilysNonexistentCompany.LilyChorus
# 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 FALSE # Does the editor need keyboard focus?
COPY_PLUGIN_AFTER_BUILD TRUE # On MacOS, plugin will be copied to /Users/you/Library/Audio/Plug-Ins/
PLUGIN_MANUFACTURER_CODE Lily # This has to be one uppercase, rest lower for AU formats
PLUGIN_CODE X9ZP # A unique four-character plugin id with at least one upper-case character
FORMATS "${FORMATS}"
PRODUCT_NAME "${PROJECT_NAME}") # The name of the final executable, which can differ from the target name
# C++20 please
target_compile_features("${PROJECT_NAME}" PRIVATE cxx_std_20)
# Manually list all .h and .cpp files for the plugin
set(SourceFiles
src/LabeledSlider.h
src/Lfo.h
src/LookAndFeel.h
src/LushChorus.h
src/PluginEditor.h
src/PluginProcessor.h
src/LushChorus.cpp
src/PluginEditor.cpp
src/PluginProcessor.cpp
)
target_sources("${PROJECT_NAME}" PRIVATE ${SourceFiles})
# No, we don't want our source buried in extra nested folders
set_target_properties("${PROJECT_NAME}" PROPERTIES FOLDER "")
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES ${SourceFiles})
# set(AssetFiles
# src/gui/assets/fonts/Roboto-Medium.ttf
# src/gui/assets/images/logo_218x40.svg
# )
# Setup our binary data as a target
#juce_add_binary_data(Assets SOURCES ${AssetFiles})
# Required for Linux happiness:
# See https://forum.juce.com/t/loading-pytorch-model-using-binarydata/39997/2
#set_target_properties(Assets PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
target_compile_definitions("${PROJECT_NAME}"
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_ENABLE_GPL_MODE=1
JUCE_DISPLAY_SPLASH_SCREEN=0
JUCE_REPORT_APP_USAGE=0
JUCE_MODAL_LOOPS_PERMITTED=1
)
target_include_directories(
"${PROJECT_NAME}"
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src"
"${CMAKE_CURRENT_SOURCE_DIR}/libs"
)
#include <juce_audio_basics/juce_audio_basics.h>
#include <juce_dsp/juce_dsp.h>
#include <juce_core/juce_core.h>
# We'll need to link to these from our plugin as well as our tests
set(JUCE_DEPENDENCIES
juce_audio_utils
juce_audio_processors
juce_dsp
juce_gui_basics
juce_gui_extra)
target_link_libraries("${PROJECT_NAME}"
PRIVATE
# Assets
${JUCE_DEPENDENCIES}
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags
)
# Color our warnings and errors
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options (-fdiagnostics-color=always)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options (-fcolor-diagnostics)
endif ()