@@ -77,6 +77,157 @@ endfunction()
7777
7878#==============================================================================
7979
80+ function (_yup_fetch_clap )
81+ if (NOT TARGET clap)
82+ _yup_message (STATUS "Fetching CLAP SDK" )
83+ _yup_fetchcontent_declare (clap
84+ GIT_REPOSITORY https://github.com/free-audio/clap.git
85+ GIT_TAG main )
86+
87+ FetchContent_MakeAvailable (clap)
88+ endif ()
89+
90+ if (TARGET clap-tests)
91+ set_target_properties (clap-tests PROPERTIES FOLDER "Tests" )
92+ endif ()
93+ endfunction ()
94+
95+ #==============================================================================
96+
97+ function (_yup_fetch_vst3sdk )
98+ if (NOT TARGET sdk)
99+ _yup_message (STATUS "Fetching VST3 SDK" )
100+
101+ set (SMTG_CREATE_MODULE_INFO OFF )
102+ set (SMTG_ADD_VST3_UTILITIES OFF )
103+ set (SMTG_ENABLE_VST3_HOSTING_EXAMPLES OFF )
104+ set (SMTG_ENABLE_VST3_PLUGIN_EXAMPLES OFF )
105+ set (SMTG_ENABLE_VSTGUI_SUPPORT OFF )
106+ set (SMTG_CREATE_PLUGIN_LINK OFF )
107+ if (NOT YUP_PLATFORM_MAC OR XCODE)
108+ set (SMTG_RUN_VST_VALIDATOR ON )
109+ else ()
110+ set (SMTG_RUN_VST_VALIDATOR OFF )
111+ endif ()
112+
113+ _yup_fetchcontent_declare (vst3sdk
114+ GIT_REPOSITORY https://github.com/steinbergmedia/vst3sdk.git
115+ GIT_TAG master )
116+
117+ FetchContent_MakeAvailable (vst3sdk)
118+ endif ()
119+
120+ if (NOT TARGET yup_audio_plugin_host_vst3sdk)
121+ add_library (yup_audio_plugin_host_vst3sdk INTERFACE )
122+ target_link_libraries (yup_audio_plugin_host_vst3sdk INTERFACE sdk )
123+
124+ set (vst3sdk_source_dir "" )
125+ if (DEFINED vst3sdk_SOURCE_DIR )
126+ set (vst3sdk_source_dir "${vst3sdk_SOURCE_DIR} " )
127+ elseif (TARGET sdk)
128+ get_target_property (vst3sdk_source_dir sdk SOURCE_DIR )
129+ endif ()
130+
131+ set (vst3sdk_memorystream_source "${vst3sdk_source_dir} /public.sdk/source/common/memorystream.cpp" )
132+ if (vst3sdk_source_dir AND EXISTS "${vst3sdk_memorystream_source} " )
133+ target_sources (yup_audio_plugin_host_vst3sdk INTERFACE "${vst3sdk_memorystream_source} " )
134+ endif ()
135+
136+ set (vst3sdk_parameterchanges_source "${vst3sdk_source_dir} /public.sdk/source/vst/hosting/parameterchanges.cpp" )
137+ if (vst3sdk_source_dir AND EXISTS "${vst3sdk_parameterchanges_source} " )
138+ target_sources (yup_audio_plugin_host_vst3sdk INTERFACE "${vst3sdk_parameterchanges_source} " )
139+ endif ()
140+
141+ set (vst3sdk_eventlist_source "${vst3sdk_source_dir} /public.sdk/source/vst/hosting/eventlist.cpp" )
142+ if (vst3sdk_source_dir AND EXISTS "${vst3sdk_eventlist_source} " )
143+ target_sources (yup_audio_plugin_host_vst3sdk INTERFACE "${vst3sdk_eventlist_source} " )
144+ endif ()
145+ endif ()
146+ endfunction ()
147+
148+ #==============================================================================
149+
150+ function (_yup_target_list_contains target_list target_name output_variable )
151+ foreach (target IN LISTS target_list)
152+ if ("${target} " STREQUAL "${target_name} " OR "${target} " STREQUAL "yup::${target_name} " )
153+ set (${output_variable} ON PARENT_SCOPE )
154+ return ()
155+ endif ()
156+
157+ if (TARGET "${target} " )
158+ get_target_property (aliased_target "${target} " ALIASED_TARGET )
159+ if ("${aliased_target} " STREQUAL "${target_name} " )
160+ set (${output_variable} ON PARENT_SCOPE )
161+ return ()
162+ endif ()
163+ endif ()
164+ endforeach ()
165+
166+ set (${output_variable} OFF PARENT_SCOPE )
167+ endfunction ()
168+
169+ #==============================================================================
170+
171+ function (_yup_definitions_enable definitions definition_name output_variable )
172+ set (enabled OFF )
173+
174+ foreach (definition IN LISTS definitions)
175+ string (REGEX REPLACE "^-D" "" normalized_definition "${definition} " )
176+
177+ if (normalized_definition MATCHES "^${definition_name} ($|=)" )
178+ set (enabled ON )
179+
180+ if (normalized_definition MATCHES "^${definition_name} =" )
181+ string (REGEX REPLACE "^${definition_name} =(.*)$" "\\ 1" definition_value "${normalized_definition} " )
182+ string (STRIP "${definition_value} " definition_value)
183+ string (REGEX REPLACE "^\" (.*)\" $" "\\ 1" definition_value "${definition_value} " )
184+ string (REGEX REPLACE "^'(.*)'$" "\\ 1" definition_value "${definition_value} " )
185+ string (TOUPPER "${definition_value} " definition_value)
186+
187+ if ("${definition_value} " STREQUAL "0"
188+ OR "${definition_value} " STREQUAL "OFF"
189+ OR "${definition_value} " STREQUAL "FALSE"
190+ OR "${definition_value} " STREQUAL "NO" )
191+ set (enabled OFF )
192+ endif ()
193+ endif ()
194+ endif ()
195+ endforeach ()
196+
197+ set (${output_variable} "${enabled} " PARENT_SCOPE )
198+ endfunction ()
199+
200+ #==============================================================================
201+
202+ function (_yup_collect_audio_plugin_host_dependencies definitions output_variable )
203+ set (dependencies "" )
204+
205+ _yup_definitions_enable ("${definitions} " YUP_AUDIO_PLUGIN_HOST_ENABLE_CLAP enable_clap )
206+ if (enable_clap)
207+ _yup_fetch_clap ()
208+ list (APPEND dependencies clap)
209+ endif ()
210+
211+ _yup_definitions_enable ("${definitions} " YUP_AUDIO_PLUGIN_HOST_ENABLE_VST3 enable_vst3 )
212+ if (enable_vst3)
213+ _yup_fetch_vst3sdk ()
214+ list (APPEND dependencies yup_audio_plugin_host_vst3sdk)
215+ endif ()
216+
217+ _yup_definitions_enable ("${definitions} " YUP_AUDIO_PLUGIN_HOST_ENABLE_AU enable_au )
218+ if (enable_au AND YUP_PLATFORM_MAC)
219+ list (APPEND dependencies
220+ "-framework AudioUnit"
221+ "-framework AudioToolbox"
222+ "-framework CoreAudio"
223+ "-framework CoreFoundation" )
224+ endif ()
225+
226+ set (${output_variable} "${dependencies} " PARENT_SCOPE )
227+ endfunction ()
228+
229+ #==============================================================================
230+
80231function (_yup_fetch_perfetto )
81232 if (TARGET perfetto::perfetto)
82233 return ()
0 commit comments