-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCmakeLists.txt
251 lines (219 loc) · 14.4 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
cmake_minimum_required(VERSION 3.24)
set(CMAKE_CXX_STANDARD 17)
# ======== set variables =========
# Change to your project name
set (my_project_name ONNXAudioPluginTemplate) # Enter the name of your project
set (current_version 0.0.1) # Enter the version of your project (major.minor.bugfix)
set (company_name FredRabelo) # Enter your company name
set (product_name ${my_project_name}) # Enter the name of your product: The name of the final executable, which can differ from the target name
set (plugin_name ${my_project_name}) # The name of the plugin in a DAW environment, may differ from the name of the physical plugin file (product_name)
set (manufacturer_code Fred) # Enter your manufacturer code: A four-character manufacturer id with at least one upper-case character
set (plugin_code F001) # Enter your plugin code: A unique four-character plugin id with exactly one upper-case character
set (formats_to_build VST3 Standalone) # The formats to build. valid formats are: Standalone Unity VST3 AU AUv3 AAX VST
set (path_icon_big "") # Paths to image files that will be used to generate app icons.
set (path_icon_small "") # If only one of these parameters is specified, then that image will be used for all icon resolutions.
set (plugin_description Demo) # Enter a description of your plugin
set(ONNX_SOURCE_DIR D:/Fred/Uni/Abschluss/Coding/Libraries) # Set the path to the installed ONNX libraries
set(LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs) # Set the path to install the libraries
# set include directories as varaiable for ease of use
# maybe use this (and libs) variables to implement diferent build types in the future
set(ONNX_HEADERS_RELEASE
${ONNX_SOURCE_DIR}/onnxruntime/onnxruntime;
${ONNX_SOURCE_DIR}/onnxruntime/onnxruntime/test/util/include;
${ONNX_SOURCE_DIR}/onnxruntime/include/onnxruntime;
${ONNX_SOURCE_DIR}/onnxruntime/include/onnxruntime/core/session;
${ONNX_SOURCE_DIR}/onnxruntime/build/Windows/Release/_deps/pytorch_cpuinfo-src/include;
${ONNX_SOURCE_DIR}/onnxruntime/build/Windows/Release;
${ONNX_SOURCE_DIR}/onnxruntime/build/Windows/Release/_deps/utf8_range-src;
${ONNX_SOURCE_DIR}/onnxruntime/build/Windows/Release/_deps/abseil_cpp-src;
)
# set the path prefix to the libraries we want to include
set(ONNX_RELEASE_LIBS_PATH_PREFIX D:/Fred/Uni/Abschluss/Coding/Libraries/onnxruntime/build/Windows/Release)
# set the libraries as a variable for ease of use
set(ONNX_LIBS_RELEASE
${ONNX_RELEASE_LIBS_PATH_PREFIX}/Release/onnxruntime_test_utils.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/Release/onnxruntime_session.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/Release/onnxruntime_optimizer.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/Release/onnxruntime_providers.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/Release/onnxruntime_util.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/Release/onnxruntime_lora.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/Release/onnxruntime_framework.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/Release/onnxruntime_util.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/Release/onnxruntime_graph.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/Release/onnxruntime_mlas.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/Release/onnxruntime_common.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/Release/onnxruntime_flatbuffers.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/Release/onnx_test_data_proto.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/onnx-build/Release/onnx.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/onnx-build/Release/onnx_proto.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/protobuf-build/Release/libprotobuf-lite.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/re2-build/Release/re2.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/flatbuffers-build/Release/flatbuffers.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/log/Release/absl_log_internal_message.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/log/Release/absl_log_internal_format.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/synchronization/Release/absl_synchronization.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/log/Release/absl_log_internal_globals.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/synchronization/Release/absl_kernel_timeout_internal.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/strings/Release/absl_str_format_internal.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/hash/Release/absl_hash.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/flags/Release/absl_flags_commandlineflag.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/time/Release/absl_time.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/debugging/Release/absl_symbolize.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/synchronization/Release/absl_graphcycles_internal.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/log/Release/absl_log_internal_conditions.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/strings/Release/absl_strings.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/base/Release/absl_malloc_internal.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/debugging/Release/absl_demangle_internal.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/debugging/Release/absl_stacktrace.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/base/Release/absl_base.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/debugging/Release/absl_demangle_rust.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/types/Release/absl_bad_optional_access.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/strings/Release/absl_strings_internal.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/debugging/Release/absl_debugging_internal.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/numeric/Release/absl_int128.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/base/Release/absl_spinlock_wait.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/debugging/Release/absl_decode_rust_punycode.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/base/Release/absl_raw_logging_internal.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/base/Release/absl_log_severity.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/flags/Release/absl_flags_commandlineflag_internal.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/debugging/Release/absl_utf8_for_code_point.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/hash/Release/absl_city.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/hash/Release/absl_low_level_hash.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/log/Release/absl_log_sink.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/log/Release/absl_log_internal_log_sink_set.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/log/Release/absl_log_entry.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/log/Release/absl_log_globals.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/log/Release/absl_log_internal_nullguard.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/debugging/Release/absl_examine_stack.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/log/Release/absl_log_internal_proto.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/base/Release/absl_strerror.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/container/Release/absl_raw_hash_set.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/log/Release/absl_vlog_config_internal.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/flags/Release/absl_flags_reflection.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/flags/Release/absl_flags_internal.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/flags/Release/absl_flags_config.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/time/Release/absl_time_zone.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/time/Release/absl_civil_time.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/strings/Release/absl_string_view.lib;
${ONNX_RELEASE_LIBS_PATH_PREFIX}/_deps/abseil_cpp-build/absl/base/Release/absl_throw_delegate.lib;
)
# ======== Begin Code =========
project(${my_project_name} VERSION ${current_version})
# We're going to use CPM as our package manager to bring in JUCE
# Check to see if we have CPM installed already. Bring it in if we don't.
set(CPM_DOWNLOAD_VERSION 0.40.5)
set(CPM_DOWNLOAD_LOCATION "${LIB_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
message(STATUS "Looking for CPM.make...")
if (NOT EXISTS ${CPM_DOWNLOAD_LOCATION})
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
file(DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION})
else()
message(STATUS "CPM.make already installed at: ${CPM_DOWNLOAD_LOCATION}")
endif ()
include(${CPM_DOWNLOAD_LOCATION})
# Bring in JUCE locally
CPMAddPackage(
NAME juce
GIT_REPOSITORY https://github.com/juce-framework/JUCE.git
GIT_TAG origin/master
SOURCE_DIR ${LIB_DIR}/juce
)
# Make sure you include any new source files here
set(SourceFiles
Source/PluginEditor.cpp
Source/PluginEditor.h
Source/PluginProcessor.cpp
Source/PluginProcessor.h
Source/silero_vad.ort.h # Silero VAD Model as byte array
)
# Change these to your own preferences
juce_add_plugin(${PROJECT_NAME}
VERSION ${current_version} # Set this if the plugin version is different to the project version
COMPANY_NAME ${company_name} # Specify the name of the plugin's author
PRODUCT_NAME ${product_name} # The name of the final executable, which can differ from the target name
PLUGIN_NAME ${plugin_name} # this is the name that will be displayed in the DAW when the user go to load a plugin
PLUGIN_MANUFACTURER_CODE ${manufacturer_code} # A four-character unique id for your company. AU: at least one upper-case letter. Garageband: first letter upper-case, remaining letters lower-case.
PLUGIN_CODE ${plugin_code} # A unique four-character plugin id with exactly one upper-case character
DESCRIPTION ${plugin_description}
FORMATS ${formats_to_build} # The formats to build. Other valid formats are: Standalone Unity VST3 AU AUv3 AAX VST
# ICON_BIG ${path_icon_big} # Paths to image files that will be used to generate app icons.
# ICON_SMALL ${path_icon_small} # If only one of these parameters is specified, then that image will be used for all icon resolutions.
IS_SYNTH False # Is this a synth or an effect?
IS_MIDI_EFFECT FALSE # Is this plugin a MIDI effect?
NEEDS_MIDI_INPUT False # Does the plugin need midi input?
NEEDS_MIDI_OUTPUT FALSE # Does the plugin need midi output?
DISABLE_AAX_MULTI_MONO TRUE # Whether the AAX multi mono bus layout should be disabled.
EDITOR_WANTS_KEYBOARD_FOCUS FALSE # Does the editor need keyboard focus?
VST3_CATEGORIES Tools
# AU_MAIN_TYPE
AAX_CATEGORY None
COPY_PLUGIN_AFTER_BUILD FALSE # Should the plugin be installed to a default location after building?
# VST3_COPY_DIR # Location the plugins will be copied after building if COPY_PLUGIN_AFTER_BUILD is set.
# AAX_COPY_DIR # If you want to install all of the plugins in a subdirectory to a non-default location,
# AU_COPY_DIR # you can set the JUCE_"plugintype"_COPY_DIR property on the set_directory_properties, rather than setting this argument on each individual target.
)
# include onnx directories
target_include_directories(${PROJECT_NAME}
# using directories from the Release Build
PRIVATE
${ONNX_HEADERS_RELEASE}
)
# How we want our SourceFiles to appear in our IDE
# source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SourceFiles})
source_group("Shared Code" FILES ${SourceFiles})
# Make the SourceFiles buildable
target_sources(${PROJECT_NAME} PRIVATE ${SourceFiles})
# These are some toggleable options from the JUCE CMake API
target_compile_definitions(${PROJECT_NAME}
PUBLIC
# Standard
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0
JUCE_VST3_CAN_REPLACE_VST2=0
# extra
#JUCE_ALSA=1
#JUCE_DIRECTSOUND=1
#JUCE_DISABLE_CAUTIOUS_PARAMETER_ID_CHECKING=1
#JUCE_PLUGINHOST_LADSPA=1
#JUCE_PLUGINHOST_LV2=1
#JUCE_PLUGINHOST_VST3=1
#JUCE_USE_OGGVORBIS=1
#JUCE_VST3_HOST_CROSS_PLATFORM_UID=1
)
# libraries to bring into our project
target_link_libraries(${PROJECT_NAME}
PRIVATE
# add ONNX libs
${ONNX_LIBS_RELEASE}
# JUCE Modules
juce::juce_analytics
juce::juce_animation
juce::juce_audio_basics
juce::juce_audio_devices
juce::juce_audio_formats
juce::juce_audio_plugin_client
juce::juce_audio_processors
juce::juce_audio_utils
juce::juce_box2d
juce::juce_core
juce::juce_cryptography
juce::juce_data_structures
juce::juce_dsp
juce::juce_events
juce::juce_graphics
juce::juce_gui_basics
juce::juce_gui_extra
juce::juce_javascript
juce::juce_midi_ci
juce::juce_opengl
juce::juce_osc
juce::juce_product_unlocking
juce::juce_video
PUBLIC
#JUCE Stuff
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags
)