forked from ruurdadema/juce-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
125 lines (101 loc) · 4.58 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
cmake_minimum_required(VERSION 3.15)
set(PROJECT_NAME JuceBootstrap)
set(MACOS_SDK_VERSION 10.11)
project(${PROJECT_NAME} VERSION 0.0.1)
set(CMAKE_CXX_STANDARD 17)
if (NOT CMAKE_BUILD_TYPE)
# CMAKE_BUILD_TYPE has to be specified for Conan to produce valid output (ie. CONAN_INCLUDE_DIRS)
set(CMAKE_BUILD_TYPE Debug)
message(WARNING "CMAKE_BUILD_TYPE not specified, set it to 'Debug'")
endif ()
if (WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:libcmt")
endif ()
# Conan
if (NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/develop/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake")
endif ()
include(${CMAKE_BINARY_DIR}/conan.cmake)
if (APPLE)
set(CONAN_SETTINGS os.version=${MACOS_SDK_VERSION})
else ()
set(CONAN_SETTINGS)
endif ()
conan_cmake_run(CONANFILE conanfile.py
SETTINGS ${CONAN_SETTINGS}
BASIC_SETUP
CMAKE_TARGETS
NO_OUTPUT_DIRS # Don't change output directories (so JUCE will be able to install plugins)
BUILD missing)
# JUCE (alternatively ass JUCE ass submodule and call add_subdirectory())
include(FetchContent)
FetchContent_Declare(
JUCE
GIT_REPOSITORY https://github.com/juce-framework/JUCE.git
GIT_TAG 6.0.8
)
FetchContent_MakeAvailable(JUCE) # Does an add_subdirectory() under the hood
add_subdirectory(source/views)
add_subdirectory(source/plugin)
add_subdirectory(source/gui)
set(JUCE_COMMON_TARGET_DEFINITIONS
DONT_SET_USING_JUCE_NAMESPACE
JUCE_DISPLAY_SPLASH_SCREEN=0
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0)
# GUI App
set(GUI_NAME ${PROJECT_NAME}Gui)
juce_add_gui_app(${GUI_NAME} PRODUCT_NAME "${PROJECT_NAME}Gui")
target_compile_definitions(${GUI_NAME} PUBLIC ${JUCE_COMMON_TARGET_DEFINITIONS})
juce_generate_juce_header(${GUI_NAME})
target_compile_options(${GUI_NAME} PRIVATE ${COMPILE_OPTIONS})
if (WIN32)
target_compile_definitions(${GUI_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS)
endif ()
target_link_libraries(${GUI_NAME} PRIVATE
source_gui
source_views
juce::juce_gui_basics
juce::juce_recommended_warning_flags
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
)
# Plugin
set(PLUGIN_NAME ${PROJECT_NAME}Plugin)
juce_add_plugin(${PLUGIN_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 "Owllab" # Specify the name of the plugin's author
# IS_SYNTH TRUE/FALSE # Is this a synth or an effect?
# NEEDS_MIDI_INPUT TRUE/FALSE # Does the plugin need midi input?
# NEEDS_MIDI_OUTPUT TRUE/FALSE # Does the plugin need midi output?
# IS_MIDI_EFFECT TRUE/FALSE # Is this plugin a MIDI effect?
# EDITOR_WANTS_KEYBOARD_FOCUS TRUE/FALSE # Does the editor need keyboard focus?
COPY_PLUGIN_AFTER_BUILD TRUE # Should the plugin be installed to a default location after building?
PLUGIN_MANUFACTURER_CODE Juce # A four-character manufacturer id with at least one upper-case character
PLUGIN_CODE Dem0 # A unique four-character plugin id with at least one upper-case character
FORMATS AU VST3 Standalone # The formats to build. Other valid formats are: AAX Unity VST AU AUv3
PRODUCT_NAME "${PLUGIN_NAME}") # The name of the final executable, which can differ from the target name
target_compile_definitions(${PLUGIN_NAME} PUBLIC ${JUCE_COMMON_TARGET_DEFINITIONS}
JUCE_VST3_CAN_REPLACE_VST2=0
JUCE_DISPLAY_SPLASH_SCREEN=0)
juce_generate_juce_header(${PLUGIN_NAME})
target_compile_options(${PLUGIN_NAME} PRIVATE ${COMPILE_OPTIONS})
if (WIN32)
target_compile_definitions(${PLUGIN_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS)
endif ()
target_link_libraries(${PLUGIN_NAME} PRIVATE
source_plugin
source_views
juce::juce_gui_basics
juce::juce_audio_processors
juce::juce_audio_utils
juce::juce_audio_devices
juce::juce_audio_plugin_client
juce::juce_recommended_warning_flags
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
)