diff --git a/CMakeLists.txt b/CMakeLists.txt index 8dffd4043f..27a91c3a28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,194 +1,194 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -cmake_minimum_required(VERSION 3.22) - -project(JUCE VERSION 8.0.3 LANGUAGES C CXX) - -include(CMakeDependentOption) - -set_property(GLOBAL PROPERTY USE_FOLDERS YES) - -set(JUCE_MODULES_DIR "${JUCE_SOURCE_DIR}/modules" CACHE INTERNAL - "The path to JUCE modules") - -# This option will disable most of the JUCE helper functions and tools. This option exists to -# facilitate existing CMake builds which handle things like bundle creation, icons, plists, and -# binary data independently of JUCE. This option is not recommended - use at your own risk! - -option(JUCE_MODULES_ONLY "Only configure the JUCE modules" OFF) - -include(extras/Build/CMake/JUCEModuleSupport.cmake) - -# This option controls whether dummy targets are added to the build, where these targets contain all -# of the source files for each JUCE module. If you're planning to use an IDE and want to be able to -# browse all of JUCE's source files, this may be useful. However, it will increase the size of -# generated IDE projects and might slow down configuration a bit. If you enable this, you should -# probably also add `set_property(GLOBAL PROPERTY USE_FOLDERS YES)` to your top level CMakeLists, -# otherwise the module sources will be added directly to the top level of the project, instead of in -# a nice 'Modules' subfolder. - -cmake_dependent_option(JUCE_ENABLE_MODULE_SOURCE_GROUPS - "Show all module sources in IDE projects" OFF - "NOT JUCE_MODULES_ONLY" OFF) - -add_subdirectory(modules) - -if(JUCE_MODULES_ONLY) - return() -endif() - -include(extras/Build/CMake/JUCEUtils.cmake) - -set_directory_properties(PROPERTIES - JUCE_COMPANY_NAME "JUCE" - JUCE_COMPANY_WEBSITE "https://juce.com" - JUCE_COMPANY_EMAIL "info@juce.com" - JUCE_COMPANY_COPYRIGHT "Copyright (c) - Raw Material Software Limited") - -option(JUCE_COPY_PLUGIN_AFTER_BUILD - "Whether or not plugins should be installed to the system after building" OFF) -set_property(GLOBAL PROPERTY JUCE_COPY_PLUGIN_AFTER_BUILD ${JUCE_COPY_PLUGIN_AFTER_BUILD}) - -set(CMAKE_CXX_EXTENSIONS FALSE) - -juce_disable_default_flags() - -add_subdirectory(extras/Build) - -# If you want to build the JUCE examples with VST2/AAX/ARA support, you'll need to make the -# VST2/AAX/ARA headers visible to the juce_audio_processors module. You can either set the paths on -# the command line, (e.g. -DJUCE_GLOBAL_AAX_SDK_PATH=/path/to/sdk) if you're just building the JUCE -# examples, or you can call the `juce_set_*_sdk_path` functions in your own CMakeLists after -# importing JUCE. - -if(JUCE_GLOBAL_AAX_SDK_PATH) - juce_set_aax_sdk_path("${JUCE_GLOBAL_AAX_SDK_PATH}") -endif() - -if(JUCE_GLOBAL_VST2_SDK_PATH) - juce_set_vst2_sdk_path("${JUCE_GLOBAL_VST2_SDK_PATH}") -endif() - -# The ARA_SDK path should point to the "Umbrella installer" ARA_SDK directory. -# The directory can be obtained by recursively cloning https://github.com/Celemony/ARA_SDK and -# checking out the tag releases/2.1.0. -if(JUCE_GLOBAL_ARA_SDK_PATH) - juce_set_ara_sdk_path("${JUCE_GLOBAL_ARA_SDK_PATH}") -endif() - -# We don't build anything other than the juceaide by default, because we want to keep configuration -# speedy and the number of targets low. If you want to add targets for the extra projects and -# example PIPs (there's a lot of them!), specify -DJUCE_BUILD_EXAMPLES=ON and/or -# -DJUCE_BUILD_EXTRAS=ON when initially generating your build tree. - -option(JUCE_BUILD_EXTRAS "Add build targets for the Projucer and other tools" OFF) - -if(JUCE_BUILD_EXTRAS) - add_subdirectory(extras) -endif() - -option(JUCE_BUILD_EXAMPLES "Add build targets for the DemoRunner and PIPs" OFF) - -if(JUCE_BUILD_EXAMPLES) - add_subdirectory(examples) -endif() - -string(CONCAT webview2_option_message "Location that overrides the default directory where our " - "FindWebView2 script is looking for the " - "*Microsoft.Web.WebView2* directory") - -option(JUCE_WEBVIEW2_PACKAGE_LOCATION ${webview2_option_message} "") - -# ================================================================================================== -# Install configuration - -include(CMakePackageConfigHelpers) -write_basic_package_version_file("${JUCE_BINARY_DIR}/JUCEConfigVersion.cmake" - VERSION ${JUCE_VERSION} - COMPATIBILITY ExactVersion) - -set(JUCE_INSTALL_DESTINATION "lib/cmake/JUCE-${JUCE_VERSION}" CACHE STRING - "The location, relative to the install prefix, where the JUCE config file will be installed") - -set(JUCE_MODULE_PATH "include/JUCE-${JUCE_VERSION}/modules") -set(UTILS_INSTALL_DIR "${JUCE_INSTALL_DESTINATION}") -set(JUCEAIDE_PATH "${JUCE_TOOL_INSTALL_DIR}/${JUCE_JUCEAIDE_NAME}") -configure_package_config_file("${JUCE_CMAKE_UTILS_DIR}/JUCEConfig.cmake.in" - "${JUCE_BINARY_DIR}/JUCEConfig.cmake" - PATH_VARS UTILS_INSTALL_DIR JUCEAIDE_PATH JUCE_MODULE_PATH - INSTALL_DESTINATION "${JUCE_INSTALL_DESTINATION}") - -set(JUCE_MODULE_PATH "${JUCE_MODULES_DIR}") -set(UTILS_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extras/Build/CMake") -get_target_property(JUCEAIDE_PATH juceaide IMPORTED_LOCATION) -configure_package_config_file("${JUCE_CMAKE_UTILS_DIR}/JUCEConfig.cmake.in" - "${JUCE_BINARY_DIR}/JUCEExportConfig.cmake" - PATH_VARS UTILS_INSTALL_DIR JUCEAIDE_PATH JUCE_MODULE_PATH - INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}" - INSTALL_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - -install(FILES "${JUCE_BINARY_DIR}/JUCEConfigVersion.cmake" - "${JUCE_BINARY_DIR}/JUCEConfig.cmake" - "${JUCE_CMAKE_UTILS_DIR}/JUCECheckAtomic.cmake" - "${JUCE_CMAKE_UTILS_DIR}/JUCEHelperTargets.cmake" - "${JUCE_CMAKE_UTILS_DIR}/JUCEModuleSupport.cmake" - "${JUCE_CMAKE_UTILS_DIR}/JUCEUtils.cmake" - "${JUCE_CMAKE_UTILS_DIR}/JuceLV2Defines.h.in" - "${JUCE_CMAKE_UTILS_DIR}/LaunchScreen.storyboard" - "${JUCE_CMAKE_UTILS_DIR}/PIPAudioProcessor.cpp.in" - "${JUCE_CMAKE_UTILS_DIR}/PIPAudioProcessorWithARA.cpp.in" - "${JUCE_CMAKE_UTILS_DIR}/PIPComponent.cpp.in" - "${JUCE_CMAKE_UTILS_DIR}/PIPConsole.cpp.in" - "${JUCE_CMAKE_UTILS_DIR}/RecentFilesMenuTemplate.nib" - "${JUCE_CMAKE_UTILS_DIR}/UnityPluginGUIScript.cs.in" - "${JUCE_CMAKE_UTILS_DIR}/checkBundleSigning.cmake" - "${JUCE_CMAKE_UTILS_DIR}/copyDir.cmake" - "${JUCE_CMAKE_UTILS_DIR}/juce_runtime_arch_detection.cpp" - "${JUCE_CMAKE_UTILS_DIR}/juce_LinuxSubprocessHelper.cpp" - DESTINATION "${JUCE_INSTALL_DESTINATION}") - -if(("${CMAKE_SOURCE_DIR}" STREQUAL "${JUCE_SOURCE_DIR}") AND (NOT JUCE_BUILD_HELPER_TOOLS)) - _juce_add_lv2_manifest_helper_target() - - if(TARGET juce_lv2_helper) - install(TARGETS juce_lv2_helper EXPORT LV2_HELPER DESTINATION "bin/JUCE-${JUCE_VERSION}") - install(EXPORT LV2_HELPER NAMESPACE juce:: DESTINATION "${JUCE_INSTALL_DESTINATION}") - endif() - - _juce_add_vst3_manifest_helper_target() - - if(TARGET juce_vst3_helper) - install(TARGETS juce_vst3_helper EXPORT VST3_HELPER DESTINATION "bin/JUCE-${JUCE_VERSION}") - install(EXPORT VST3_HELPER NAMESPACE juce:: DESTINATION "${JUCE_INSTALL_DESTINATION}") - endif() -endif() +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +cmake_minimum_required(VERSION 3.22) + +project(JUCE VERSION 8.0.3 LANGUAGES C CXX) + +include(CMakeDependentOption) + +set_property(GLOBAL PROPERTY USE_FOLDERS YES) + +set(JUCE_MODULES_DIR "${JUCE_SOURCE_DIR}/modules" CACHE INTERNAL + "The path to JUCE modules") + +# This option will disable most of the JUCE helper functions and tools. This option exists to +# facilitate existing CMake builds which handle things like bundle creation, icons, plists, and +# binary data independently of JUCE. This option is not recommended - use at your own risk! + +option(JUCE_MODULES_ONLY "Only configure the JUCE modules" OFF) + +include(extras/Build/CMake/JUCEModuleSupport.cmake) + +# This option controls whether dummy targets are added to the build, where these targets contain all +# of the source files for each JUCE module. If you're planning to use an IDE and want to be able to +# browse all of JUCE's source files, this may be useful. However, it will increase the size of +# generated IDE projects and might slow down configuration a bit. If you enable this, you should +# probably also add `set_property(GLOBAL PROPERTY USE_FOLDERS YES)` to your top level CMakeLists, +# otherwise the module sources will be added directly to the top level of the project, instead of in +# a nice 'Modules' subfolder. + +cmake_dependent_option(JUCE_ENABLE_MODULE_SOURCE_GROUPS + "Show all module sources in IDE projects" OFF + "NOT JUCE_MODULES_ONLY" OFF) + +add_subdirectory(modules) + +if(JUCE_MODULES_ONLY) + return() +endif() + +include(extras/Build/CMake/JUCEUtils.cmake) + +set_directory_properties(PROPERTIES + JUCE_COMPANY_NAME "JUCE" + JUCE_COMPANY_WEBSITE "https://juce.com" + JUCE_COMPANY_EMAIL "info@juce.com" + JUCE_COMPANY_COPYRIGHT "Copyright (c) - Raw Material Software Limited") + +option(JUCE_COPY_PLUGIN_AFTER_BUILD + "Whether or not plugins should be installed to the system after building" OFF) +set_property(GLOBAL PROPERTY JUCE_COPY_PLUGIN_AFTER_BUILD ${JUCE_COPY_PLUGIN_AFTER_BUILD}) + +set(CMAKE_CXX_EXTENSIONS FALSE) + +juce_disable_default_flags() + +add_subdirectory(extras/Build) + +# If you want to build the JUCE examples with VST2/AAX/ARA support, you'll need to make the +# VST2/AAX/ARA headers visible to the juce_audio_processors module. You can either set the paths on +# the command line, (e.g. -DJUCE_GLOBAL_AAX_SDK_PATH=/path/to/sdk) if you're just building the JUCE +# examples, or you can call the `juce_set_*_sdk_path` functions in your own CMakeLists after +# importing JUCE. + +if(JUCE_GLOBAL_AAX_SDK_PATH) + juce_set_aax_sdk_path("${JUCE_GLOBAL_AAX_SDK_PATH}") +endif() + +if(JUCE_GLOBAL_VST2_SDK_PATH) + juce_set_vst2_sdk_path("${JUCE_GLOBAL_VST2_SDK_PATH}") +endif() + +# The ARA_SDK path should point to the "Umbrella installer" ARA_SDK directory. +# The directory can be obtained by recursively cloning https://github.com/Celemony/ARA_SDK and +# checking out the tag releases/2.1.0. +if(JUCE_GLOBAL_ARA_SDK_PATH) + juce_set_ara_sdk_path("${JUCE_GLOBAL_ARA_SDK_PATH}") +endif() + +# We don't build anything other than the juceaide by default, because we want to keep configuration +# speedy and the number of targets low. If you want to add targets for the extra projects and +# example PIPs (there's a lot of them!), specify -DJUCE_BUILD_EXAMPLES=ON and/or +# -DJUCE_BUILD_EXTRAS=ON when initially generating your build tree. + +option(JUCE_BUILD_EXTRAS "Add build targets for the Projucer and other tools" OFF) + +if(JUCE_BUILD_EXTRAS) + add_subdirectory(extras) +endif() + +option(JUCE_BUILD_EXAMPLES "Add build targets for the DemoRunner and PIPs" OFF) + +if(JUCE_BUILD_EXAMPLES) + add_subdirectory(examples) +endif() + +string(CONCAT webview2_option_message "Location that overrides the default directory where our " + "FindWebView2 script is looking for the " + "*Microsoft.Web.WebView2* directory") + +option(JUCE_WEBVIEW2_PACKAGE_LOCATION ${webview2_option_message} "") + +# ================================================================================================== +# Install configuration + +include(CMakePackageConfigHelpers) +write_basic_package_version_file("${JUCE_BINARY_DIR}/JUCEConfigVersion.cmake" + VERSION ${JUCE_VERSION} + COMPATIBILITY ExactVersion) + +set(JUCE_INSTALL_DESTINATION "lib/cmake/JUCE-${JUCE_VERSION}" CACHE STRING + "The location, relative to the install prefix, where the JUCE config file will be installed") + +set(JUCE_MODULE_PATH "include/JUCE-${JUCE_VERSION}/modules") +set(UTILS_INSTALL_DIR "${JUCE_INSTALL_DESTINATION}") +set(JUCEAIDE_PATH "${JUCE_TOOL_INSTALL_DIR}/${JUCE_JUCEAIDE_NAME}") +configure_package_config_file("${JUCE_CMAKE_UTILS_DIR}/JUCEConfig.cmake.in" + "${JUCE_BINARY_DIR}/JUCEConfig.cmake" + PATH_VARS UTILS_INSTALL_DIR JUCEAIDE_PATH JUCE_MODULE_PATH + INSTALL_DESTINATION "${JUCE_INSTALL_DESTINATION}") + +set(JUCE_MODULE_PATH "${JUCE_MODULES_DIR}") +set(UTILS_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extras/Build/CMake") +get_target_property(JUCEAIDE_PATH juceaide IMPORTED_LOCATION) +configure_package_config_file("${JUCE_CMAKE_UTILS_DIR}/JUCEConfig.cmake.in" + "${JUCE_BINARY_DIR}/JUCEExportConfig.cmake" + PATH_VARS UTILS_INSTALL_DIR JUCEAIDE_PATH JUCE_MODULE_PATH + INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}" + INSTALL_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + +install(FILES "${JUCE_BINARY_DIR}/JUCEConfigVersion.cmake" + "${JUCE_BINARY_DIR}/JUCEConfig.cmake" + "${JUCE_CMAKE_UTILS_DIR}/JUCECheckAtomic.cmake" + "${JUCE_CMAKE_UTILS_DIR}/JUCEHelperTargets.cmake" + "${JUCE_CMAKE_UTILS_DIR}/JUCEModuleSupport.cmake" + "${JUCE_CMAKE_UTILS_DIR}/JUCEUtils.cmake" + "${JUCE_CMAKE_UTILS_DIR}/JuceLV2Defines.h.in" + "${JUCE_CMAKE_UTILS_DIR}/LaunchScreen.storyboard" + "${JUCE_CMAKE_UTILS_DIR}/PIPAudioProcessor.cpp.in" + "${JUCE_CMAKE_UTILS_DIR}/PIPAudioProcessorWithARA.cpp.in" + "${JUCE_CMAKE_UTILS_DIR}/PIPComponent.cpp.in" + "${JUCE_CMAKE_UTILS_DIR}/PIPConsole.cpp.in" + "${JUCE_CMAKE_UTILS_DIR}/RecentFilesMenuTemplate.nib" + "${JUCE_CMAKE_UTILS_DIR}/UnityPluginGUIScript.cs.in" + "${JUCE_CMAKE_UTILS_DIR}/checkBundleSigning.cmake" + "${JUCE_CMAKE_UTILS_DIR}/copyDir.cmake" + "${JUCE_CMAKE_UTILS_DIR}/juce_runtime_arch_detection.cpp" + "${JUCE_CMAKE_UTILS_DIR}/juce_LinuxSubprocessHelper.cpp" + DESTINATION "${JUCE_INSTALL_DESTINATION}") + +if(("${CMAKE_SOURCE_DIR}" STREQUAL "${JUCE_SOURCE_DIR}") AND (NOT JUCE_BUILD_HELPER_TOOLS)) + _juce_add_lv2_manifest_helper_target() + + if(TARGET juce_lv2_helper) + install(TARGETS juce_lv2_helper EXPORT LV2_HELPER DESTINATION "bin/JUCE-${JUCE_VERSION}") + install(EXPORT LV2_HELPER NAMESPACE juce:: DESTINATION "${JUCE_INSTALL_DESTINATION}") + endif() + + _juce_add_vst3_manifest_helper_target() + + if(TARGET juce_vst3_helper) + install(TARGETS juce_vst3_helper EXPORT VST3_HELPER DESTINATION "bin/JUCE-${JUCE_VERSION}") + install(EXPORT VST3_HELPER NAMESPACE juce:: DESTINATION "${JUCE_INSTALL_DESTINATION}") + endif() +endif() diff --git a/examples/Audio/CMakeLists.txt b/examples/Audio/CMakeLists.txt index 11e6620937..8063ddfbbd 100644 --- a/examples/Audio/CMakeLists.txt +++ b/examples/Audio/CMakeLists.txt @@ -1,22 +1,22 @@ -# ============================================================================== -# -# This file is part of the JUCE framework examples. -# Copyright (c) Raw Material Software Limited -# -# The code included in this file is provided under the terms of the ISC license -# http://www.isc.org/downloads/software-support-policy/isc-license. Permission -# to use, copy, modify, and/or distribute this software for any purpose with or -# without fee is hereby granted provided that the above copyright notice and -# this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. -# -# ============================================================================== - -_juce_add_pips() +# ============================================================================== +# +# This file is part of the JUCE framework examples. +# Copyright (c) Raw Material Software Limited +# +# The code included in this file is provided under the terms of the ISC license +# http://www.isc.org/downloads/software-support-policy/isc-license. Permission +# to use, copy, modify, and/or distribute this software for any purpose with or +# without fee is hereby granted provided that the above copyright notice and +# this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# ============================================================================== + +_juce_add_pips() diff --git a/examples/CMake/AudioPlugin/CMakeLists.txt b/examples/CMake/AudioPlugin/CMakeLists.txt index e20d2e15d8..273e40c111 100644 --- a/examples/CMake/AudioPlugin/CMakeLists.txt +++ b/examples/CMake/AudioPlugin/CMakeLists.txt @@ -1,111 +1,111 @@ -# Example Audio Plugin CMakeLists.txt - -# To get started on a new plugin, copy this entire folder (containing this file and C++ sources) to -# a convenient location, and then start making modifications. - -# The first line of any CMake project should be a call to `cmake_minimum_required`, which checks -# that the installed CMake will be able to understand the following CMakeLists, and ensures that -# CMake's behaviour is compatible with the named version. This is a standard CMake command, so more -# information can be found in the CMake docs. - -cmake_minimum_required(VERSION 3.22) - -# The top-level CMakeLists.txt file for a project must contain a literal, direct call to the -# `project()` command. `project()` sets up some helpful variables that describe source/binary -# directories, and the current project version. This is a standard CMake command. - -project(AUDIO_PLUGIN_EXAMPLE VERSION 0.0.1) - -# If you've installed JUCE somehow (via a package manager, or directly using the CMake install -# target), you'll need to tell this project that it depends on the installed copy of JUCE. If you've -# included JUCE directly in your source tree (perhaps as a submodule), you'll need to tell CMake to -# include that subdirectory as part of the build. - -# find_package(JUCE CONFIG REQUIRED) # If you've installed JUCE to your system -# or -# add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE - -# If you are building a VST2 or AAX plugin, CMake needs to be told where to find these SDKs on your -# system. This setup should be done before calling `juce_add_plugin`. - -# juce_set_vst2_sdk_path(...) -# juce_set_aax_sdk_path(...) - -# `juce_add_plugin` adds a static library target with the name passed as the first argument -# (AudioPluginExample here). This target is a normal CMake target, but has a lot of extra properties set -# up by default. As well as this shared code static library, this function adds targets for each of -# the formats specified by the FORMATS arguments. This function accepts many optional arguments. -# Check the readme at `docs/CMake API.md` in the JUCE repo for the full list. - -juce_add_plugin(AudioPluginExample - # 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 ... # 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/FALSE # 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 exactly one upper-case character - # GarageBand 10.3 requires the first letter to be upper-case, and the remaining letters to be lower-case - FORMATS AU VST3 Standalone # The formats to build. Other valid formats are: AAX Unity VST AU AUv3 - PRODUCT_NAME "Audio Plugin Example") # The name of the final executable, which can differ from the target name - -# `juce_generate_juce_header` will create a JuceHeader.h for a given target, which will be generated -# into your build tree. This should be included with `#include `. The include path for -# this header will be automatically added to the target. The main function of the JuceHeader is to -# include all your JUCE module headers; if you're happy to include module headers directly, you -# probably don't need to call this. - -# juce_generate_juce_header(AudioPluginExample) - -# `target_sources` adds source files to a target. We pass the target that needs the sources as the -# first argument, then a visibility parameter for the sources which should normally be PRIVATE. -# Finally, we supply a list of source files that will be built into the target. This is a standard -# CMake command. - -target_sources(AudioPluginExample - PRIVATE - PluginEditor.cpp - PluginProcessor.cpp) - -# `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer -# project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use -# of compile definitions to switch certain features on/off, so if there's a particular feature you -# need that's not on by default, check the module header for the correct flag to set here. These -# definitions will be visible both to your code, and also the JUCE module code, so for new -# definitions, pick unique names that are unlikely to collide! This is a standard CMake command. - -target_compile_definitions(AudioPluginExample - 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) - -# If your target needs extra binary assets, you can add them here. The first argument is the name of -# a new static library target that will include all the binary resources. There is an optional -# `NAMESPACE` argument that can specify the namespace of the generated binary data class. Finally, -# the SOURCES argument should be followed by a list of source files that should be built into the -# static library. These source files can be of any kind (wav data, images, fonts, icons etc.). -# Conversion to binary-data will happen when your target is built. - -# juce_add_binary_data(AudioPluginData SOURCES ...) - -# `target_link_libraries` links libraries and JUCE modules to other libraries or executables. Here, -# we're linking our executable target to the `juce::juce_audio_utils` module. Inter-module -# dependencies are resolved automatically, so `juce_core`, `juce_events` and so on will also be -# linked automatically. If we'd generated a binary data target above, we would need to link to it -# here too. This is a standard CMake command. - -target_link_libraries(AudioPluginExample - PRIVATE - # AudioPluginData # If we'd created a binary data target, we'd link to it here - juce::juce_audio_utils - PUBLIC - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags) +# Example Audio Plugin CMakeLists.txt + +# To get started on a new plugin, copy this entire folder (containing this file and C++ sources) to +# a convenient location, and then start making modifications. + +# The first line of any CMake project should be a call to `cmake_minimum_required`, which checks +# that the installed CMake will be able to understand the following CMakeLists, and ensures that +# CMake's behaviour is compatible with the named version. This is a standard CMake command, so more +# information can be found in the CMake docs. + +cmake_minimum_required(VERSION 3.22) + +# The top-level CMakeLists.txt file for a project must contain a literal, direct call to the +# `project()` command. `project()` sets up some helpful variables that describe source/binary +# directories, and the current project version. This is a standard CMake command. + +project(AUDIO_PLUGIN_EXAMPLE VERSION 0.0.1) + +# If you've installed JUCE somehow (via a package manager, or directly using the CMake install +# target), you'll need to tell this project that it depends on the installed copy of JUCE. If you've +# included JUCE directly in your source tree (perhaps as a submodule), you'll need to tell CMake to +# include that subdirectory as part of the build. + +# find_package(JUCE CONFIG REQUIRED) # If you've installed JUCE to your system +# or +# add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE + +# If you are building a VST2 or AAX plugin, CMake needs to be told where to find these SDKs on your +# system. This setup should be done before calling `juce_add_plugin`. + +# juce_set_vst2_sdk_path(...) +# juce_set_aax_sdk_path(...) + +# `juce_add_plugin` adds a static library target with the name passed as the first argument +# (AudioPluginExample here). This target is a normal CMake target, but has a lot of extra properties set +# up by default. As well as this shared code static library, this function adds targets for each of +# the formats specified by the FORMATS arguments. This function accepts many optional arguments. +# Check the readme at `docs/CMake API.md` in the JUCE repo for the full list. + +juce_add_plugin(AudioPluginExample + # 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 ... # 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/FALSE # 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 exactly one upper-case character + # GarageBand 10.3 requires the first letter to be upper-case, and the remaining letters to be lower-case + FORMATS AU VST3 Standalone # The formats to build. Other valid formats are: AAX Unity VST AU AUv3 + PRODUCT_NAME "Audio Plugin Example") # The name of the final executable, which can differ from the target name + +# `juce_generate_juce_header` will create a JuceHeader.h for a given target, which will be generated +# into your build tree. This should be included with `#include `. The include path for +# this header will be automatically added to the target. The main function of the JuceHeader is to +# include all your JUCE module headers; if you're happy to include module headers directly, you +# probably don't need to call this. + +# juce_generate_juce_header(AudioPluginExample) + +# `target_sources` adds source files to a target. We pass the target that needs the sources as the +# first argument, then a visibility parameter for the sources which should normally be PRIVATE. +# Finally, we supply a list of source files that will be built into the target. This is a standard +# CMake command. + +target_sources(AudioPluginExample + PRIVATE + PluginEditor.cpp + PluginProcessor.cpp) + +# `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer +# project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use +# of compile definitions to switch certain features on/off, so if there's a particular feature you +# need that's not on by default, check the module header for the correct flag to set here. These +# definitions will be visible both to your code, and also the JUCE module code, so for new +# definitions, pick unique names that are unlikely to collide! This is a standard CMake command. + +target_compile_definitions(AudioPluginExample + 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) + +# If your target needs extra binary assets, you can add them here. The first argument is the name of +# a new static library target that will include all the binary resources. There is an optional +# `NAMESPACE` argument that can specify the namespace of the generated binary data class. Finally, +# the SOURCES argument should be followed by a list of source files that should be built into the +# static library. These source files can be of any kind (wav data, images, fonts, icons etc.). +# Conversion to binary-data will happen when your target is built. + +# juce_add_binary_data(AudioPluginData SOURCES ...) + +# `target_link_libraries` links libraries and JUCE modules to other libraries or executables. Here, +# we're linking our executable target to the `juce::juce_audio_utils` module. Inter-module +# dependencies are resolved automatically, so `juce_core`, `juce_events` and so on will also be +# linked automatically. If we'd generated a binary data target above, we would need to link to it +# here too. This is a standard CMake command. + +target_link_libraries(AudioPluginExample + PRIVATE + # AudioPluginData # If we'd created a binary data target, we'd link to it here + juce::juce_audio_utils + PUBLIC + juce::juce_recommended_config_flags + juce::juce_recommended_lto_flags + juce::juce_recommended_warning_flags) diff --git a/examples/CMake/CMakeLists.txt b/examples/CMake/CMakeLists.txt index af16dd619f..e094858adc 100644 --- a/examples/CMake/CMakeLists.txt +++ b/examples/CMake/CMakeLists.txt @@ -1,24 +1,24 @@ -# ============================================================================== -# -# This file is part of the JUCE framework examples. -# Copyright (c) Raw Material Software Limited -# -# The code included in this file is provided under the terms of the ISC license -# http://www.isc.org/downloads/software-support-policy/isc-license. Permission -# to use, copy, modify, and/or distribute this software for any purpose with or -# without fee is hereby granted provided that the above copyright notice and -# this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. -# -# ============================================================================== - -add_subdirectory(AudioPlugin) -add_subdirectory(ConsoleApp) -add_subdirectory(GuiApp) +# ============================================================================== +# +# This file is part of the JUCE framework examples. +# Copyright (c) Raw Material Software Limited +# +# The code included in this file is provided under the terms of the ISC license +# http://www.isc.org/downloads/software-support-policy/isc-license. Permission +# to use, copy, modify, and/or distribute this software for any purpose with or +# without fee is hereby granted provided that the above copyright notice and +# this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# ============================================================================== + +add_subdirectory(AudioPlugin) +add_subdirectory(ConsoleApp) +add_subdirectory(GuiApp) diff --git a/examples/CMake/ConsoleApp/CMakeLists.txt b/examples/CMake/ConsoleApp/CMakeLists.txt index 1edaa1db76..4cad984a69 100644 --- a/examples/CMake/ConsoleApp/CMakeLists.txt +++ b/examples/CMake/ConsoleApp/CMakeLists.txt @@ -1,88 +1,88 @@ -# Example Console App CMakeLists.txt - -# To get started on a new console app, copy this entire folder (containing this file and C++ -# sources) to a convenient location, and then start making modifications. For other examples of -# CMakeLists for console apps, check `extras/BinaryBuilder` and `extras/UnitTestRunner` in the JUCE -# repo. - -# The first line of any CMake project should be a call to `cmake_minimum_required`, which checks -# that the installed CMake will be able to understand the following CMakeLists, and ensures that -# CMake's behaviour is compatible with the named version. This is a standard CMake command, so more -# information can be found in the CMake docs. - -cmake_minimum_required(VERSION 3.22) - -# The top-level CMakeLists.txt file for a project must contain a literal, direct call to the -# `project()` command. `project()` sets up some helpful variables that describe source/binary -# directories, and the current project version. This is a standard CMake command. - -project(CONSOLE_APP_EXAMPLE VERSION 0.0.1) - -# If you've installed JUCE somehow (via a package manager, or directly using the CMake install -# target), you'll need to tell this project that it depends on the installed copy of JUCE. If you've -# included JUCE directly in your source tree (perhaps as a submodule), you'll need to tell CMake to -# include that subdirectory as part of the build. - -# find_package(JUCE CONFIG REQUIRED) # If you've installed JUCE to your system -# or -# add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE - -# `juce_add_console_app` adds an executable target with the name passed as the first argument -# (ConsoleAppExample here). This target is a normal CMake target, but has a lot of extra properties -# set up by default. This function accepts many optional arguments. Check the readme at -# `docs/CMake API.md` in the JUCE repo for the full list. - -juce_add_console_app(ConsoleAppExample - PRODUCT_NAME "Console App Example") # The name of the final executable, which can differ from the target name - -# `juce_generate_juce_header` will create a JuceHeader.h for a given target, which will be generated -# into the build tree. This header should be included with `#include `. The include -# path for this header will be automatically added to the target. The main function of the -# JuceHeader is to include all the JUCE module headers for a particular target; if you're happy to -# include module headers directly, you probably don't need to call this. - -# juce_generate_juce_header(ConsoleAppExample) - -# `target_sources` adds source files to a target. We pass the target that needs the sources as the -# first argument, then a visibility parameter for the sources which should normally be PRIVATE. -# Finally, we supply a list of source files that will be built into the target. This is a standard -# CMake command. - -target_sources(ConsoleAppExample - PRIVATE - Main.cpp) - -# `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer -# project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use -# of compile definitions to switch certain features on/off, so if there's a particular feature you -# need that's not on by default, check the module header for the correct flag to set here. These -# definitions will be visible both to your code, and also the JUCE module code, so for new -# definitions, pick unique names that are unlikely to collide! This is a standard CMake command. - -target_compile_definitions(ConsoleAppExample - PRIVATE - # 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_console_app` call - JUCE_USE_CURL=0) # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_console_app` call - -# If the target needs extra binary assets, they can be added here. The first argument is the name of -# a new static library target that will include all the binary resources. There is an optional -# `NAMESPACE` argument that can specify the namespace of the generated binary data class. Finally, -# the SOURCES argument should be followed by a list of source files that should be built into the -# static library. These source files can be of any kind (wav data, images, fonts, icons etc.). -# Conversion to binary-data will happen when the target is built. - -# juce_add_binary_data(ConsoleAppData SOURCES ...) - -# `target_link_libraries` links libraries and JUCE modules to other libraries or executables. Here, -# we're linking our executable target to the `juce::juce_core` module. Inter-module dependencies are -# resolved automatically. If you'd generated a binary data target above, you would need to link to -# it here too. This is a standard CMake command. - -target_link_libraries(ConsoleAppExample - PRIVATE - # ConsoleAppData # If you'd created a binary data target, you'd link to it here - juce::juce_core - PUBLIC - juce::juce_recommended_config_flags - juce::juce_recommended_warning_flags) +# Example Console App CMakeLists.txt + +# To get started on a new console app, copy this entire folder (containing this file and C++ +# sources) to a convenient location, and then start making modifications. For other examples of +# CMakeLists for console apps, check `extras/BinaryBuilder` and `extras/UnitTestRunner` in the JUCE +# repo. + +# The first line of any CMake project should be a call to `cmake_minimum_required`, which checks +# that the installed CMake will be able to understand the following CMakeLists, and ensures that +# CMake's behaviour is compatible with the named version. This is a standard CMake command, so more +# information can be found in the CMake docs. + +cmake_minimum_required(VERSION 3.22) + +# The top-level CMakeLists.txt file for a project must contain a literal, direct call to the +# `project()` command. `project()` sets up some helpful variables that describe source/binary +# directories, and the current project version. This is a standard CMake command. + +project(CONSOLE_APP_EXAMPLE VERSION 0.0.1) + +# If you've installed JUCE somehow (via a package manager, or directly using the CMake install +# target), you'll need to tell this project that it depends on the installed copy of JUCE. If you've +# included JUCE directly in your source tree (perhaps as a submodule), you'll need to tell CMake to +# include that subdirectory as part of the build. + +# find_package(JUCE CONFIG REQUIRED) # If you've installed JUCE to your system +# or +# add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE + +# `juce_add_console_app` adds an executable target with the name passed as the first argument +# (ConsoleAppExample here). This target is a normal CMake target, but has a lot of extra properties +# set up by default. This function accepts many optional arguments. Check the readme at +# `docs/CMake API.md` in the JUCE repo for the full list. + +juce_add_console_app(ConsoleAppExample + PRODUCT_NAME "Console App Example") # The name of the final executable, which can differ from the target name + +# `juce_generate_juce_header` will create a JuceHeader.h for a given target, which will be generated +# into the build tree. This header should be included with `#include `. The include +# path for this header will be automatically added to the target. The main function of the +# JuceHeader is to include all the JUCE module headers for a particular target; if you're happy to +# include module headers directly, you probably don't need to call this. + +# juce_generate_juce_header(ConsoleAppExample) + +# `target_sources` adds source files to a target. We pass the target that needs the sources as the +# first argument, then a visibility parameter for the sources which should normally be PRIVATE. +# Finally, we supply a list of source files that will be built into the target. This is a standard +# CMake command. + +target_sources(ConsoleAppExample + PRIVATE + Main.cpp) + +# `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer +# project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use +# of compile definitions to switch certain features on/off, so if there's a particular feature you +# need that's not on by default, check the module header for the correct flag to set here. These +# definitions will be visible both to your code, and also the JUCE module code, so for new +# definitions, pick unique names that are unlikely to collide! This is a standard CMake command. + +target_compile_definitions(ConsoleAppExample + PRIVATE + # 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_console_app` call + JUCE_USE_CURL=0) # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_console_app` call + +# If the target needs extra binary assets, they can be added here. The first argument is the name of +# a new static library target that will include all the binary resources. There is an optional +# `NAMESPACE` argument that can specify the namespace of the generated binary data class. Finally, +# the SOURCES argument should be followed by a list of source files that should be built into the +# static library. These source files can be of any kind (wav data, images, fonts, icons etc.). +# Conversion to binary-data will happen when the target is built. + +# juce_add_binary_data(ConsoleAppData SOURCES ...) + +# `target_link_libraries` links libraries and JUCE modules to other libraries or executables. Here, +# we're linking our executable target to the `juce::juce_core` module. Inter-module dependencies are +# resolved automatically. If you'd generated a binary data target above, you would need to link to +# it here too. This is a standard CMake command. + +target_link_libraries(ConsoleAppExample + PRIVATE + # ConsoleAppData # If you'd created a binary data target, you'd link to it here + juce::juce_core + PUBLIC + juce::juce_recommended_config_flags + juce::juce_recommended_warning_flags) diff --git a/examples/CMake/GuiApp/CMakeLists.txt b/examples/CMake/GuiApp/CMakeLists.txt index 03be7abbf9..5e36820424 100644 --- a/examples/CMake/GuiApp/CMakeLists.txt +++ b/examples/CMake/GuiApp/CMakeLists.txt @@ -1,102 +1,102 @@ -# Example GUI App CMakeLists.txt - -# To get started on a new GUI app, copy this entire folder (containing this file and C++ sources) to -# a convenient location, and then start making modifications. For other examples of CMakeLists for -# GUI apps, check `extras/Projucer` and `examples/DemoRunner` in the JUCE repo. - -# The first line of any CMake project should be a call to `cmake_minimum_required`, which checks -# that the installed CMake will be able to understand the following CMakeLists, and ensures that -# CMake's behaviour is compatible with the named version. This is a standard CMake command, so more -# information can be found in the CMake docs. - -cmake_minimum_required(VERSION 3.22) - -# The top-level CMakeLists.txt file for a project must contain a literal, direct call to the -# `project()` command. `project()` sets up some helpful variables that describe source/binary -# directories, and the current project version. This is a standard CMake command. - -project(GUI_APP_EXAMPLE VERSION 0.0.1) - -# If you've installed JUCE somehow (via a package manager, or directly using the CMake install -# target), you'll need to tell this project that it depends on the installed copy of JUCE. If you've -# included JUCE directly in your source tree (perhaps as a submodule), you'll need to tell CMake to -# include that subdirectory as part of the build. - -# find_package(JUCE CONFIG REQUIRED) # If you've installed JUCE to your system -# or -# add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE - -# If your app depends the VST2 SDK, perhaps to host VST2 plugins, CMake needs to be told where -# to find the SDK on your system. This setup should be done before calling `juce_add_gui_app`. - -# juce_set_vst2_sdk_path(...) - -# `juce_add_gui_app` adds an executable target with the name passed as the first argument -# (GuiAppExample here). This target is a normal CMake target, but has a lot of extra properties set -# up by default. This function accepts many optional arguments. Check the readme at -# `docs/CMake API.md` in the JUCE repo for the full list. - -juce_add_gui_app(GuiAppExample - # VERSION ... # Set this if the app version is different to the project version - # ICON_BIG ... # ICON_* arguments specify a path to an image file to use as an icon - # ICON_SMALL ... - # DOCUMENT_EXTENSIONS ... # Specify file extensions that should be associated with this app - # COMPANY_NAME ... # Specify the name of the app's author - PRODUCT_NAME "Gui App Example") # The name of the final executable, which can differ from the target name - -# `juce_generate_juce_header` will create a JuceHeader.h for a given target, which will be generated -# into your build tree. This should be included with `#include `. The include path for -# this header will be automatically added to the target. The main function of the JuceHeader is to -# include all your JUCE module headers; if you're happy to include module headers directly, you -# probably don't need to call this. - -# juce_generate_juce_header(GuiAppExample) - -# `target_sources` adds source files to a target. We pass the target that needs the sources as the -# first argument, then a visibility parameter for the sources which should normally be PRIVATE. -# Finally, we supply a list of source files that will be built into the target. This is a standard -# CMake command. - -target_sources(GuiAppExample - PRIVATE - Main.cpp - MainComponent.cpp) - -# `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer -# project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use -# of compile definitions to switch certain features on/off, so if there's a particular feature you -# need that's not on by default, check the module header for the correct flag to set here. These -# definitions will be visible both to your code, and also the JUCE module code, so for new -# definitions, pick unique names that are unlikely to collide! This is a standard CMake command. - -target_compile_definitions(GuiAppExample - PRIVATE - # 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_gui_app` call - JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_gui_app` call - JUCE_APPLICATION_NAME_STRING="$" - JUCE_APPLICATION_VERSION_STRING="$") - -# If your target needs extra binary assets, you can add them here. The first argument is the name of -# a new static library target that will include all the binary resources. There is an optional -# `NAMESPACE` argument that can specify the namespace of the generated binary data class. Finally, -# the SOURCES argument should be followed by a list of source files that should be built into the -# static library. These source files can be of any kind (wav data, images, fonts, icons etc.). -# Conversion to binary-data will happen when your target is built. - -# juce_add_binary_data(GuiAppData SOURCES ...) - -# `target_link_libraries` links libraries and JUCE modules to other libraries or executables. Here, -# we're linking our executable target to the `juce::juce_gui_extra` module. Inter-module -# dependencies are resolved automatically, so `juce_core`, `juce_events` and so on will also be -# linked automatically. If we'd generated a binary data target above, we would need to link to it -# here too. This is a standard CMake command. - -target_link_libraries(GuiAppExample - PRIVATE - # GuiAppData # If we'd created a binary data target, we'd link to it here - juce::juce_gui_extra - PUBLIC - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags) +# Example GUI App CMakeLists.txt + +# To get started on a new GUI app, copy this entire folder (containing this file and C++ sources) to +# a convenient location, and then start making modifications. For other examples of CMakeLists for +# GUI apps, check `extras/Projucer` and `examples/DemoRunner` in the JUCE repo. + +# The first line of any CMake project should be a call to `cmake_minimum_required`, which checks +# that the installed CMake will be able to understand the following CMakeLists, and ensures that +# CMake's behaviour is compatible with the named version. This is a standard CMake command, so more +# information can be found in the CMake docs. + +cmake_minimum_required(VERSION 3.22) + +# The top-level CMakeLists.txt file for a project must contain a literal, direct call to the +# `project()` command. `project()` sets up some helpful variables that describe source/binary +# directories, and the current project version. This is a standard CMake command. + +project(GUI_APP_EXAMPLE VERSION 0.0.1) + +# If you've installed JUCE somehow (via a package manager, or directly using the CMake install +# target), you'll need to tell this project that it depends on the installed copy of JUCE. If you've +# included JUCE directly in your source tree (perhaps as a submodule), you'll need to tell CMake to +# include that subdirectory as part of the build. + +# find_package(JUCE CONFIG REQUIRED) # If you've installed JUCE to your system +# or +# add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE + +# If your app depends the VST2 SDK, perhaps to host VST2 plugins, CMake needs to be told where +# to find the SDK on your system. This setup should be done before calling `juce_add_gui_app`. + +# juce_set_vst2_sdk_path(...) + +# `juce_add_gui_app` adds an executable target with the name passed as the first argument +# (GuiAppExample here). This target is a normal CMake target, but has a lot of extra properties set +# up by default. This function accepts many optional arguments. Check the readme at +# `docs/CMake API.md` in the JUCE repo for the full list. + +juce_add_gui_app(GuiAppExample + # VERSION ... # Set this if the app version is different to the project version + # ICON_BIG ... # ICON_* arguments specify a path to an image file to use as an icon + # ICON_SMALL ... + # DOCUMENT_EXTENSIONS ... # Specify file extensions that should be associated with this app + # COMPANY_NAME ... # Specify the name of the app's author + PRODUCT_NAME "Gui App Example") # The name of the final executable, which can differ from the target name + +# `juce_generate_juce_header` will create a JuceHeader.h for a given target, which will be generated +# into your build tree. This should be included with `#include `. The include path for +# this header will be automatically added to the target. The main function of the JuceHeader is to +# include all your JUCE module headers; if you're happy to include module headers directly, you +# probably don't need to call this. + +# juce_generate_juce_header(GuiAppExample) + +# `target_sources` adds source files to a target. We pass the target that needs the sources as the +# first argument, then a visibility parameter for the sources which should normally be PRIVATE. +# Finally, we supply a list of source files that will be built into the target. This is a standard +# CMake command. + +target_sources(GuiAppExample + PRIVATE + Main.cpp + MainComponent.cpp) + +# `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer +# project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use +# of compile definitions to switch certain features on/off, so if there's a particular feature you +# need that's not on by default, check the module header for the correct flag to set here. These +# definitions will be visible both to your code, and also the JUCE module code, so for new +# definitions, pick unique names that are unlikely to collide! This is a standard CMake command. + +target_compile_definitions(GuiAppExample + PRIVATE + # 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_gui_app` call + JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_gui_app` call + JUCE_APPLICATION_NAME_STRING="$" + JUCE_APPLICATION_VERSION_STRING="$") + +# If your target needs extra binary assets, you can add them here. The first argument is the name of +# a new static library target that will include all the binary resources. There is an optional +# `NAMESPACE` argument that can specify the namespace of the generated binary data class. Finally, +# the SOURCES argument should be followed by a list of source files that should be built into the +# static library. These source files can be of any kind (wav data, images, fonts, icons etc.). +# Conversion to binary-data will happen when your target is built. + +# juce_add_binary_data(GuiAppData SOURCES ...) + +# `target_link_libraries` links libraries and JUCE modules to other libraries or executables. Here, +# we're linking our executable target to the `juce::juce_gui_extra` module. Inter-module +# dependencies are resolved automatically, so `juce_core`, `juce_events` and so on will also be +# linked automatically. If we'd generated a binary data target above, we would need to link to it +# here too. This is a standard CMake command. + +target_link_libraries(GuiAppExample + PRIVATE + # GuiAppData # If we'd created a binary data target, we'd link to it here + juce::juce_gui_extra + PUBLIC + juce::juce_recommended_config_flags + juce::juce_recommended_lto_flags + juce::juce_recommended_warning_flags) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index d3b56ce17f..feca592e6c 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,83 +1,83 @@ -# ============================================================================== -# -# This file is part of the JUCE framework examples. -# Copyright (c) Raw Material Software Limited -# -# The code included in this file is provided under the terms of the ISC license -# http://www.isc.org/downloads/software-support-policy/isc-license. Permission -# to use, copy, modify, and/or distribute this software for any purpose with or -# without fee is hereby granted provided that the above copyright notice and -# this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. -# -# ============================================================================== - -set(CMAKE_FOLDER examples) - -add_subdirectory(CMake) -add_subdirectory(DemoRunner) - -function(_juce_add_pips) - file(GLOB headers - CONFIGURE_DEPENDS LIST_DIRECTORIES false - "${CMAKE_CURRENT_SOURCE_DIR}/*.h") - - if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) - list(REMOVE_ITEM headers - "${CMAKE_CURRENT_SOURCE_DIR}/CameraDemo.h" - "${CMAKE_CURRENT_SOURCE_DIR}/PushNotificationsDemo.h" - "${CMAKE_CURRENT_SOURCE_DIR}/VideoDemo.h") - elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") - list(REMOVE_ITEM headers - "${CMAKE_CURRENT_SOURCE_DIR}/PushNotificationsDemo.h") - endif() - - if(NOT (TARGET juce_ara_sdk - AND (CMAKE_SYSTEM_NAME STREQUAL "Windows" - OR CMAKE_SYSTEM_NAME STREQUAL "Darwin" - OR CMAKE_SYSTEM_NAME STREQUAL "Linux"))) - list(REMOVE_ITEM headers - "${CMAKE_CURRENT_SOURCE_DIR}/ARAPluginDemo.h") - endif() - - if(NOT TARGET juce_vst2_sdk) - list(REMOVE_ITEM headers "${CMAKE_CURRENT_SOURCE_DIR}/ReaperEmbeddedViewPluginDemo.h") - endif() - - if((CMAKE_SYSTEM_NAME STREQUAL "Windows") - AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/WebViewPluginDemo.h") - - if(NOT ("${JUCE_CMAKE_UTILS_DIR}" IN_LIST CMAKE_MODULE_PATH)) - list(APPEND CMAKE_MODULE_PATH "${JUCE_CMAKE_UTILS_DIR}") - endif() - - find_package(WebView2) - - if(NOT WebView2_FOUND) - list(REMOVE_ITEM headers "${CMAKE_CURRENT_SOURCE_DIR}/WebViewPluginDemo.h") - - message(WARNING "The WebViewPluginDemo was not enabled because the WebView2 package wasn't found.") - endif() - endif() - - foreach(header IN ITEMS ${headers}) - juce_add_pip(${header} added_target) - target_link_libraries(${added_target} PUBLIC - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags) - endforeach() -endfunction() - -add_subdirectory(Audio) -add_subdirectory(DSP) -add_subdirectory(GUI) -add_subdirectory(Plugins) -add_subdirectory(Utilities) +# ============================================================================== +# +# This file is part of the JUCE framework examples. +# Copyright (c) Raw Material Software Limited +# +# The code included in this file is provided under the terms of the ISC license +# http://www.isc.org/downloads/software-support-policy/isc-license. Permission +# to use, copy, modify, and/or distribute this software for any purpose with or +# without fee is hereby granted provided that the above copyright notice and +# this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# ============================================================================== + +set(CMAKE_FOLDER examples) + +add_subdirectory(CMake) +add_subdirectory(DemoRunner) + +function(_juce_add_pips) + file(GLOB headers + CONFIGURE_DEPENDS LIST_DIRECTORIES false + "${CMAKE_CURRENT_SOURCE_DIR}/*.h") + + if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) + list(REMOVE_ITEM headers + "${CMAKE_CURRENT_SOURCE_DIR}/CameraDemo.h" + "${CMAKE_CURRENT_SOURCE_DIR}/PushNotificationsDemo.h" + "${CMAKE_CURRENT_SOURCE_DIR}/VideoDemo.h") + elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") + list(REMOVE_ITEM headers + "${CMAKE_CURRENT_SOURCE_DIR}/PushNotificationsDemo.h") + endif() + + if(NOT (TARGET juce_ara_sdk + AND (CMAKE_SYSTEM_NAME STREQUAL "Windows" + OR CMAKE_SYSTEM_NAME STREQUAL "Darwin" + OR CMAKE_SYSTEM_NAME STREQUAL "Linux"))) + list(REMOVE_ITEM headers + "${CMAKE_CURRENT_SOURCE_DIR}/ARAPluginDemo.h") + endif() + + if(NOT TARGET juce_vst2_sdk) + list(REMOVE_ITEM headers "${CMAKE_CURRENT_SOURCE_DIR}/ReaperEmbeddedViewPluginDemo.h") + endif() + + if((CMAKE_SYSTEM_NAME STREQUAL "Windows") + AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/WebViewPluginDemo.h") + + if(NOT ("${JUCE_CMAKE_UTILS_DIR}" IN_LIST CMAKE_MODULE_PATH)) + list(APPEND CMAKE_MODULE_PATH "${JUCE_CMAKE_UTILS_DIR}") + endif() + + find_package(WebView2) + + if(NOT WebView2_FOUND) + list(REMOVE_ITEM headers "${CMAKE_CURRENT_SOURCE_DIR}/WebViewPluginDemo.h") + + message(WARNING "The WebViewPluginDemo was not enabled because the WebView2 package wasn't found.") + endif() + endif() + + foreach(header IN ITEMS ${headers}) + juce_add_pip(${header} added_target) + target_link_libraries(${added_target} PUBLIC + juce::juce_recommended_config_flags + juce::juce_recommended_lto_flags + juce::juce_recommended_warning_flags) + endforeach() +endfunction() + +add_subdirectory(Audio) +add_subdirectory(DSP) +add_subdirectory(GUI) +add_subdirectory(Plugins) +add_subdirectory(Utilities) diff --git a/examples/DSP/CMakeLists.txt b/examples/DSP/CMakeLists.txt index 11e6620937..8063ddfbbd 100644 --- a/examples/DSP/CMakeLists.txt +++ b/examples/DSP/CMakeLists.txt @@ -1,22 +1,22 @@ -# ============================================================================== -# -# This file is part of the JUCE framework examples. -# Copyright (c) Raw Material Software Limited -# -# The code included in this file is provided under the terms of the ISC license -# http://www.isc.org/downloads/software-support-policy/isc-license. Permission -# to use, copy, modify, and/or distribute this software for any purpose with or -# without fee is hereby granted provided that the above copyright notice and -# this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. -# -# ============================================================================== - -_juce_add_pips() +# ============================================================================== +# +# This file is part of the JUCE framework examples. +# Copyright (c) Raw Material Software Limited +# +# The code included in this file is provided under the terms of the ISC license +# http://www.isc.org/downloads/software-support-policy/isc-license. Permission +# to use, copy, modify, and/or distribute this software for any purpose with or +# without fee is hereby granted provided that the above copyright notice and +# this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# ============================================================================== + +_juce_add_pips() diff --git a/examples/DemoRunner/CMakeLists.txt b/examples/DemoRunner/CMakeLists.txt index e49216a9db..d6dc6e3172 100644 --- a/examples/DemoRunner/CMakeLists.txt +++ b/examples/DemoRunner/CMakeLists.txt @@ -1,86 +1,86 @@ -# ============================================================================== -# -# This file is part of the JUCE framework examples. -# Copyright (c) Raw Material Software Limited -# -# The code included in this file is provided under the terms of the ISC license -# http://www.isc.org/downloads/software-support-policy/isc-license. Permission -# to use, copy, modify, and/or distribute this software for any purpose with or -# without fee is hereby granted provided that the above copyright notice and -# this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. -# -# ============================================================================== - -juce_add_gui_app(DemoRunner - BUNDLE_ID com.juce.demorunner - ICON_BIG ${CMAKE_CURRENT_SOURCE_DIR}/Source/JUCEAppIcon.png - NEEDS_CURL TRUE - NEEDS_WEB_BROWSER TRUE - MICROPHONE_PERMISSION_ENABLED TRUE - CAMERA_PERMISSION_ENABLED TRUE - BLUETOOTH_PERMISSION_ENABLED TRUE - FILE_SHARING_ENABLED TRUE - DOCUMENT_BROWSER_ENABLED TRUE - REQUIRES_FULL_SCREEN FALSE - IPAD_SCREEN_ORIENTATIONS UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - IPHONE_SCREEN_ORIENTATIONS UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight) - -juce_generate_juce_header(DemoRunner) - -target_sources(DemoRunner PRIVATE - Source/Demos/DemoPIPs1.cpp - Source/Demos/DemoPIPs2.cpp - Source/Demos/JUCEDemos.cpp - Source/Main.cpp - Source/UI/DemoContentComponent.cpp - Source/UI/MainComponent.cpp) - -target_compile_definitions(DemoRunner PRIVATE - PIP_JUCE_EXAMPLES_DIRECTORY_STRING="${JUCE_SOURCE_DIR}/examples" - JUCE_ALLOW_STATIC_NULL_VARIABLES=0 - JUCE_CONTENT_SHARING=1 - JUCE_DEMO_RUNNER=1 - JUCE_PLUGINHOST_LV2=1 - JUCE_PLUGINHOST_VST3=1 - JUCE_STRICT_REFCOUNTEDPOINTER=1 - JUCE_UNIT_TESTS=1 - JUCE_USE_CAMERA=1 - JUCE_USE_CURL=1 - JUCE_USE_MP3AUDIOFORMAT=1 - JUCE_WEB_BROWSER=1 - # This is a temporary workaround to allow builds to complete on Xcode 15. - # Add -Wl,-ld_classic to the OTHER_LDFLAGS build setting if you need to - # deploy to older versions of macOS/iOS. - JUCE_SILENCE_XCODE_15_LINKER_WARNING=1) - -target_link_libraries(DemoRunner PRIVATE - juce::juce_analytics - juce::juce_animation - juce::juce_audio_utils - juce::juce_box2d - juce::juce_dsp - juce::juce_opengl - juce::juce_osc - juce::juce_product_unlocking - juce::juce_video - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags) - -foreach(folder IN ITEMS ../Assets ../Audio ../DSP ../GUI ../Utilities) - juce_add_bundle_resources_directory(DemoRunner ${folder}) -endforeach() +# ============================================================================== +# +# This file is part of the JUCE framework examples. +# Copyright (c) Raw Material Software Limited +# +# The code included in this file is provided under the terms of the ISC license +# http://www.isc.org/downloads/software-support-policy/isc-license. Permission +# to use, copy, modify, and/or distribute this software for any purpose with or +# without fee is hereby granted provided that the above copyright notice and +# this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# ============================================================================== + +juce_add_gui_app(DemoRunner + BUNDLE_ID com.juce.demorunner + ICON_BIG ${CMAKE_CURRENT_SOURCE_DIR}/Source/JUCEAppIcon.png + NEEDS_CURL TRUE + NEEDS_WEB_BROWSER TRUE + MICROPHONE_PERMISSION_ENABLED TRUE + CAMERA_PERMISSION_ENABLED TRUE + BLUETOOTH_PERMISSION_ENABLED TRUE + FILE_SHARING_ENABLED TRUE + DOCUMENT_BROWSER_ENABLED TRUE + REQUIRES_FULL_SCREEN FALSE + IPAD_SCREEN_ORIENTATIONS UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + IPHONE_SCREEN_ORIENTATIONS UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight) + +juce_generate_juce_header(DemoRunner) + +target_sources(DemoRunner PRIVATE + Source/Demos/DemoPIPs1.cpp + Source/Demos/DemoPIPs2.cpp + Source/Demos/JUCEDemos.cpp + Source/Main.cpp + Source/UI/DemoContentComponent.cpp + Source/UI/MainComponent.cpp) + +target_compile_definitions(DemoRunner PRIVATE + PIP_JUCE_EXAMPLES_DIRECTORY_STRING="${JUCE_SOURCE_DIR}/examples" + JUCE_ALLOW_STATIC_NULL_VARIABLES=0 + JUCE_CONTENT_SHARING=1 + JUCE_DEMO_RUNNER=1 + JUCE_PLUGINHOST_LV2=1 + JUCE_PLUGINHOST_VST3=1 + JUCE_STRICT_REFCOUNTEDPOINTER=1 + JUCE_UNIT_TESTS=1 + JUCE_USE_CAMERA=1 + JUCE_USE_CURL=1 + JUCE_USE_MP3AUDIOFORMAT=1 + JUCE_WEB_BROWSER=1 + # This is a temporary workaround to allow builds to complete on Xcode 15. + # Add -Wl,-ld_classic to the OTHER_LDFLAGS build setting if you need to + # deploy to older versions of macOS/iOS. + JUCE_SILENCE_XCODE_15_LINKER_WARNING=1) + +target_link_libraries(DemoRunner PRIVATE + juce::juce_analytics + juce::juce_animation + juce::juce_audio_utils + juce::juce_box2d + juce::juce_dsp + juce::juce_opengl + juce::juce_osc + juce::juce_product_unlocking + juce::juce_video + juce::juce_recommended_config_flags + juce::juce_recommended_lto_flags + juce::juce_recommended_warning_flags) + +foreach(folder IN ITEMS ../Assets ../Audio ../DSP ../GUI ../Utilities) + juce_add_bundle_resources_directory(DemoRunner ${folder}) +endforeach() diff --git a/examples/GUI/CMakeLists.txt b/examples/GUI/CMakeLists.txt index 11e6620937..8063ddfbbd 100644 --- a/examples/GUI/CMakeLists.txt +++ b/examples/GUI/CMakeLists.txt @@ -1,22 +1,22 @@ -# ============================================================================== -# -# This file is part of the JUCE framework examples. -# Copyright (c) Raw Material Software Limited -# -# The code included in this file is provided under the terms of the ISC license -# http://www.isc.org/downloads/software-support-policy/isc-license. Permission -# to use, copy, modify, and/or distribute this software for any purpose with or -# without fee is hereby granted provided that the above copyright notice and -# this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. -# -# ============================================================================== - -_juce_add_pips() +# ============================================================================== +# +# This file is part of the JUCE framework examples. +# Copyright (c) Raw Material Software Limited +# +# The code included in this file is provided under the terms of the ISC license +# http://www.isc.org/downloads/software-support-policy/isc-license. Permission +# to use, copy, modify, and/or distribute this software for any purpose with or +# without fee is hereby granted provided that the above copyright notice and +# this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# ============================================================================== + +_juce_add_pips() diff --git a/examples/Plugins/CMakeLists.txt b/examples/Plugins/CMakeLists.txt index 11e6620937..8063ddfbbd 100644 --- a/examples/Plugins/CMakeLists.txt +++ b/examples/Plugins/CMakeLists.txt @@ -1,22 +1,22 @@ -# ============================================================================== -# -# This file is part of the JUCE framework examples. -# Copyright (c) Raw Material Software Limited -# -# The code included in this file is provided under the terms of the ISC license -# http://www.isc.org/downloads/software-support-policy/isc-license. Permission -# to use, copy, modify, and/or distribute this software for any purpose with or -# without fee is hereby granted provided that the above copyright notice and -# this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. -# -# ============================================================================== - -_juce_add_pips() +# ============================================================================== +# +# This file is part of the JUCE framework examples. +# Copyright (c) Raw Material Software Limited +# +# The code included in this file is provided under the terms of the ISC license +# http://www.isc.org/downloads/software-support-policy/isc-license. Permission +# to use, copy, modify, and/or distribute this software for any purpose with or +# without fee is hereby granted provided that the above copyright notice and +# this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# ============================================================================== + +_juce_add_pips() diff --git a/examples/Utilities/CMakeLists.txt b/examples/Utilities/CMakeLists.txt index 11e6620937..8063ddfbbd 100644 --- a/examples/Utilities/CMakeLists.txt +++ b/examples/Utilities/CMakeLists.txt @@ -1,22 +1,22 @@ -# ============================================================================== -# -# This file is part of the JUCE framework examples. -# Copyright (c) Raw Material Software Limited -# -# The code included in this file is provided under the terms of the ISC license -# http://www.isc.org/downloads/software-support-policy/isc-license. Permission -# to use, copy, modify, and/or distribute this software for any purpose with or -# without fee is hereby granted provided that the above copyright notice and -# this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. -# -# ============================================================================== - -_juce_add_pips() +# ============================================================================== +# +# This file is part of the JUCE framework examples. +# Copyright (c) Raw Material Software Limited +# +# The code included in this file is provided under the terms of the ISC license +# http://www.isc.org/downloads/software-support-policy/isc-license. Permission +# to use, copy, modify, and/or distribute this software for any purpose with or +# without fee is hereby granted provided that the above copyright notice and +# this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# ============================================================================== + +_juce_add_pips() diff --git a/extras/AudioPerformanceTest/CMakeLists.txt b/extras/AudioPerformanceTest/CMakeLists.txt index 015cd96d44..ac390b56cc 100644 --- a/extras/AudioPerformanceTest/CMakeLists.txt +++ b/extras/AudioPerformanceTest/CMakeLists.txt @@ -1,47 +1,47 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -juce_add_gui_app(AudioPerformanceTest BUNDLE_ID com.juce.AudioPerformanceTest) - -juce_generate_juce_header(AudioPerformanceTest) - -target_sources(AudioPerformanceTest PRIVATE - Source/Main.cpp) - -target_compile_definitions(AudioPerformanceTest PRIVATE - JUCE_USE_CURL=0 JUCE_WEB_BROWSER=0) - -target_link_libraries(AudioPerformanceTest PRIVATE - juce::juce_audio_utils - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags) +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +juce_add_gui_app(AudioPerformanceTest BUNDLE_ID com.juce.AudioPerformanceTest) + +juce_generate_juce_header(AudioPerformanceTest) + +target_sources(AudioPerformanceTest PRIVATE + Source/Main.cpp) + +target_compile_definitions(AudioPerformanceTest PRIVATE + JUCE_USE_CURL=0 JUCE_WEB_BROWSER=0) + +target_link_libraries(AudioPerformanceTest PRIVATE + juce::juce_audio_utils + juce::juce_recommended_config_flags + juce::juce_recommended_lto_flags + juce::juce_recommended_warning_flags) diff --git a/extras/AudioPluginHost/CMakeLists.txt b/extras/AudioPluginHost/CMakeLists.txt index 8d0772e2ab..6f4144d463 100644 --- a/extras/AudioPluginHost/CMakeLists.txt +++ b/extras/AudioPluginHost/CMakeLists.txt @@ -1,93 +1,93 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -juce_add_gui_app(AudioPluginHost - BUNDLE_ID com.juce.pluginhost - ICON_BIG "${CMAKE_CURRENT_SOURCE_DIR}/Source/JUCEAppIcon.png" - MICROPHONE_PERMISSION_ENABLED TRUE - PLUGINHOST_AU TRUE) - -juce_generate_juce_header(AudioPluginHost) - -target_sources(AudioPluginHost PRIVATE - Source/HostStartup.cpp - Source/Plugins/ARAPlugin.cpp - Source/Plugins/IOConfigurationWindow.cpp - Source/Plugins/InternalPlugins.cpp - Source/Plugins/PluginGraph.cpp - Source/UI/GraphEditorPanel.cpp - Source/UI/MainHostWindow.cpp) - -juce_add_binary_data(AudioPluginHostData SOURCES - ../../examples/Assets/cassette_recorder.wav - ../../examples/Assets/cello.wav - ../../examples/Assets/guitar_amp.wav - ../../examples/Assets/proaudio.path - ../../examples/Assets/reverb_ir.wav - ../../examples/Assets/singing.ogg) - -target_compile_definitions(AudioPluginHost PRIVATE - JUCE_ALSA=1 - JUCE_CONTENT_SHARING=1 - JUCE_DIRECTSOUND=1 - JUCE_DISABLE_CAUTIOUS_PARAMETER_ID_CHECKING=1 - JUCE_PLUGINHOST_LADSPA=1 - JUCE_PLUGINHOST_LV2=1 - JUCE_PLUGINHOST_VST3=1 - JUCE_PLUGINHOST_VST=0 - JUCE_PLUGINHOST_ARA=0 - JUCE_USE_CAMERA=0 - JUCE_USE_CDBURNER=0 - JUCE_USE_CDREADER=0 - JUCE_USE_CURL=0 - JUCE_USE_FLAC=0 - JUCE_USE_OGGVORBIS=1 - JUCE_VST3_HOST_CROSS_PLATFORM_UID=1 - JUCE_WASAPI=1 - JUCE_WEB_BROWSER=0 - PIP_JUCE_EXAMPLES_DIRECTORY_STRING="${JUCE_SOURCE_DIR}/examples" - # This is a temporary workaround to allow builds to complete on Xcode 15. - # Add -Wl,-ld_classic to the OTHER_LDFLAGS build setting if you need to - # deploy to older versions of macOS/iOS. - JUCE_SILENCE_XCODE_15_LINKER_WARNING=1) - -target_link_libraries(AudioPluginHost PRIVATE - AudioPluginHostData - juce::juce_audio_utils - juce::juce_cryptography - juce::juce_dsp - juce::juce_opengl - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags) - -juce_add_bundle_resources_directory(AudioPluginHost ../../examples/Assets) +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +juce_add_gui_app(AudioPluginHost + BUNDLE_ID com.juce.pluginhost + ICON_BIG "${CMAKE_CURRENT_SOURCE_DIR}/Source/JUCEAppIcon.png" + MICROPHONE_PERMISSION_ENABLED TRUE + PLUGINHOST_AU TRUE) + +juce_generate_juce_header(AudioPluginHost) + +target_sources(AudioPluginHost PRIVATE + Source/HostStartup.cpp + Source/Plugins/ARAPlugin.cpp + Source/Plugins/IOConfigurationWindow.cpp + Source/Plugins/InternalPlugins.cpp + Source/Plugins/PluginGraph.cpp + Source/UI/GraphEditorPanel.cpp + Source/UI/MainHostWindow.cpp) + +juce_add_binary_data(AudioPluginHostData SOURCES + ../../examples/Assets/cassette_recorder.wav + ../../examples/Assets/cello.wav + ../../examples/Assets/guitar_amp.wav + ../../examples/Assets/proaudio.path + ../../examples/Assets/reverb_ir.wav + ../../examples/Assets/singing.ogg) + +target_compile_definitions(AudioPluginHost PRIVATE + JUCE_ALSA=1 + JUCE_CONTENT_SHARING=1 + JUCE_DIRECTSOUND=1 + JUCE_DISABLE_CAUTIOUS_PARAMETER_ID_CHECKING=1 + JUCE_PLUGINHOST_LADSPA=1 + JUCE_PLUGINHOST_LV2=1 + JUCE_PLUGINHOST_VST3=1 + JUCE_PLUGINHOST_VST=0 + JUCE_PLUGINHOST_ARA=0 + JUCE_USE_CAMERA=0 + JUCE_USE_CDBURNER=0 + JUCE_USE_CDREADER=0 + JUCE_USE_CURL=0 + JUCE_USE_FLAC=0 + JUCE_USE_OGGVORBIS=1 + JUCE_VST3_HOST_CROSS_PLATFORM_UID=1 + JUCE_WASAPI=1 + JUCE_WEB_BROWSER=0 + PIP_JUCE_EXAMPLES_DIRECTORY_STRING="${JUCE_SOURCE_DIR}/examples" + # This is a temporary workaround to allow builds to complete on Xcode 15. + # Add -Wl,-ld_classic to the OTHER_LDFLAGS build setting if you need to + # deploy to older versions of macOS/iOS. + JUCE_SILENCE_XCODE_15_LINKER_WARNING=1) + +target_link_libraries(AudioPluginHost PRIVATE + AudioPluginHostData + juce::juce_audio_utils + juce::juce_cryptography + juce::juce_dsp + juce::juce_opengl + juce::juce_recommended_config_flags + juce::juce_recommended_lto_flags + juce::juce_recommended_warning_flags) + +juce_add_bundle_resources_directory(AudioPluginHost ../../examples/Assets) diff --git a/extras/BinaryBuilder/CMakeLists.txt b/extras/BinaryBuilder/CMakeLists.txt index c607ecb3f1..f0a5ace0f0 100644 --- a/extras/BinaryBuilder/CMakeLists.txt +++ b/extras/BinaryBuilder/CMakeLists.txt @@ -1,50 +1,50 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -juce_add_console_app(BinaryBuilder) - -juce_generate_juce_header(BinaryBuilder) - -target_sources(BinaryBuilder PRIVATE Source/Main.cpp) - -target_compile_definitions(BinaryBuilder PRIVATE - JUCE_USE_CURL=0 - # This is a temporary workaround to allow builds to complete on Xcode 15. - # Add -Wl,-ld_classic to the OTHER_LDFLAGS build setting if you need to - # deploy to older versions of macOS/iOS. - JUCE_SILENCE_XCODE_15_LINKER_WARNING=1) - -target_link_libraries(BinaryBuilder PRIVATE - juce::juce_core - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags) +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +juce_add_console_app(BinaryBuilder) + +juce_generate_juce_header(BinaryBuilder) + +target_sources(BinaryBuilder PRIVATE Source/Main.cpp) + +target_compile_definitions(BinaryBuilder PRIVATE + JUCE_USE_CURL=0 + # This is a temporary workaround to allow builds to complete on Xcode 15. + # Add -Wl,-ld_classic to the OTHER_LDFLAGS build setting if you need to + # deploy to older versions of macOS/iOS. + JUCE_SILENCE_XCODE_15_LINKER_WARNING=1) + +target_link_libraries(BinaryBuilder PRIVATE + juce::juce_core + juce::juce_recommended_config_flags + juce::juce_recommended_lto_flags + juce::juce_recommended_warning_flags) diff --git a/extras/Build/CMake/FindWebView2.cmake b/extras/Build/CMake/FindWebView2.cmake index 348e96a489..741ea2b484 100644 --- a/extras/Build/CMake/FindWebView2.cmake +++ b/extras/Build/CMake/FindWebView2.cmake @@ -1,94 +1,94 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -include(FindPackageHandleStandardArgs) - -if(JUCE_WEBVIEW2_PACKAGE_LOCATION) - set(initial_search_dir ${JUCE_WEBVIEW2_PACKAGE_LOCATION}) -else() - set(initial_search_dir "$ENV{USERPROFILE}/AppData/Local/PackageManagement/NuGet/Packages") -endif() - -file(GLOB subdirs "${initial_search_dir}/*Microsoft.Web.WebView2*") - -if(subdirs) - list(GET subdirs 0 search_dir) - list(LENGTH subdirs num_webview2_packages) - - if(num_webview2_packages GREATER 1) - message(WARNING "Multiple WebView2 packages found in the local NuGet folder. Proceeding with ${search_dir}.") - endif() - - find_path(WebView2_root_dir build/native/include/WebView2.h HINTS ${search_dir}) - - set(WebView2_include_dir "${WebView2_root_dir}/build/native/include") - - if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64") - set(WebView2_arch arm64) - else() - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(WebView2_arch x64) - elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(WebView2_arch x86) - endif() - endif() - - set(WebView2_library "${WebView2_root_dir}/build/native/${WebView2_arch}/WebView2LoaderStatic.lib") -elseif(NOT WebView2_FIND_QUIETLY) - message(WARNING - "WebView2 wasn't found in the the local NuGet folder." - "\n" - "To install NuGet and the WebView2 package containing the statically linked library, " - "open a PowerShell and issue the following commands" - "\n" - "> Register-PackageSource -provider NuGet -name nugetRepository -location https://www.nuget.org/api/v2\n" - "> Install-Package Microsoft.Web.WebView2 -Scope CurrentUser -RequiredVersion 1.0.1901.177 -Source nugetRepository\n" - "\n" - "Alternatively you can use the JUCE_WEBVIEW2_PACKAGE_LOCATION CMake variable to specify the directory " - "where this find script is looking for the *Microsoft.Web.WebView2* package directory.") -endif() - -find_package_handle_standard_args(WebView2 DEFAULT_MSG WebView2_include_dir WebView2_library) - -if(WebView2_FOUND) - set(WebView2_INCLUDE_DIRS ${WebView2_include_dir}) - set(WebView2_LIBRARIES ${WebView2_library}) - - mark_as_advanced(WebView2_library WebView2_include_dir WebView2_root_dir) - - if(NOT TARGET juce_webview2) - add_library(juce_webview2 INTERFACE) - add_library(juce::juce_webview2 ALIAS juce_webview2) - target_include_directories(juce_webview2 INTERFACE ${WebView2_INCLUDE_DIRS}) - target_link_libraries(juce_webview2 INTERFACE ${WebView2_LIBRARIES}) - endif() -endif() +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +include(FindPackageHandleStandardArgs) + +if(JUCE_WEBVIEW2_PACKAGE_LOCATION) + set(initial_search_dir ${JUCE_WEBVIEW2_PACKAGE_LOCATION}) +else() + set(initial_search_dir "$ENV{USERPROFILE}/AppData/Local/PackageManagement/NuGet/Packages") +endif() + +file(GLOB subdirs "${initial_search_dir}/*Microsoft.Web.WebView2*") + +if(subdirs) + list(GET subdirs 0 search_dir) + list(LENGTH subdirs num_webview2_packages) + + if(num_webview2_packages GREATER 1) + message(WARNING "Multiple WebView2 packages found in the local NuGet folder. Proceeding with ${search_dir}.") + endif() + + find_path(WebView2_root_dir build/native/include/WebView2.h HINTS ${search_dir}) + + set(WebView2_include_dir "${WebView2_root_dir}/build/native/include") + + if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64") + set(WebView2_arch arm64) + else() + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(WebView2_arch x64) + elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(WebView2_arch x86) + endif() + endif() + + set(WebView2_library "${WebView2_root_dir}/build/native/${WebView2_arch}/WebView2LoaderStatic.lib") +elseif(NOT WebView2_FIND_QUIETLY) + message(WARNING + "WebView2 wasn't found in the the local NuGet folder." + "\n" + "To install NuGet and the WebView2 package containing the statically linked library, " + "open a PowerShell and issue the following commands" + "\n" + "> Register-PackageSource -provider NuGet -name nugetRepository -location https://www.nuget.org/api/v2\n" + "> Install-Package Microsoft.Web.WebView2 -Scope CurrentUser -RequiredVersion 1.0.1901.177 -Source nugetRepository\n" + "\n" + "Alternatively you can use the JUCE_WEBVIEW2_PACKAGE_LOCATION CMake variable to specify the directory " + "where this find script is looking for the *Microsoft.Web.WebView2* package directory.") +endif() + +find_package_handle_standard_args(WebView2 DEFAULT_MSG WebView2_include_dir WebView2_library) + +if(WebView2_FOUND) + set(WebView2_INCLUDE_DIRS ${WebView2_include_dir}) + set(WebView2_LIBRARIES ${WebView2_library}) + + mark_as_advanced(WebView2_library WebView2_include_dir WebView2_root_dir) + + if(NOT TARGET juce_webview2) + add_library(juce_webview2 INTERFACE) + add_library(juce::juce_webview2 ALIAS juce_webview2) + target_include_directories(juce_webview2 INTERFACE ${WebView2_INCLUDE_DIRS}) + target_link_libraries(juce_webview2 INTERFACE ${WebView2_LIBRARIES}) + endif() +endif() diff --git a/extras/Build/CMake/JUCECheckAtomic.cmake b/extras/Build/CMake/JUCECheckAtomic.cmake index 46fd7b901b..31864287fb 100644 --- a/extras/Build/CMake/JUCECheckAtomic.cmake +++ b/extras/Build/CMake/JUCECheckAtomic.cmake @@ -1,129 +1,128 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -function(_juce_create_atomic_target target_name) - add_library("${target_name}" INTERFACE) - add_library("juce::${target_name}" ALIAS "${target_name}") - - if(NOT ((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD"))) - return() - endif() - - set(test_atomic_with_is_lock_free_file_contents - [[ - #include - - int main (int argc, char** argv) - { - std::atomic ll { static_cast (argc) }; - ll ^= static_cast (ll.is_lock_free()); - return static_cast (ll); - } - ]]) - - set(test_simple_atomic_file_contents - [[ - #include - - int main (int argc, char** argv) - { - std::atomic ll { static_cast (argc) }; - ll ^= 1; - return static_cast (ll); - } - ]]) - - string(RANDOM LENGTH 16 random_file_string) - set(test_file_name "${CMAKE_CURRENT_BINARY_DIR}/check_atomic_${random_file_string}.cpp") - - string(RANDOM LENGTH 16 random_dir_string) - set(test_bindir "${CMAKE_CURRENT_BINARY_DIR}/check_atomic_dir_${random_dir_string}") - - file(WRITE "${test_file_name}" "${test_atomic_with_is_lock_free_file_contents}") - - try_compile(compile_result "${test_bindir}" "${test_file_name}" - OUTPUT_VARIABLE test_build_output_0 - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED TRUE - CXX_EXTENSIONS FALSE) - - if(NOT compile_result) - try_compile(compile_result "${test_bindir}" "${test_file_name}" - OUTPUT_VARIABLE test_build_output_1 - LINK_LIBRARIES atomic - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED TRUE - CXX_EXTENSIONS FALSE) - - if (NOT compile_result) - file(WRITE "${test_file_name}" "${test_simple_atomic_file_contents}") - - try_compile(compile_result "${test_bindir}" "${test_file_name}" - OUTPUT_VARIABLE test_build_output_2 - LINK_LIBRARIES atomic - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED TRUE - CXX_EXTENSIONS FALSE) - - if (NOT compile_result) - message(FATAL_ERROR - "First build output:\n" - "${test_build_output_0}" - "\n\nSecond build output:\n" - "${test_build_output_1}" - "\n\nThird build output:\n" - "${test_build_output_2}" - "\n\nJUCE requires support for std::atomic, but this system cannot " - "successfully compile a program which uses std::atomic. " - "You may need to install a dedicated libatomic package using your " - "system's package manager.") - else() - message(WARNING - "First build output:\n" - "${test_build_output_0}" - "\n\nSecond build output:\n" - "${test_build_output_1}" - "\n\nIf you are seeing this warning it means that the libatomic library" - "on this system doesn't support is_lock_free." - "Please let the JUCE team know.") - endif() - endif() - - target_link_libraries("${target_name}" INTERFACE atomic) - endif() - - file(REMOVE "${test_file_name}") - file(REMOVE_RECURSE "${test_bindir}") -endfunction() - -_juce_create_atomic_target(juce_atomic_wrapper) - +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +function(_juce_create_atomic_target target_name) + add_library("${target_name}" INTERFACE) + add_library("juce::${target_name}" ALIAS "${target_name}") + + if(NOT ((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD"))) + return() + endif() + + set(test_atomic_with_is_lock_free_file_contents + [[ + #include + + int main (int argc, char** argv) + { + std::atomic ll { static_cast (argc) }; + ll ^= static_cast (ll.is_lock_free()); + return static_cast (ll); + } + ]]) + + set(test_simple_atomic_file_contents + [[ + #include + + int main (int argc, char** argv) + { + std::atomic ll { static_cast (argc) }; + ll ^= 1; + return static_cast (ll); + } + ]]) + + string(RANDOM LENGTH 16 random_file_string) + set(test_file_name "${CMAKE_CURRENT_BINARY_DIR}/check_atomic_${random_file_string}.cpp") + + string(RANDOM LENGTH 16 random_dir_string) + set(test_bindir "${CMAKE_CURRENT_BINARY_DIR}/check_atomic_dir_${random_dir_string}") + + file(WRITE "${test_file_name}" "${test_atomic_with_is_lock_free_file_contents}") + + try_compile(compile_result "${test_bindir}" "${test_file_name}" + OUTPUT_VARIABLE test_build_output_0 + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED TRUE + CXX_EXTENSIONS FALSE) + + if(NOT compile_result) + try_compile(compile_result "${test_bindir}" "${test_file_name}" + OUTPUT_VARIABLE test_build_output_1 + LINK_LIBRARIES atomic + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED TRUE + CXX_EXTENSIONS FALSE) + + if (NOT compile_result) + file(WRITE "${test_file_name}" "${test_simple_atomic_file_contents}") + + try_compile(compile_result "${test_bindir}" "${test_file_name}" + OUTPUT_VARIABLE test_build_output_2 + LINK_LIBRARIES atomic + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED TRUE + CXX_EXTENSIONS FALSE) + + if (NOT compile_result) + message(FATAL_ERROR + "First build output:\n" + "${test_build_output_0}" + "\n\nSecond build output:\n" + "${test_build_output_1}" + "\n\nThird build output:\n" + "${test_build_output_2}" + "\n\nJUCE requires support for std::atomic, but this system cannot " + "successfully compile a program which uses std::atomic. " + "You may need to install a dedicated libatomic package using your " + "system's package manager.") + else() + message(WARNING + "First build output:\n" + "${test_build_output_0}" + "\n\nSecond build output:\n" + "${test_build_output_1}" + "\n\nIf you are seeing this warning it means that the libatomic library" + "on this system doesn't support is_lock_free." + "Please let the JUCE team know.") + endif() + endif() + + target_link_libraries("${target_name}" INTERFACE atomic) + endif() + + file(REMOVE "${test_file_name}") + file(REMOVE_RECURSE "${test_bindir}") +endfunction() + +_juce_create_atomic_target(juce_atomic_wrapper) diff --git a/extras/Build/CMake/JUCEHelperTargets.cmake b/extras/Build/CMake/JUCEHelperTargets.cmake index e7002ae1c7..244cccec71 100644 --- a/extras/Build/CMake/JUCEHelperTargets.cmake +++ b/extras/Build/CMake/JUCEHelperTargets.cmake @@ -1,151 +1,151 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -add_library(juce_recommended_warning_flags INTERFACE) -add_library(juce::juce_recommended_warning_flags ALIAS juce_recommended_warning_flags) - -function(_juce_get_debug_config_genex result) - get_property(debug_configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS) - if(NOT debug_configs) - set(debug_configs Debug) - endif() - list(TRANSFORM debug_configs REPLACE [[^.+$]] [[$]]) - list(JOIN debug_configs "," debug_configs) - # $ doesn't accept multiple configurations until CMake 3.19 - set(${result} "$" PARENT_SCOPE) -endfunction() - -# ================================================================================================== - -if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) - target_compile_options(juce_recommended_warning_flags INTERFACE "/W4") -elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")) - target_compile_options(juce_recommended_warning_flags INTERFACE - -Wall - -Wshadow-all - -Wshorten-64-to-32 - -Wstrict-aliasing - -Wuninitialized - -Wunused-parameter - -Wconversion - -Wsign-compare - -Wint-conversion - -Wconditional-uninitialized - -Wconstant-conversion - -Wsign-conversion - -Wbool-conversion - -Wextra-semi - -Wunreachable-code - -Wcast-align - -Wshift-sign-overflow - -Wmissing-prototypes - -Wnullable-to-nonnull-conversion - -Wno-ignored-qualifiers - -Wswitch-enum - -Wpedantic - -Wdeprecated - -Wfloat-equal - -Wmissing-field-initializers - $<$,$>: - -Wzero-as-null-pointer-constant - -Wunused-private-field - -Woverloaded-virtual - -Wreorder - -Winconsistent-missing-destructor-override> - $<$,$>: - -Wunguarded-availability - -Wunguarded-availability-new>) -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - target_compile_options(juce_recommended_warning_flags INTERFACE - -Wall - -Wextra - -Wpedantic - -Wstrict-aliasing - -Wuninitialized - -Wunused-parameter - -Wsign-compare - -Wsign-conversion - -Wunreachable-code - -Wcast-align - -Wno-implicit-fallthrough - -Wno-maybe-uninitialized - -Wno-ignored-qualifiers - -Wno-multichar - -Wswitch-enum - -Wredundant-decls - -Wno-strict-overflow - -Wshadow - -Wfloat-equal - -Wmissing-field-initializers - $<$: - -Woverloaded-virtual - -Wreorder - -Wzero-as-null-pointer-constant>) -endif() - -# ================================================================================================== - -add_library(juce_recommended_config_flags INTERFACE) -add_library(juce::juce_recommended_config_flags ALIAS juce_recommended_config_flags) - -if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) - _juce_get_debug_config_genex(debug_config) - target_compile_options(juce_recommended_config_flags INTERFACE - $ $<$:/MP> /EHsc) -elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")) - _juce_get_debug_config_genex(debug_config) - target_compile_options(juce_recommended_config_flags INTERFACE - $<${debug_config}:-g -O0> - $<$:-O3>) -endif() - -# ================================================================================================== - -add_library(juce_recommended_lto_flags INTERFACE) -add_library(juce::juce_recommended_lto_flags ALIAS juce_recommended_lto_flags) - -if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) - target_compile_options(juce_recommended_lto_flags INTERFACE - $<$:$,-GL,-flto>>) - target_link_libraries(juce_recommended_lto_flags INTERFACE - $<$:$<$:-LTCG>>) -elseif((NOT MINGW) AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))) - target_compile_options(juce_recommended_lto_flags INTERFACE $<$:-flto>) - target_link_libraries(juce_recommended_lto_flags INTERFACE $<$:-flto>) - # Xcode 15.0 requires this flag to avoid a compiler bug - target_link_libraries(juce_recommended_lto_flags INTERFACE - $<$:$<$:-Wl,-weak_reference_mismatches,weak>>) -endif() +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +add_library(juce_recommended_warning_flags INTERFACE) +add_library(juce::juce_recommended_warning_flags ALIAS juce_recommended_warning_flags) + +function(_juce_get_debug_config_genex result) + get_property(debug_configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS) + if(NOT debug_configs) + set(debug_configs Debug) + endif() + list(TRANSFORM debug_configs REPLACE [[^.+$]] [[$]]) + list(JOIN debug_configs "," debug_configs) + # $ doesn't accept multiple configurations until CMake 3.19 + set(${result} "$" PARENT_SCOPE) +endfunction() + +# ================================================================================================== + +if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) + target_compile_options(juce_recommended_warning_flags INTERFACE "/W4") +elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")) + target_compile_options(juce_recommended_warning_flags INTERFACE + -Wall + -Wshadow-all + -Wshorten-64-to-32 + -Wstrict-aliasing + -Wuninitialized + -Wunused-parameter + -Wconversion + -Wsign-compare + -Wint-conversion + -Wconditional-uninitialized + -Wconstant-conversion + -Wsign-conversion + -Wbool-conversion + -Wextra-semi + -Wunreachable-code + -Wcast-align + -Wshift-sign-overflow + -Wmissing-prototypes + -Wnullable-to-nonnull-conversion + -Wno-ignored-qualifiers + -Wswitch-enum + -Wpedantic + -Wdeprecated + -Wfloat-equal + -Wmissing-field-initializers + $<$,$>: + -Wzero-as-null-pointer-constant + -Wunused-private-field + -Woverloaded-virtual + -Wreorder + -Winconsistent-missing-destructor-override> + $<$,$>: + -Wunguarded-availability + -Wunguarded-availability-new>) +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_compile_options(juce_recommended_warning_flags INTERFACE + -Wall + -Wextra + -Wpedantic + -Wstrict-aliasing + -Wuninitialized + -Wunused-parameter + -Wsign-compare + -Wsign-conversion + -Wunreachable-code + -Wcast-align + -Wno-implicit-fallthrough + -Wno-maybe-uninitialized + -Wno-ignored-qualifiers + -Wno-multichar + -Wswitch-enum + -Wredundant-decls + -Wno-strict-overflow + -Wshadow + -Wfloat-equal + -Wmissing-field-initializers + $<$: + -Woverloaded-virtual + -Wreorder + -Wzero-as-null-pointer-constant>) +endif() + +# ================================================================================================== + +add_library(juce_recommended_config_flags INTERFACE) +add_library(juce::juce_recommended_config_flags ALIAS juce_recommended_config_flags) + +if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) + _juce_get_debug_config_genex(debug_config) + target_compile_options(juce_recommended_config_flags INTERFACE + $ $<$:/MP> /EHsc) +elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")) + _juce_get_debug_config_genex(debug_config) + target_compile_options(juce_recommended_config_flags INTERFACE + $<${debug_config}:-g -O0> + $<$:-O3>) +endif() + +# ================================================================================================== + +add_library(juce_recommended_lto_flags INTERFACE) +add_library(juce::juce_recommended_lto_flags ALIAS juce_recommended_lto_flags) + +if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) + target_compile_options(juce_recommended_lto_flags INTERFACE + $<$:$,-GL,-flto>>) + target_link_libraries(juce_recommended_lto_flags INTERFACE + $<$:$<$:-LTCG>>) +elseif((NOT MINGW) AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))) + target_compile_options(juce_recommended_lto_flags INTERFACE $<$:-flto>) + target_link_libraries(juce_recommended_lto_flags INTERFACE $<$:-flto>) + # Xcode 15.0 requires this flag to avoid a compiler bug + target_link_libraries(juce_recommended_lto_flags INTERFACE + $<$:$<$:-Wl,-weak_reference_mismatches,weak>>) +endif() diff --git a/extras/Build/CMake/JUCEModuleSupport.cmake b/extras/Build/CMake/JUCEModuleSupport.cmake index e89cc5dd3d..0d93d36033 100644 --- a/extras/Build/CMake/JUCEModuleSupport.cmake +++ b/extras/Build/CMake/JUCEModuleSupport.cmake @@ -1,714 +1,714 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -# ================================================================================================== -# JUCE Modules Support Helper Functions -# -# In this file, functions intended for use by end-users have the prefix `juce_`. -# Functions beginning with an underscore should be considered private and susceptible to -# change, so don't call them directly. -# -# See the readme at `docs/CMake API.md` for more information about CMake usage, -# including documentation of the public functions in this file. -# ================================================================================================== - -include_guard(GLOBAL) -cmake_minimum_required(VERSION 3.22) - -if(NOT CMAKE_C_COMPILE_OBJECT) - message(FATAL_ERROR "A C compiler is required to build JUCE. Add 'C' to your project's LANGUAGES.") -endif() - -# ================================================================================================== - -set(JUCE_CMAKE_UTILS_DIR ${CMAKE_CURRENT_LIST_DIR} - CACHE INTERNAL "The path to the folder holding this file and other resources") - -include("${JUCE_CMAKE_UTILS_DIR}/JUCEHelperTargets.cmake") -include("${JUCE_CMAKE_UTILS_DIR}/JUCECheckAtomic.cmake") - -# Tries to discover the target platform architecture, which is necessary for -# naming VST3 bundle folders and including bundled libraries from modules -function(_juce_find_target_architecture result) - set(test_file "${JUCE_CMAKE_UTILS_DIR}/juce_runtime_arch_detection.cpp") - try_compile(compile_result "${CMAKE_CURRENT_BINARY_DIR}" "${test_file}" - OUTPUT_VARIABLE compile_output) - string(REGEX REPLACE ".*JUCE_ARCH ([a-zA-Z0-9_-]*).*" "\\1" match_result "${compile_output}") - set("${result}" "${match_result}" PARENT_SCOPE) -endfunction() - -if((CMAKE_SYSTEM_NAME STREQUAL "Windows") - OR (CMAKE_SYSTEM_NAME STREQUAL "Linux") - OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD") - OR MSYS - OR MINGW) - # If you really need to override the detected arch for some reason, - # you can configure the build with -DJUCE_TARGET_ARCHITECTURE= - if(NOT DEFINED JUCE_TARGET_ARCHITECTURE) - _juce_find_target_architecture(target_arch) - set(JUCE_TARGET_ARCHITECTURE "${target_arch}" - CACHE INTERNAL "The target architecture, used to name internal folders in VST3 bundles, and to locate bundled libraries in modules") - endif() - - if(CMAKE_SYSTEM_NAME STREQUAL "Windows") - if ((CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "X86" AND NOT JUCE_TARGET_ARCHITECTURE STREQUAL "i386") - OR (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64" - AND NOT (JUCE_TARGET_ARCHITECTURE STREQUAL "i386" - OR JUCE_TARGET_ARCHITECTURE STREQUAL "x86_64"))) - set(windows_helpers_can_run FALSE) - else() - set(windows_helpers_can_run TRUE) - endif() - - set(JUCE_WINDOWS_HELPERS_CAN_RUN ${windows_helpers_can_run} - CACHE INTERNAL "Signals whether plugin related helper utilities can run on the build machine") - endif() -endif() - -# ================================================================================================== - -function(_juce_add_interface_library target) - add_library(${target} INTERFACE) - target_sources(${target} INTERFACE ${ARGN}) -endfunction() - -# ================================================================================================== - -function(_juce_add_standard_defs juce_target) - _juce_get_debug_config_genex(debug_config) - target_compile_definitions(${juce_target} INTERFACE - JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 - $ - $<$:JUCE_ANDROID=1>) -endfunction() - -# ================================================================================================== - -macro(_juce_make_absolute path) - if(NOT IS_ABSOLUTE "${${path}}") - get_filename_component(${path} "${${path}}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") - endif() - - string(REGEX REPLACE "\\\\" "/" ${path} "${${path}}") -endmacro() - -macro(_juce_make_absolute_and_check path) - _juce_make_absolute("${path}") - - if(NOT EXISTS "${${path}}") - message(FATAL_ERROR "No file at path ${${path}}") - endif() -endmacro() - -# ================================================================================================== - -# This creates an imported interface library with a random name, and then adds -# the fields from a JUCE module header to the target as INTERFACE_ properties. -# We can extract properties later using `_juce_get_metadata`. -# This way, the interface library ends up behaving a bit like a dictionary, -# and we don't have to parse the module header from scratch every time we -# want to find a specific key. -function(_juce_extract_metadata_block delim_str file_with_block out_dict) - string(RANDOM LENGTH 16 random_string) - set(target_name "${random_string}_dict") - set(${out_dict} "${target_name}" PARENT_SCOPE) - add_library(${target_name} INTERFACE IMPORTED) - - if(NOT EXISTS ${file_with_block}) - message(FATAL_ERROR "Unable to find file ${file_with_block}") - endif() - - file(STRINGS ${file_with_block} module_header_contents) - - set(last_written_key) - set(append NO) - - foreach(line IN LISTS module_header_contents) - if(NOT append) - if(line MATCHES "[\t ]*BEGIN_${delim_str}[\t ]*") - set(append YES) - endif() - - continue() - endif() - - if(append AND (line MATCHES "[\t ]*END_${delim_str}[\t ]*")) - break() - endif() - - if(line MATCHES "^[\t ]*([a-zA-Z]+):") - set(last_written_key "${CMAKE_MATCH_1}") - endif() - - string(REGEX REPLACE "^[\t ]*${last_written_key}:[\t ]*" "" line "${line}") - string(REGEX REPLACE "[\t ,]+" ";" line "${line}") - - set_property(TARGET ${target_name} APPEND PROPERTY - "INTERFACE_JUCE_${last_written_key}" "${line}") - endforeach() -endfunction() - -# Fetches properties attached to a metadata target. -function(_juce_get_metadata target key out_var) - get_target_property(content "${target}" "INTERFACE_JUCE_${key}") - - if("${content}" STREQUAL "content-NOTFOUND") - set(${out_var} PARENT_SCOPE) - else() - set(${out_var} "${content}" PARENT_SCOPE) - endif() -endfunction() - -# ================================================================================================== -function(_juce_should_build_module_source filename output_var) - get_filename_component(trimmed_filename "${filename}" NAME_WE) - string(TOLOWER "${trimmed_filename}" trimmed_filename_lowercase) - - set(system_name_regex_for_suffix - "android\;Android" - "ios\;iOS" - "linux\;Linux|.*BSD" - "mac\;Darwin" - "osx\;Darwin" - "windows\;Windows") - - set(result TRUE) - - foreach(pair IN LISTS system_name_regex_for_suffix) - list(GET pair 0 suffix) - list(GET pair 1 regex) - - if((trimmed_filename_lowercase MATCHES "_${suffix}$") AND NOT (CMAKE_SYSTEM_NAME MATCHES "${regex}")) - set(result FALSE) - endif() - endforeach() - - set("${output_var}" "${result}" PARENT_SCOPE) -endfunction() - -function(_juce_module_sources module_path output_path built_sources other_sources) - get_filename_component(module_parent_path ${module_path} DIRECTORY) - get_filename_component(module_glob ${module_path} NAME) - - file(GLOB_RECURSE all_module_files - CONFIGURE_DEPENDS LIST_DIRECTORIES FALSE - RELATIVE "${module_parent_path}" - "${module_path}/*") - - set(base_path "${module_glob}/${module_glob}") - - set(module_cpp ${all_module_files}) - list(FILTER module_cpp INCLUDE REGEX "^${base_path}[^/]*\\.(c|cc|cpp|cxx|s|asm)$") - - if(APPLE) - set(module_mm ${all_module_files}) - list(FILTER module_mm INCLUDE REGEX "^${base_path}[^/]*\\.mm$") - - if(module_mm) - set(module_mm_replaced ${module_mm}) - list(TRANSFORM module_mm_replaced REPLACE "\\.mm$" ".cpp") - list(REMOVE_ITEM module_cpp ${module_mm_replaced}) - endif() - - set(module_apple_files ${all_module_files}) - list(FILTER module_apple_files INCLUDE REGEX "${base_path}[^/]*\\.(m|mm|metal|r|swift)$") - list(APPEND module_cpp ${module_apple_files}) - endif() - - set(headers ${all_module_files}) - - set(module_files_to_build) - - foreach(filename IN LISTS module_cpp) - _juce_should_build_module_source("${filename}" should_build_file) - - if(should_build_file) - list(APPEND module_files_to_build "${filename}") - endif() - endforeach() - - if(NOT "${module_files_to_build}" STREQUAL "") - list(REMOVE_ITEM headers ${module_files_to_build}) - endif() - - foreach(source_list IN ITEMS module_files_to_build headers) - list(TRANSFORM ${source_list} PREPEND "${output_path}/") - endforeach() - - set(${built_sources} ${module_files_to_build} PARENT_SCOPE) - set(${other_sources} ${headers} PARENT_SCOPE) -endfunction() - -# ================================================================================================== - -function(_juce_get_all_plugin_kinds out) - set(${out} AU AUv3 AAX LV2 Standalone Unity VST VST3 PARENT_SCOPE) -endfunction() - -function(_juce_get_platform_plugin_kinds out) - set(result Standalone) - - if(APPLE AND (CMAKE_GENERATOR STREQUAL "Xcode")) - list(APPEND result AUv3) - endif() - - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - list(APPEND result AU) - endif() - - if(NOT CMAKE_SYSTEM_NAME STREQUAL "iOS" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android") - list(APPEND result VST LV2) - if(NOT (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) - list(APPEND result Unity VST3) - endif() - endif() - - if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - AND (CMAKE_SYSTEM_NAME STREQUAL "Darwin" - OR (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND JUCE_TARGET_ARCHITECTURE STREQUAL "x86_64"))) - list(APPEND result AAX) - endif() - - set(${out} ${result} PARENT_SCOPE) -endfunction() - -function(_juce_add_plugin_definitions target visibility) - _juce_get_all_plugin_kinds(options) - cmake_parse_arguments(JUCE_ARG "${options}" "" "" ${ARGN}) - - foreach(opt IN LISTS options) - set(flag_value 0) - - if(JUCE_ARG_${opt}) - set(flag_value 1) - endif() - - target_compile_definitions(${target} ${visibility} "JucePlugin_Build_${opt}=${flag_value}") - endforeach() -endfunction() - -# ================================================================================================== - -# Takes a target, a link visibility, if it should be a weak link, and a variable-length list of -# framework names. On macOS, for non-weak links, this finds the requested frameworks using -# `find_library`. -function(_juce_link_frameworks target visibility) - set(options WEAK) - cmake_parse_arguments(JUCE_LINK_FRAMEWORKS "${options}" "" "" ${ARGN}) - foreach(framework IN LISTS JUCE_LINK_FRAMEWORKS_UNPARSED_ARGUMENTS) - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - if(JUCE_LINK_FRAMEWORKS_WEAK) - set(framework_flags "-weak_framework ${framework}") - else() - find_library("juce_found_${framework}" "${framework}" REQUIRED) - set(framework_flags "${juce_found_${framework}}") - endif() - elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") - if(JUCE_LINK_FRAMEWORKS_WEAK) - set(framework_flags "-weak_framework ${framework}") - else() - set(framework_flags "-framework ${framework}") - endif() - endif() - if(NOT framework_flags STREQUAL "") - target_link_libraries("${target}" "${visibility}" "${framework_flags}") - endif() - endforeach() -endfunction() - -# ================================================================================================== - -function(_juce_add_plugin_wrapper_target format path out_path) - _juce_module_sources("${path}" "${out_path}" out_var headers) - set(target_name juce_audio_plugin_client_${format}) - - _juce_add_interface_library("${target_name}" ${out_var}) - _juce_add_plugin_definitions("${target_name}" INTERFACE ${format}) - _juce_add_standard_defs("${target_name}") - - target_compile_features("${target_name}" INTERFACE cxx_std_17) - add_library("juce::${target_name}" ALIAS "${target_name}") - - if(format STREQUAL "AUv3") - _juce_link_frameworks("${target_name}" INTERFACE AVFoundation) - - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - _juce_link_frameworks("${target_name}" INTERFACE AudioUnit) - endif() - elseif(format STREQUAL "AU") - target_include_directories("${target_name}" INTERFACE "${out_path}/juce_audio_plugin_client/AU") - _juce_link_frameworks("${target_name}" INTERFACE AudioUnit CoreAudioKit) - endif() -endfunction() - -# ================================================================================================== - -function(_juce_link_libs_from_metadata module_name dict key) - _juce_get_metadata("${dict}" "${key}" libs) - - if(libs) - target_link_libraries(${module_name} INTERFACE ${libs}) - endif() -endfunction() - -# ================================================================================================== - -function(_juce_create_pkgconfig_target name) - set(options NOLINK) - cmake_parse_arguments(JUCE_ARG "${options}" "" "" ${ARGN}) - - if(TARGET juce::pkgconfig_${name}) - return() - endif() - - find_package(PkgConfig REQUIRED) - pkg_check_modules(${name} ${JUCE_ARG_UNPARSED_ARGUMENTS}) - - add_library(pkgconfig_${name} INTERFACE) - add_library(juce::pkgconfig_${name} ALIAS pkgconfig_${name}) - install(TARGETS pkgconfig_${name} EXPORT JUCE) - - set(pairs - "INCLUDE_DIRECTORIES\;INCLUDE_DIRS" - "LINK_OPTIONS\;LDFLAGS_OTHER" - "COMPILE_OPTIONS\;CFLAGS_OTHER") - - if(NOT JUCE_ARG_NOLINK) - list(APPEND pairs "LINK_LIBRARIES\;LINK_LIBRARIES") - endif() - - foreach(pair IN LISTS pairs) - list(GET pair 0 key) - list(GET pair 1 value) - - if(${name}_${value}) - set_target_properties(pkgconfig_${name} PROPERTIES INTERFACE_${key} "${${name}_${value}}") - endif() - endforeach() -endfunction() - -# ================================================================================================== - -function(_juce_add_library_path target path) - if(EXISTS "${path}") - target_link_directories(${target} INTERFACE ${path}) - endif() -endfunction() - -function(_juce_add_module_staticlib_paths module_target module_path) - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - _juce_add_library_path(${module_target} "${module_path}/libs/MacOSX") - elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") - _juce_add_library_path(${module_target} "${module_path}/libs/iOS") - elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) - _juce_add_library_path(${module_target} "${module_path}/libs/Linux/${JUCE_TARGET_ARCHITECTURE}") - elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") - if(CMAKE_GENERATOR MATCHES "Visual Studio [0-9]+ (20[0-9]+)") - set(arch "$,x64,Win32>") - - if(NOT CMAKE_GENERATOR_PLATFORM STREQUAL "") - set(arch ${CMAKE_GENERATOR_PLATFORM}) - endif() - - set(runtime_lib "$>") - set(subfolder "MDd") - set(subfolder "$,MTd,${subfolder}>") - set(subfolder "$,MD,${subfolder}>") - set(subfolder "$,MT,${subfolder}>") - target_link_directories(${module_target} INTERFACE - "${module_path}/libs/VisualStudio${CMAKE_MATCH_1}/${arch}/${subfolder}") - endif() - elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") - _juce_add_library_path(${module_target} "${module_path}/libs/Android/${CMAKE_ANDROID_ARCH_ABI}") - endif() -endfunction() - -# ================================================================================================== - -function(_juce_remove_empty_list_elements arg) - list(FILTER ${arg} EXCLUDE REGEX "^$") - set(${arg} ${${arg}} PARENT_SCOPE) -endfunction() - -function(juce_add_module module_path) - set(one_value_args INSTALL_PATH ALIAS_NAMESPACE) - cmake_parse_arguments(JUCE_ARG "" "${one_value_args}" "" ${ARGN}) - - _juce_make_absolute(module_path) - - get_filename_component(module_name ${module_path} NAME) - get_filename_component(module_parent_path ${module_path} DIRECTORY) - - set(module_header_name "${module_name}.h") - - if(NOT EXISTS "${module_path}/${module_header_name}") - set(module_header_name "${module_header_name}pp") - endif() - - if(NOT EXISTS "${module_path}/${module_header_name}") - message(FATAL_ERROR "Could not locate module header for module '${module_path}'") - endif() - - set(base_path "${module_parent_path}") - - _juce_module_sources("${module_path}" "${base_path}" globbed_sources headers) - - set(all_module_sources) - - if(${module_name} STREQUAL "juce_audio_plugin_client") - list(REMOVE_ITEM headers - "${module_path}/LV2/juce_LV2ManifestHelper.cpp" - "${module_path}/VST3/juce_VST3ManifestHelper.mm" - "${module_path}/VST3/juce_VST3ManifestHelper.cpp") - - _juce_get_platform_plugin_kinds(plugin_kinds) - - foreach(kind IN LISTS plugin_kinds) - _juce_add_plugin_wrapper_target(${kind} "${module_path}" "${base_path}") - endforeach() - - file(GLOB_RECURSE all_module_files - CONFIGURE_DEPENDS LIST_DIRECTORIES FALSE - RELATIVE "${module_parent_path}" - "${module_path}/*") - else() - list(APPEND all_module_sources ${globbed_sources}) - endif() - - _juce_add_interface_library(${module_name} ${all_module_sources}) - - set_property(GLOBAL APPEND PROPERTY _juce_module_names ${module_name}) - - set_target_properties(${module_name} PROPERTIES - INTERFACE_JUCE_MODULE_SOURCES "${globbed_sources}" - INTERFACE_JUCE_MODULE_HEADERS "${headers}" - INTERFACE_JUCE_MODULE_PATH "${base_path}") - - if(JUCE_ENABLE_MODULE_SOURCE_GROUPS) - target_sources(${module_name} INTERFACE ${headers}) - endif() - - if(${module_name} STREQUAL "juce_core") - _juce_add_standard_defs(${module_name}) - - target_link_libraries(juce_core INTERFACE juce::juce_atomic_wrapper) - - if(CMAKE_SYSTEM_NAME MATCHES ".*BSD") - target_link_libraries(juce_core INTERFACE execinfo) - elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") - target_sources(juce_core INTERFACE "${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c") - target_include_directories(juce_core INTERFACE "${ANDROID_NDK}/sources/android/cpufeatures") - target_link_libraries(juce_core INTERFACE android log) - endif() - endif() - - if(${module_name} STREQUAL "juce_audio_processors") - add_library(juce_vst3_headers INTERFACE) - - target_compile_definitions(juce_vst3_headers INTERFACE "$<$:JUCE_CUSTOM_VST3_SDK=1>") - - target_include_directories(juce_vst3_headers INTERFACE - "$<$:$>" - "$<$>:${base_path}/juce_audio_processors/format_types/VST3_SDK>") - - target_link_libraries(juce_audio_processors INTERFACE juce_vst3_headers) - - add_library(juce_lilv_headers INTERFACE) - set(lv2_base_path "${base_path}/juce_audio_processors/format_types/LV2_SDK") - target_include_directories(juce_lilv_headers INTERFACE - "${lv2_base_path}" - "${lv2_base_path}/lv2" - "${lv2_base_path}/serd" - "${lv2_base_path}/sord" - "${lv2_base_path}/sord/src" - "${lv2_base_path}/sratom" - "${lv2_base_path}/lilv" - "${lv2_base_path}/lilv/src") - target_link_libraries(juce_audio_processors INTERFACE juce_lilv_headers) - - add_library(juce_ara_headers INTERFACE) - - target_include_directories(juce_ara_headers INTERFACE - "$<$:$>") - - target_link_libraries(juce_audio_processors INTERFACE juce_ara_headers) - - if(JUCE_ARG_ALIAS_NAMESPACE) - add_library(${JUCE_ARG_ALIAS_NAMESPACE}::juce_vst3_headers ALIAS juce_vst3_headers) - add_library(${JUCE_ARG_ALIAS_NAMESPACE}::juce_lilv_headers ALIAS juce_lilv_headers) - add_library(${JUCE_ARG_ALIAS_NAMESPACE}::juce_ara_headers ALIAS juce_ara_headers) - endif() - endif() - - target_include_directories(${module_name} INTERFACE ${base_path}) - - target_compile_definitions(${module_name} INTERFACE JUCE_MODULE_AVAILABLE_${module_name}=1) - - if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) - target_compile_definitions(${module_name} INTERFACE LINUX=1) - endif() - - if((${module_name} STREQUAL "juce_audio_devices") AND (CMAKE_SYSTEM_NAME STREQUAL "Android")) - add_subdirectory("${module_path}/native/oboe") - target_link_libraries(${module_name} INTERFACE oboe) - endif() - - if((${module_name} STREQUAL "juce_opengl") AND (CMAKE_SYSTEM_NAME STREQUAL "Android")) - set(platform_supports_gl3 0) - - if(CMAKE_SYSTEM_VERSION VERSION_GREATER_EQUAL 18) - set(platform_supports_gl3 1) - endif() - - if(platform_supports_gl3) - target_compile_definitions(${module_name} INTERFACE JUCE_ANDROID_GL_ES_VERSION_3_0=1) - endif() - - target_link_libraries(${module_name} INTERFACE EGL $) - endif() - - _juce_extract_metadata_block(JUCE_MODULE_DECLARATION "${module_path}/${module_header_name}" metadata_dict) - - _juce_get_metadata("${metadata_dict}" minimumCppStandard module_cpp_standard) - - if(module_cpp_standard) - target_compile_features(${module_name} INTERFACE cxx_std_${module_cpp_standard}) - else() - target_compile_features(${module_name} INTERFACE cxx_std_11) - endif() - - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - _juce_get_metadata("${metadata_dict}" OSXFrameworks module_osxframeworks) - - _juce_remove_empty_list_elements(module_osxframeworks) - foreach(module_framework IN LISTS module_osxframeworks) - _juce_link_frameworks("${module_name}" INTERFACE "${module_framework}") - endforeach() - - _juce_get_metadata("${metadata_dict}" WeakOSXFrameworks module_weakosxframeworks) - - _juce_remove_empty_list_elements(module_weakosxframeworks) - foreach(module_framework IN LISTS module_weakosxframeworks) - _juce_link_frameworks("${module_name}" INTERFACE WEAK "${module_framework}") - endforeach() - - _juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" OSXLibs) - elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") - _juce_get_metadata("${metadata_dict}" iOSFrameworks module_iosframeworks) - - _juce_remove_empty_list_elements(module_iosframeworks) - foreach(module_framework IN LISTS module_iosframeworks) - _juce_link_frameworks("${module_name}" INTERFACE "${module_framework}") - endforeach() - - _juce_get_metadata("${metadata_dict}" WeakiOSFrameworks module_weakiosframeworks) - - _juce_remove_empty_list_elements(module_weakiosframeworks) - foreach(module_framework IN LISTS module_weakiosframeworks) - _juce_link_frameworks("${module_name}" INTERFACE WEAK "${module_framework}") - endforeach() - - _juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" iOSLibs) - elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) - _juce_get_metadata("${metadata_dict}" linuxPackages module_linuxpackages) - - if(module_linuxpackages) - _juce_create_pkgconfig_target(${module_name}_LINUX_DEPS ${module_linuxpackages}) - target_link_libraries(${module_name} INTERFACE juce::pkgconfig_${module_name}_LINUX_DEPS) - endif() - - _juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" linuxLibs) - elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") - if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) - if(module_name MATCHES "juce_gui_basics|juce_audio_processors|juce_core|juce_graphics") - target_compile_options(${module_name} INTERFACE /bigobj) - endif() - - _juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" windowsLibs) - elseif(MSYS OR MINGW) - if(module_name STREQUAL "juce_gui_basics") - target_compile_options(${module_name} INTERFACE "-Wa,-mbig-obj") - endif() - - _juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" mingwLibs) - endif() - endif() - - _juce_get_metadata("${metadata_dict}" dependencies module_dependencies) - target_link_libraries(${module_name} INTERFACE ${module_dependencies}) - - _juce_get_metadata("${metadata_dict}" searchpaths module_searchpaths) - - if(NOT module_searchpaths STREQUAL "") - foreach(module_searchpath IN LISTS module_searchpaths) - target_include_directories(${module_name} - INTERFACE "${module_path}/${module_searchpath}") - endforeach() - endif() - - _juce_add_module_staticlib_paths("${module_name}" "${module_path}") - - if(JUCE_ARG_INSTALL_PATH) - install(DIRECTORY "${module_path}" DESTINATION "${JUCE_ARG_INSTALL_PATH}") - endif() - - if(JUCE_ARG_ALIAS_NAMESPACE) - add_library(${JUCE_ARG_ALIAS_NAMESPACE}::${module_name} ALIAS ${module_name}) - endif() -endfunction() - -function(juce_add_modules) - set(one_value_args INSTALL_PATH ALIAS_NAMESPACE) - cmake_parse_arguments(JUCE_ARG "" "${one_value_args}" "" ${ARGN}) - - foreach(path IN LISTS JUCE_ARG_UNPARSED_ARGUMENTS) - juce_add_module(${path} - INSTALL_PATH "${JUCE_ARG_INSTALL_PATH}" - ALIAS_NAMESPACE "${JUCE_ARG_ALIAS_NAMESPACE}") - endforeach() -endfunction() - -# When source groups are enabled, this function sets the HEADER_FILE_ONLY property on any module -# source files that should not be built. This is called automatically by the juce_add_* functions. -function(_juce_fixup_module_source_groups) - if(JUCE_ENABLE_MODULE_SOURCE_GROUPS) - get_property(all_modules GLOBAL PROPERTY _juce_module_names) - - foreach(module_name IN LISTS all_modules) - get_target_property(path ${module_name} INTERFACE_JUCE_MODULE_PATH) - get_target_property(header_files ${module_name} INTERFACE_JUCE_MODULE_HEADERS) - get_target_property(source_files ${module_name} INTERFACE_JUCE_MODULE_SOURCES) - source_group(TREE ${path} PREFIX "JUCE Modules" FILES ${header_files} ${source_files}) - set_source_files_properties(${header_files} PROPERTIES HEADER_FILE_ONLY TRUE) - endforeach() - endif() -endfunction() +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +# ================================================================================================== +# JUCE Modules Support Helper Functions +# +# In this file, functions intended for use by end-users have the prefix `juce_`. +# Functions beginning with an underscore should be considered private and susceptible to +# change, so don't call them directly. +# +# See the readme at `docs/CMake API.md` for more information about CMake usage, +# including documentation of the public functions in this file. +# ================================================================================================== + +include_guard(GLOBAL) +cmake_minimum_required(VERSION 3.22) + +if(NOT CMAKE_C_COMPILE_OBJECT) + message(FATAL_ERROR "A C compiler is required to build JUCE. Add 'C' to your project's LANGUAGES.") +endif() + +# ================================================================================================== + +set(JUCE_CMAKE_UTILS_DIR ${CMAKE_CURRENT_LIST_DIR} + CACHE INTERNAL "The path to the folder holding this file and other resources") + +include("${JUCE_CMAKE_UTILS_DIR}/JUCEHelperTargets.cmake") +include("${JUCE_CMAKE_UTILS_DIR}/JUCECheckAtomic.cmake") + +# Tries to discover the target platform architecture, which is necessary for +# naming VST3 bundle folders and including bundled libraries from modules +function(_juce_find_target_architecture result) + set(test_file "${JUCE_CMAKE_UTILS_DIR}/juce_runtime_arch_detection.cpp") + try_compile(compile_result "${CMAKE_CURRENT_BINARY_DIR}" "${test_file}" + OUTPUT_VARIABLE compile_output) + string(REGEX REPLACE ".*JUCE_ARCH ([a-zA-Z0-9_-]*).*" "\\1" match_result "${compile_output}") + set("${result}" "${match_result}" PARENT_SCOPE) +endfunction() + +if((CMAKE_SYSTEM_NAME STREQUAL "Windows") + OR (CMAKE_SYSTEM_NAME STREQUAL "Linux") + OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD") + OR MSYS + OR MINGW) + # If you really need to override the detected arch for some reason, + # you can configure the build with -DJUCE_TARGET_ARCHITECTURE= + if(NOT DEFINED JUCE_TARGET_ARCHITECTURE) + _juce_find_target_architecture(target_arch) + set(JUCE_TARGET_ARCHITECTURE "${target_arch}" + CACHE INTERNAL "The target architecture, used to name internal folders in VST3 bundles, and to locate bundled libraries in modules") + endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + if ((CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "X86" AND NOT JUCE_TARGET_ARCHITECTURE STREQUAL "i386") + OR (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64" + AND NOT (JUCE_TARGET_ARCHITECTURE STREQUAL "i386" + OR JUCE_TARGET_ARCHITECTURE STREQUAL "x86_64"))) + set(windows_helpers_can_run FALSE) + else() + set(windows_helpers_can_run TRUE) + endif() + + set(JUCE_WINDOWS_HELPERS_CAN_RUN ${windows_helpers_can_run} + CACHE INTERNAL "Signals whether plugin related helper utilities can run on the build machine") + endif() +endif() + +# ================================================================================================== + +function(_juce_add_interface_library target) + add_library(${target} INTERFACE) + target_sources(${target} INTERFACE ${ARGN}) +endfunction() + +# ================================================================================================== + +function(_juce_add_standard_defs juce_target) + _juce_get_debug_config_genex(debug_config) + target_compile_definitions(${juce_target} INTERFACE + JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 + $ + $<$:JUCE_ANDROID=1>) +endfunction() + +# ================================================================================================== + +macro(_juce_make_absolute path) + if(NOT IS_ABSOLUTE "${${path}}") + get_filename_component(${path} "${${path}}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") + endif() + + string(REGEX REPLACE "\\\\" "/" ${path} "${${path}}") +endmacro() + +macro(_juce_make_absolute_and_check path) + _juce_make_absolute("${path}") + + if(NOT EXISTS "${${path}}") + message(FATAL_ERROR "No file at path ${${path}}") + endif() +endmacro() + +# ================================================================================================== + +# This creates an imported interface library with a random name, and then adds +# the fields from a JUCE module header to the target as INTERFACE_ properties. +# We can extract properties later using `_juce_get_metadata`. +# This way, the interface library ends up behaving a bit like a dictionary, +# and we don't have to parse the module header from scratch every time we +# want to find a specific key. +function(_juce_extract_metadata_block delim_str file_with_block out_dict) + string(RANDOM LENGTH 16 random_string) + set(target_name "${random_string}_dict") + set(${out_dict} "${target_name}" PARENT_SCOPE) + add_library(${target_name} INTERFACE IMPORTED) + + if(NOT EXISTS ${file_with_block}) + message(FATAL_ERROR "Unable to find file ${file_with_block}") + endif() + + file(STRINGS ${file_with_block} module_header_contents) + + set(last_written_key) + set(append NO) + + foreach(line IN LISTS module_header_contents) + if(NOT append) + if(line MATCHES "[\t ]*BEGIN_${delim_str}[\t ]*") + set(append YES) + endif() + + continue() + endif() + + if(append AND (line MATCHES "[\t ]*END_${delim_str}[\t ]*")) + break() + endif() + + if(line MATCHES "^[\t ]*([a-zA-Z]+):") + set(last_written_key "${CMAKE_MATCH_1}") + endif() + + string(REGEX REPLACE "^[\t ]*${last_written_key}:[\t ]*" "" line "${line}") + string(REGEX REPLACE "[\t ,]+" ";" line "${line}") + + set_property(TARGET ${target_name} APPEND PROPERTY + "INTERFACE_JUCE_${last_written_key}" "${line}") + endforeach() +endfunction() + +# Fetches properties attached to a metadata target. +function(_juce_get_metadata target key out_var) + get_target_property(content "${target}" "INTERFACE_JUCE_${key}") + + if("${content}" STREQUAL "content-NOTFOUND") + set(${out_var} PARENT_SCOPE) + else() + set(${out_var} "${content}" PARENT_SCOPE) + endif() +endfunction() + +# ================================================================================================== +function(_juce_should_build_module_source filename output_var) + get_filename_component(trimmed_filename "${filename}" NAME_WE) + string(TOLOWER "${trimmed_filename}" trimmed_filename_lowercase) + + set(system_name_regex_for_suffix + "android\;Android" + "ios\;iOS" + "linux\;Linux|.*BSD" + "mac\;Darwin" + "osx\;Darwin" + "windows\;Windows") + + set(result TRUE) + + foreach(pair IN LISTS system_name_regex_for_suffix) + list(GET pair 0 suffix) + list(GET pair 1 regex) + + if((trimmed_filename_lowercase MATCHES "_${suffix}$") AND NOT (CMAKE_SYSTEM_NAME MATCHES "${regex}")) + set(result FALSE) + endif() + endforeach() + + set("${output_var}" "${result}" PARENT_SCOPE) +endfunction() + +function(_juce_module_sources module_path output_path built_sources other_sources) + get_filename_component(module_parent_path ${module_path} DIRECTORY) + get_filename_component(module_glob ${module_path} NAME) + + file(GLOB_RECURSE all_module_files + CONFIGURE_DEPENDS LIST_DIRECTORIES FALSE + RELATIVE "${module_parent_path}" + "${module_path}/*") + + set(base_path "${module_glob}/${module_glob}") + + set(module_cpp ${all_module_files}) + list(FILTER module_cpp INCLUDE REGEX "^${base_path}[^/]*\\.(c|cc|cpp|cxx|s|asm)$") + + if(APPLE) + set(module_mm ${all_module_files}) + list(FILTER module_mm INCLUDE REGEX "^${base_path}[^/]*\\.mm$") + + if(module_mm) + set(module_mm_replaced ${module_mm}) + list(TRANSFORM module_mm_replaced REPLACE "\\.mm$" ".cpp") + list(REMOVE_ITEM module_cpp ${module_mm_replaced}) + endif() + + set(module_apple_files ${all_module_files}) + list(FILTER module_apple_files INCLUDE REGEX "${base_path}[^/]*\\.(m|mm|metal|r|swift)$") + list(APPEND module_cpp ${module_apple_files}) + endif() + + set(headers ${all_module_files}) + + set(module_files_to_build) + + foreach(filename IN LISTS module_cpp) + _juce_should_build_module_source("${filename}" should_build_file) + + if(should_build_file) + list(APPEND module_files_to_build "${filename}") + endif() + endforeach() + + if(NOT "${module_files_to_build}" STREQUAL "") + list(REMOVE_ITEM headers ${module_files_to_build}) + endif() + + foreach(source_list IN ITEMS module_files_to_build headers) + list(TRANSFORM ${source_list} PREPEND "${output_path}/") + endforeach() + + set(${built_sources} ${module_files_to_build} PARENT_SCOPE) + set(${other_sources} ${headers} PARENT_SCOPE) +endfunction() + +# ================================================================================================== + +function(_juce_get_all_plugin_kinds out) + set(${out} AU AUv3 AAX LV2 Standalone Unity VST VST3 PARENT_SCOPE) +endfunction() + +function(_juce_get_platform_plugin_kinds out) + set(result Standalone) + + if(APPLE AND (CMAKE_GENERATOR STREQUAL "Xcode")) + list(APPEND result AUv3) + endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + list(APPEND result AU) + endif() + + if(NOT CMAKE_SYSTEM_NAME STREQUAL "iOS" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android") + list(APPEND result VST LV2) + if(NOT (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) + list(APPEND result Unity VST3) + endif() + endif() + + if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + AND (CMAKE_SYSTEM_NAME STREQUAL "Darwin" + OR (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND JUCE_TARGET_ARCHITECTURE STREQUAL "x86_64"))) + list(APPEND result AAX) + endif() + + set(${out} ${result} PARENT_SCOPE) +endfunction() + +function(_juce_add_plugin_definitions target visibility) + _juce_get_all_plugin_kinds(options) + cmake_parse_arguments(JUCE_ARG "${options}" "" "" ${ARGN}) + + foreach(opt IN LISTS options) + set(flag_value 0) + + if(JUCE_ARG_${opt}) + set(flag_value 1) + endif() + + target_compile_definitions(${target} ${visibility} "JucePlugin_Build_${opt}=${flag_value}") + endforeach() +endfunction() + +# ================================================================================================== + +# Takes a target, a link visibility, if it should be a weak link, and a variable-length list of +# framework names. On macOS, for non-weak links, this finds the requested frameworks using +# `find_library`. +function(_juce_link_frameworks target visibility) + set(options WEAK) + cmake_parse_arguments(JUCE_LINK_FRAMEWORKS "${options}" "" "" ${ARGN}) + foreach(framework IN LISTS JUCE_LINK_FRAMEWORKS_UNPARSED_ARGUMENTS) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + if(JUCE_LINK_FRAMEWORKS_WEAK) + set(framework_flags "-weak_framework ${framework}") + else() + find_library("juce_found_${framework}" "${framework}" REQUIRED) + set(framework_flags "${juce_found_${framework}}") + endif() + elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") + if(JUCE_LINK_FRAMEWORKS_WEAK) + set(framework_flags "-weak_framework ${framework}") + else() + set(framework_flags "-framework ${framework}") + endif() + endif() + if(NOT framework_flags STREQUAL "") + target_link_libraries("${target}" "${visibility}" "${framework_flags}") + endif() + endforeach() +endfunction() + +# ================================================================================================== + +function(_juce_add_plugin_wrapper_target format path out_path) + _juce_module_sources("${path}" "${out_path}" out_var headers) + set(target_name juce_audio_plugin_client_${format}) + + _juce_add_interface_library("${target_name}" ${out_var}) + _juce_add_plugin_definitions("${target_name}" INTERFACE ${format}) + _juce_add_standard_defs("${target_name}") + + target_compile_features("${target_name}" INTERFACE cxx_std_17) + add_library("juce::${target_name}" ALIAS "${target_name}") + + if(format STREQUAL "AUv3") + _juce_link_frameworks("${target_name}" INTERFACE AVFoundation) + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + _juce_link_frameworks("${target_name}" INTERFACE AudioUnit) + endif() + elseif(format STREQUAL "AU") + target_include_directories("${target_name}" INTERFACE "${out_path}/juce_audio_plugin_client/AU") + _juce_link_frameworks("${target_name}" INTERFACE AudioUnit CoreAudioKit) + endif() +endfunction() + +# ================================================================================================== + +function(_juce_link_libs_from_metadata module_name dict key) + _juce_get_metadata("${dict}" "${key}" libs) + + if(libs) + target_link_libraries(${module_name} INTERFACE ${libs}) + endif() +endfunction() + +# ================================================================================================== + +function(_juce_create_pkgconfig_target name) + set(options NOLINK) + cmake_parse_arguments(JUCE_ARG "${options}" "" "" ${ARGN}) + + if(TARGET juce::pkgconfig_${name}) + return() + endif() + + find_package(PkgConfig REQUIRED) + pkg_check_modules(${name} ${JUCE_ARG_UNPARSED_ARGUMENTS}) + + add_library(pkgconfig_${name} INTERFACE) + add_library(juce::pkgconfig_${name} ALIAS pkgconfig_${name}) + install(TARGETS pkgconfig_${name} EXPORT JUCE) + + set(pairs + "INCLUDE_DIRECTORIES\;INCLUDE_DIRS" + "LINK_OPTIONS\;LDFLAGS_OTHER" + "COMPILE_OPTIONS\;CFLAGS_OTHER") + + if(NOT JUCE_ARG_NOLINK) + list(APPEND pairs "LINK_LIBRARIES\;LINK_LIBRARIES") + endif() + + foreach(pair IN LISTS pairs) + list(GET pair 0 key) + list(GET pair 1 value) + + if(${name}_${value}) + set_target_properties(pkgconfig_${name} PROPERTIES INTERFACE_${key} "${${name}_${value}}") + endif() + endforeach() +endfunction() + +# ================================================================================================== + +function(_juce_add_library_path target path) + if(EXISTS "${path}") + target_link_directories(${target} INTERFACE ${path}) + endif() +endfunction() + +function(_juce_add_module_staticlib_paths module_target module_path) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + _juce_add_library_path(${module_target} "${module_path}/libs/MacOSX") + elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") + _juce_add_library_path(${module_target} "${module_path}/libs/iOS") + elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) + _juce_add_library_path(${module_target} "${module_path}/libs/Linux/${JUCE_TARGET_ARCHITECTURE}") + elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") + if(CMAKE_GENERATOR MATCHES "Visual Studio [0-9]+ (20[0-9]+)") + set(arch "$,x64,Win32>") + + if(NOT CMAKE_GENERATOR_PLATFORM STREQUAL "") + set(arch ${CMAKE_GENERATOR_PLATFORM}) + endif() + + set(runtime_lib "$>") + set(subfolder "MDd") + set(subfolder "$,MTd,${subfolder}>") + set(subfolder "$,MD,${subfolder}>") + set(subfolder "$,MT,${subfolder}>") + target_link_directories(${module_target} INTERFACE + "${module_path}/libs/VisualStudio${CMAKE_MATCH_1}/${arch}/${subfolder}") + endif() + elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") + _juce_add_library_path(${module_target} "${module_path}/libs/Android/${CMAKE_ANDROID_ARCH_ABI}") + endif() +endfunction() + +# ================================================================================================== + +function(_juce_remove_empty_list_elements arg) + list(FILTER ${arg} EXCLUDE REGEX "^$") + set(${arg} ${${arg}} PARENT_SCOPE) +endfunction() + +function(juce_add_module module_path) + set(one_value_args INSTALL_PATH ALIAS_NAMESPACE) + cmake_parse_arguments(JUCE_ARG "" "${one_value_args}" "" ${ARGN}) + + _juce_make_absolute(module_path) + + get_filename_component(module_name ${module_path} NAME) + get_filename_component(module_parent_path ${module_path} DIRECTORY) + + set(module_header_name "${module_name}.h") + + if(NOT EXISTS "${module_path}/${module_header_name}") + set(module_header_name "${module_header_name}pp") + endif() + + if(NOT EXISTS "${module_path}/${module_header_name}") + message(FATAL_ERROR "Could not locate module header for module '${module_path}'") + endif() + + set(base_path "${module_parent_path}") + + _juce_module_sources("${module_path}" "${base_path}" globbed_sources headers) + + set(all_module_sources) + + if(${module_name} STREQUAL "juce_audio_plugin_client") + list(REMOVE_ITEM headers + "${module_path}/LV2/juce_LV2ManifestHelper.cpp" + "${module_path}/VST3/juce_VST3ManifestHelper.mm" + "${module_path}/VST3/juce_VST3ManifestHelper.cpp") + + _juce_get_platform_plugin_kinds(plugin_kinds) + + foreach(kind IN LISTS plugin_kinds) + _juce_add_plugin_wrapper_target(${kind} "${module_path}" "${base_path}") + endforeach() + + file(GLOB_RECURSE all_module_files + CONFIGURE_DEPENDS LIST_DIRECTORIES FALSE + RELATIVE "${module_parent_path}" + "${module_path}/*") + else() + list(APPEND all_module_sources ${globbed_sources}) + endif() + + _juce_add_interface_library(${module_name} ${all_module_sources}) + + set_property(GLOBAL APPEND PROPERTY _juce_module_names ${module_name}) + + set_target_properties(${module_name} PROPERTIES + INTERFACE_JUCE_MODULE_SOURCES "${globbed_sources}" + INTERFACE_JUCE_MODULE_HEADERS "${headers}" + INTERFACE_JUCE_MODULE_PATH "${base_path}") + + if(JUCE_ENABLE_MODULE_SOURCE_GROUPS) + target_sources(${module_name} INTERFACE ${headers}) + endif() + + if(${module_name} STREQUAL "juce_core") + _juce_add_standard_defs(${module_name}) + + target_link_libraries(juce_core INTERFACE juce::juce_atomic_wrapper) + + if(CMAKE_SYSTEM_NAME MATCHES ".*BSD") + target_link_libraries(juce_core INTERFACE execinfo) + elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") + target_sources(juce_core INTERFACE "${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c") + target_include_directories(juce_core INTERFACE "${ANDROID_NDK}/sources/android/cpufeatures") + target_link_libraries(juce_core INTERFACE android log) + endif() + endif() + + if(${module_name} STREQUAL "juce_audio_processors") + add_library(juce_vst3_headers INTERFACE) + + target_compile_definitions(juce_vst3_headers INTERFACE "$<$:JUCE_CUSTOM_VST3_SDK=1>") + + target_include_directories(juce_vst3_headers INTERFACE + "$<$:$>" + "$<$>:${base_path}/juce_audio_processors/format_types/VST3_SDK>") + + target_link_libraries(juce_audio_processors INTERFACE juce_vst3_headers) + + add_library(juce_lilv_headers INTERFACE) + set(lv2_base_path "${base_path}/juce_audio_processors/format_types/LV2_SDK") + target_include_directories(juce_lilv_headers INTERFACE + "${lv2_base_path}" + "${lv2_base_path}/lv2" + "${lv2_base_path}/serd" + "${lv2_base_path}/sord" + "${lv2_base_path}/sord/src" + "${lv2_base_path}/sratom" + "${lv2_base_path}/lilv" + "${lv2_base_path}/lilv/src") + target_link_libraries(juce_audio_processors INTERFACE juce_lilv_headers) + + add_library(juce_ara_headers INTERFACE) + + target_include_directories(juce_ara_headers INTERFACE + "$<$:$>") + + target_link_libraries(juce_audio_processors INTERFACE juce_ara_headers) + + if(JUCE_ARG_ALIAS_NAMESPACE) + add_library(${JUCE_ARG_ALIAS_NAMESPACE}::juce_vst3_headers ALIAS juce_vst3_headers) + add_library(${JUCE_ARG_ALIAS_NAMESPACE}::juce_lilv_headers ALIAS juce_lilv_headers) + add_library(${JUCE_ARG_ALIAS_NAMESPACE}::juce_ara_headers ALIAS juce_ara_headers) + endif() + endif() + + target_include_directories(${module_name} INTERFACE ${base_path}) + + target_compile_definitions(${module_name} INTERFACE JUCE_MODULE_AVAILABLE_${module_name}=1) + + if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) + target_compile_definitions(${module_name} INTERFACE LINUX=1) + endif() + + if((${module_name} STREQUAL "juce_audio_devices") AND (CMAKE_SYSTEM_NAME STREQUAL "Android")) + add_subdirectory("${module_path}/native/oboe") + target_link_libraries(${module_name} INTERFACE oboe) + endif() + + if((${module_name} STREQUAL "juce_opengl") AND (CMAKE_SYSTEM_NAME STREQUAL "Android")) + set(platform_supports_gl3 0) + + if(CMAKE_SYSTEM_VERSION VERSION_GREATER_EQUAL 18) + set(platform_supports_gl3 1) + endif() + + if(platform_supports_gl3) + target_compile_definitions(${module_name} INTERFACE JUCE_ANDROID_GL_ES_VERSION_3_0=1) + endif() + + target_link_libraries(${module_name} INTERFACE EGL $) + endif() + + _juce_extract_metadata_block(JUCE_MODULE_DECLARATION "${module_path}/${module_header_name}" metadata_dict) + + _juce_get_metadata("${metadata_dict}" minimumCppStandard module_cpp_standard) + + if(module_cpp_standard) + target_compile_features(${module_name} INTERFACE cxx_std_${module_cpp_standard}) + else() + target_compile_features(${module_name} INTERFACE cxx_std_11) + endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + _juce_get_metadata("${metadata_dict}" OSXFrameworks module_osxframeworks) + + _juce_remove_empty_list_elements(module_osxframeworks) + foreach(module_framework IN LISTS module_osxframeworks) + _juce_link_frameworks("${module_name}" INTERFACE "${module_framework}") + endforeach() + + _juce_get_metadata("${metadata_dict}" WeakOSXFrameworks module_weakosxframeworks) + + _juce_remove_empty_list_elements(module_weakosxframeworks) + foreach(module_framework IN LISTS module_weakosxframeworks) + _juce_link_frameworks("${module_name}" INTERFACE WEAK "${module_framework}") + endforeach() + + _juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" OSXLibs) + elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") + _juce_get_metadata("${metadata_dict}" iOSFrameworks module_iosframeworks) + + _juce_remove_empty_list_elements(module_iosframeworks) + foreach(module_framework IN LISTS module_iosframeworks) + _juce_link_frameworks("${module_name}" INTERFACE "${module_framework}") + endforeach() + + _juce_get_metadata("${metadata_dict}" WeakiOSFrameworks module_weakiosframeworks) + + _juce_remove_empty_list_elements(module_weakiosframeworks) + foreach(module_framework IN LISTS module_weakiosframeworks) + _juce_link_frameworks("${module_name}" INTERFACE WEAK "${module_framework}") + endforeach() + + _juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" iOSLibs) + elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) + _juce_get_metadata("${metadata_dict}" linuxPackages module_linuxpackages) + + if(module_linuxpackages) + _juce_create_pkgconfig_target(${module_name}_LINUX_DEPS ${module_linuxpackages}) + target_link_libraries(${module_name} INTERFACE juce::pkgconfig_${module_name}_LINUX_DEPS) + endif() + + _juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" linuxLibs) + elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") + if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) + if(module_name MATCHES "juce_gui_basics|juce_audio_processors|juce_core|juce_graphics") + target_compile_options(${module_name} INTERFACE /bigobj) + endif() + + _juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" windowsLibs) + elseif(MSYS OR MINGW) + if(module_name STREQUAL "juce_gui_basics") + target_compile_options(${module_name} INTERFACE "-Wa,-mbig-obj") + endif() + + _juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" mingwLibs) + endif() + endif() + + _juce_get_metadata("${metadata_dict}" dependencies module_dependencies) + target_link_libraries(${module_name} INTERFACE ${module_dependencies}) + + _juce_get_metadata("${metadata_dict}" searchpaths module_searchpaths) + + if(NOT module_searchpaths STREQUAL "") + foreach(module_searchpath IN LISTS module_searchpaths) + target_include_directories(${module_name} + INTERFACE "${module_path}/${module_searchpath}") + endforeach() + endif() + + _juce_add_module_staticlib_paths("${module_name}" "${module_path}") + + if(JUCE_ARG_INSTALL_PATH) + install(DIRECTORY "${module_path}" DESTINATION "${JUCE_ARG_INSTALL_PATH}") + endif() + + if(JUCE_ARG_ALIAS_NAMESPACE) + add_library(${JUCE_ARG_ALIAS_NAMESPACE}::${module_name} ALIAS ${module_name}) + endif() +endfunction() + +function(juce_add_modules) + set(one_value_args INSTALL_PATH ALIAS_NAMESPACE) + cmake_parse_arguments(JUCE_ARG "" "${one_value_args}" "" ${ARGN}) + + foreach(path IN LISTS JUCE_ARG_UNPARSED_ARGUMENTS) + juce_add_module(${path} + INSTALL_PATH "${JUCE_ARG_INSTALL_PATH}" + ALIAS_NAMESPACE "${JUCE_ARG_ALIAS_NAMESPACE}") + endforeach() +endfunction() + +# When source groups are enabled, this function sets the HEADER_FILE_ONLY property on any module +# source files that should not be built. This is called automatically by the juce_add_* functions. +function(_juce_fixup_module_source_groups) + if(JUCE_ENABLE_MODULE_SOURCE_GROUPS) + get_property(all_modules GLOBAL PROPERTY _juce_module_names) + + foreach(module_name IN LISTS all_modules) + get_target_property(path ${module_name} INTERFACE_JUCE_MODULE_PATH) + get_target_property(header_files ${module_name} INTERFACE_JUCE_MODULE_HEADERS) + get_target_property(source_files ${module_name} INTERFACE_JUCE_MODULE_SOURCES) + source_group(TREE ${path} PREFIX "JUCE Modules" FILES ${header_files} ${source_files}) + set_source_files_properties(${header_files} PROPERTIES HEADER_FILE_ONLY TRUE) + endforeach() + endif() +endfunction() diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake index a6b45504af..8a6b0d6e15 100644 --- a/extras/Build/CMake/JUCEUtils.cmake +++ b/extras/Build/CMake/JUCEUtils.cmake @@ -1,2479 +1,2479 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -# ================================================================================================== -# JUCE Target Support Helper Functions -# -# In this file, functions intended for use by end-users have the prefix `juce_`. -# Functions beginning with an underscore should be considered private and susceptible to -# change, so don't call them directly. -# -# See the readme at `docs/CMake API.md` for more information about CMake usage, -# including documentation of the public functions in this file. -# ================================================================================================== - -include_guard(GLOBAL) -cmake_minimum_required(VERSION 3.22) - -define_property(TARGET PROPERTY JUCE_COMPANY_NAME INHERITED - BRIEF_DOCS "The company name for a particular target" - FULL_DOCS "This can be found in ProjectInfo::companyName in a generated JuceHeader.h") -set_property(GLOBAL PROPERTY JUCE_COMPANY_NAME "yourcompany") - -define_property(TARGET PROPERTY JUCE_COMPANY_WEBSITE INHERITED - BRIEF_DOCS "The company website for a particular target" - FULL_DOCS "This will be placed in the Info.plist for the target") -set_property(GLOBAL PROPERTY JUCE_COMPANY_WEBSITE "") - -define_property(TARGET PROPERTY JUCE_COMPANY_EMAIL INHERITED - BRIEF_DOCS "The company email address for a particular target" - FULL_DOCS "This will be placed in the Info.plist for the target") -set_property(GLOBAL PROPERTY JUCE_COMPANY_EMAIL "") - -define_property(TARGET PROPERTY JUCE_COMPANY_COPYRIGHT INHERITED - BRIEF_DOCS "The company copyright for a particular target" - FULL_DOCS "This will be placed in the Info.plist for the target") -set_property(GLOBAL PROPERTY JUCE_COMPANY_COPYRIGHT "") - -define_property(TARGET PROPERTY JUCE_VST_COPY_DIR INHERITED - BRIEF_DOCS "Install location for VST2 plugins" - FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled") - -define_property(TARGET PROPERTY JUCE_VST3_COPY_DIR INHERITED - BRIEF_DOCS "Install location for VST3 plugins" - FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled") - -define_property(TARGET PROPERTY JUCE_AU_COPY_DIR INHERITED - BRIEF_DOCS "Install location for AU plugins" - FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled") - -define_property(TARGET PROPERTY JUCE_AAX_COPY_DIR INHERITED - BRIEF_DOCS "Install location for AAX plugins" - FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled") - -define_property(TARGET PROPERTY JUCE_UNITY_COPY_DIR INHERITED - BRIEF_DOCS "Install location for Unity plugins" - FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled") - -define_property(TARGET PROPERTY JUCE_LV2_COPY_DIR INHERITED - BRIEF_DOCS "Install location for LV2 plugins" - FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled") - -define_property(TARGET PROPERTY JUCE_COPY_PLUGIN_AFTER_BUILD INHERITED - BRIEF_DOCS "Whether or not plugins should be copied after building" - FULL_DOCS "Whether or not plugins should be copied after building") -set_property(GLOBAL PROPERTY JUCE_COPY_PLUGIN_AFTER_BUILD FALSE) - -function(_juce_available_pkgconfig_module_or_else out package alternative_package) - find_package(PkgConfig REQUIRED) - pkg_check_modules(package_to_be_found ${package} QUIET) - - if(package_to_be_found_FOUND) - set(${out} ${package} PARENT_SCOPE) - else() - set(${out} ${alternative_package} PARENT_SCOPE) - endif() -endfunction() - -if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) - _juce_create_pkgconfig_target(JUCE_CURL_LINUX_DEPS libcurl) - _juce_available_pkgconfig_module_or_else(webkit_package_name webkit2gtk-4.1 webkit2gtk-4.0) - - # All browser related libs are loaded dynamically only if they are available during runtime - _juce_create_pkgconfig_target(JUCE_BROWSER_LINUX_DEPS NOLINK ${webkit_package_name} gtk+-x11-3.0) -endif() - -# We set up default/fallback copy dirs here. If you need different copy dirs, use -# set_directory_properties or set_target_properties to adjust the values of `JUCE_*_COPY_DIR` at -# the appropriate scope. - -function(_juce_set_default_properties) - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set_property(GLOBAL PROPERTY JUCE_LV2_COPY_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/LV2") - set_property(GLOBAL PROPERTY JUCE_VST_COPY_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/VST") - set_property(GLOBAL PROPERTY JUCE_VST3_COPY_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/VST3") - set_property(GLOBAL PROPERTY JUCE_AU_COPY_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/Components") - set_property(GLOBAL PROPERTY JUCE_UNITY_COPY_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/Unity") - set_property(GLOBAL PROPERTY JUCE_AAX_COPY_DIR "/Library/Application Support/Avid/Audio/Plug-Ins") - elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set_property(GLOBAL PROPERTY JUCE_VST_COPY_DIR "$ENV{ProgramW6432}/Steinberg/Vstplugins") - set(prefix "$ENV{CommonProgramW6432}") - else() - set_property(GLOBAL PROPERTY JUCE_VST_COPY_DIR "$ENV{programfiles\(x86\)}/Steinberg/Vstplugins") - set(prefix "$ENV{CommonProgramFiles\(x86\)}") - endif() - - set_property(GLOBAL PROPERTY JUCE_VST3_COPY_DIR "${prefix}/VST3") - set_property(GLOBAL PROPERTY JUCE_AAX_COPY_DIR "${prefix}/Avid/Audio/Plug-Ins") - set_property(GLOBAL PROPERTY JUCE_LV2_COPY_DIR "$ENV{APPDATA}/LV2") - set_property(GLOBAL PROPERTY JUCE_UNITY_COPY_DIR "$ENV{APPDATA}/Unity") - elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) - set_property(GLOBAL PROPERTY JUCE_LV2_COPY_DIR "$ENV{HOME}/.lv2") - set_property(GLOBAL PROPERTY JUCE_VST_COPY_DIR "$ENV{HOME}/.vst") - set_property(GLOBAL PROPERTY JUCE_VST3_COPY_DIR "$ENV{HOME}/.vst3") - set_property(GLOBAL PROPERTY JUCE_UNITY_COPY_DIR "$ENV{HOME}/.unity") - endif() -endfunction() - -_juce_set_default_properties() - -# ================================================================================================== - -function(juce_add_bundle_resources_directory target folder) - _juce_make_absolute(folder) - - if(NOT EXISTS "${folder}") - message(FATAL_ERROR "Could not find resource folder ${folder}") - endif() - - get_filename_component(folder_parent_path "${folder}" DIRECTORY) - file(GLOB_RECURSE resources RELATIVE "${folder_parent_path}" "${folder}/*") - - foreach(file IN LISTS resources) - target_sources(${target} PRIVATE "${folder_parent_path}/${file}") - get_filename_component(resource_parent_path "${file}" DIRECTORY) - set_source_files_properties("${folder_parent_path}/${file}" PROPERTIES - HEADER_FILE_ONLY TRUE - MACOSX_PACKAGE_LOCATION "Resources/${resource_parent_path}") - endforeach() -endfunction() - -# ================================================================================================== - -function(_juce_create_linux_subprocess_helper_target) - if(TARGET juce_linux_subprocess_helper) - return() - endif() - - set(source "${JUCE_CMAKE_UTILS_DIR}/juce_LinuxSubprocessHelper.cpp") - - add_executable(juce_linux_subprocess_helper ${source}) - add_executable(juce::juce_linux_subprocess_helper ALIAS juce_linux_subprocess_helper) - target_compile_features(juce_linux_subprocess_helper PRIVATE cxx_std_17) - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) - target_link_libraries(juce_linux_subprocess_helper PRIVATE Threads::Threads ${CMAKE_DL_LIBS}) -endfunction() - -function(_juce_create_embedded_linux_subprocess_target output_target_name target) - # This library needs to be created in every directory where a target wants to link against it. - # Pre CMake 3.20 the GENERATED property is only visible in the directory of the current target, - # and even post 3.20, CMake will not know how to generate the sources outside this directory. - set(target_directory_key JUCE_EMBEDDED_LINUX_SUBPROCESS_TARGET) - get_directory_property(embedded_linux_subprocess_target ${target_directory_key}) - - if(embedded_linux_subprocess_target) - set(${output_target_name} juce::${embedded_linux_subprocess_target} PARENT_SCOPE) - return() - endif() - - set(prefix "_juce_directory_prefix") - set(embedded_linux_subprocess_target ${prefix}_embedded_linux_subprocess) - - while(TARGET ${embedded_linux_subprocess_target}) - set(embedded_linux_subprocess_target ${prefix}_${embedded_linux_subprocess_target}) - endwhile() - - _juce_create_linux_subprocess_helper_target() - - get_target_property(generated_sources_directory ${target} JUCE_GENERATED_SOURCES_DIRECTORY) - - if(generated_sources_directory) - set(juce_linux_subprocess_helper_binary_dir "${generated_sources_directory}/$/") - else() - set(juce_linux_subprocess_helper_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/juce_LinuxSubprocessHelper/$/") - endif() - - set(binary_header_file "${juce_linux_subprocess_helper_binary_dir}/juce_LinuxSubprocessHelperBinaryData.h") - set(binary_source_file "${juce_linux_subprocess_helper_binary_dir}/juce_LinuxSubprocessHelperBinaryData.cpp") - set(juceaide_input_file "${juce_linux_subprocess_helper_binary_dir}/input_file_list") - - file(GENERATE OUTPUT ${juceaide_input_file} CONTENT "$") - file(MAKE_DIRECTORY ${juce_linux_subprocess_helper_binary_dir}) - - add_custom_command( - OUTPUT - ${binary_header_file} - ${binary_source_file} - COMMAND juce::juceaide binarydata "LinuxSubprocessHelperBinaryData" "${binary_header_file}" - ${juce_linux_subprocess_helper_binary_dir} "${juceaide_input_file}" - COMMAND - ${CMAKE_COMMAND} -E rename "${juce_linux_subprocess_helper_binary_dir}/BinaryData1.cpp" "${binary_source_file}" - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - DEPENDS juce_linux_subprocess_helper - VERBATIM) - - add_library(${embedded_linux_subprocess_target} INTERFACE) - target_sources(${embedded_linux_subprocess_target} INTERFACE ${binary_source_file}) - target_include_directories(${embedded_linux_subprocess_target} INTERFACE ${juce_linux_subprocess_helper_binary_dir}) - target_compile_definitions(${embedded_linux_subprocess_target} INTERFACE JUCE_USE_EXTERNAL_TEMPORARY_SUBPROCESS=1) - add_library(juce::${embedded_linux_subprocess_target} ALIAS ${embedded_linux_subprocess_target}) - - set_directory_properties(PROPERTIES ${target_directory_key} ${embedded_linux_subprocess_target}) - set(${output_target_name} juce::${embedded_linux_subprocess_target} PARENT_SCOPE) -endfunction() - -function(juce_link_with_embedded_linux_subprocess target) - _juce_create_embedded_linux_subprocess_target(embedded_linux_subprocess_target ${target}) - target_link_libraries(${target} PRIVATE ${embedded_linux_subprocess_target}) -endfunction() - -# ================================================================================================== - -# Ideally, we'd check the preprocessor defs on the target to see whether -# JUCE_USE_CURL, JUCE_WEB_BROWSER, or JUCE_IN_APP_PURCHASES have been explicitly turned off, -# and then link libraries as appropriate. -# Unfortunately, this doesn't work, because linking a new library (curl/webkit/StoreKit) -# updates the target's compile defs, which results in a recursion/circular-dependency. -# Instead, we ask the user to explicitly request curl/webkit/StoreKit linking if they -# know they need it. Otherwise, we won't link anything. -# See the NEEDS_CURL, NEEDS_WEB_BROWSER, and NEEDS_STORE_KIT options in the CMake/readme.md. -function(_juce_link_optional_libraries target) - if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) - get_target_property(needs_curl ${target} JUCE_NEEDS_CURL) - - if(needs_curl) - target_link_libraries(${target} PRIVATE juce::pkgconfig_JUCE_CURL_LINUX_DEPS) - endif() - - get_target_property(needs_browser ${target} JUCE_NEEDS_WEB_BROWSER) - - if(needs_browser) - target_link_libraries(${target} PRIVATE juce::pkgconfig_JUCE_BROWSER_LINUX_DEPS) - - get_target_property(is_plugin ${target} JUCE_IS_PLUGIN) - - if(is_plugin) - juce_link_with_embedded_linux_subprocess(${target}) - endif() - endif() - elseif(APPLE) - get_target_property(needs_storekit ${target} JUCE_NEEDS_STORE_KIT) - - if(needs_storekit) - _juce_link_frameworks("${target}" PRIVATE StoreKit) - endif() - - get_target_property(needs_camera ${target} JUCE_CAMERA_PERMISSION_ENABLED) - - if(CMAKE_SYSTEM_NAME STREQUAL "iOS" AND needs_camera) - _juce_link_frameworks("${target}" PRIVATE ImageIO) - endif() - elseif(WIN32) - get_target_property(needs_webview2 ${target} JUCE_NEEDS_WEBVIEW2) - - if (needs_webview2) - if(NOT ("${JUCE_CMAKE_UTILS_DIR}" IN_LIST CMAKE_MODULE_PATH)) - list(APPEND CMAKE_MODULE_PATH "${JUCE_CMAKE_UTILS_DIR}") - endif() - - find_package(WebView2 REQUIRED) - target_link_libraries(${target} PRIVATE juce::juce_webview2) - endif() - endif() -endfunction() - -# ================================================================================================== - -function(_juce_get_module_definitions target filter out_var) - set(compile_defs $>) - - if(filter) - set(${out_var} $ PARENT_SCOPE) - else() - set(${out_var} ${compile_defs} PARENT_SCOPE) - endif() -endfunction() - -function(_juce_append_record output key) - string(ASCII 30 RS) - string(ASCII 31 US) - - set(prev) - - if(DEFINED "${output}") - set(prev "${${output}}") - endif() - - set(${output} "${prev}${key}${US}${ARGN}${RS}" PARENT_SCOPE) -endfunction() - -function(_juce_append_target_property output key target property) - get_target_property(prop ${target} ${property}) - - if(prop STREQUAL "prop-NOTFOUND") - set(prop) - endif() - - _juce_append_record(${output} ${key} ${prop}) - set(${output} "${${output}}" PARENT_SCOPE) -endfunction() - -# This is all info that should be known at configure time (i.e. no generator expressions here!) -# We use this info to generate plists and entitlements files, also at configure time. -function(_juce_write_configure_time_info target) - _juce_append_target_property(file_content EXECUTABLE_NAME ${target} JUCE_PRODUCT_NAME) - _juce_append_target_property(file_content VERSION ${target} JUCE_VERSION) - _juce_append_target_property(file_content BUILD_VERSION ${target} JUCE_BUILD_VERSION) - _juce_append_target_property(file_content PLIST_TO_MERGE ${target} JUCE_PLIST_TO_MERGE) - _juce_append_target_property(file_content BUNDLE_ID ${target} JUCE_BUNDLE_ID) - _juce_append_target_property(file_content XCODE_EXTRA_PLIST_ENTRIES ${target} JUCE_XCODE_EXTRA_PLIST_ENTRIES) - _juce_append_target_property(file_content MICROPHONE_PERMISSION_ENABLED ${target} JUCE_MICROPHONE_PERMISSION_ENABLED) - _juce_append_target_property(file_content MICROPHONE_PERMISSION_TEXT ${target} JUCE_MICROPHONE_PERMISSION_TEXT) - _juce_append_target_property(file_content CAMERA_PERMISSION_ENABLED ${target} JUCE_CAMERA_PERMISSION_ENABLED) - _juce_append_target_property(file_content CAMERA_PERMISSION_TEXT ${target} JUCE_CAMERA_PERMISSION_TEXT) - _juce_append_target_property(file_content BLUETOOTH_PERMISSION_ENABLED ${target} JUCE_BLUETOOTH_PERMISSION_ENABLED) - _juce_append_target_property(file_content BLUETOOTH_PERMISSION_TEXT ${target} JUCE_BLUETOOTH_PERMISSION_TEXT) - _juce_append_target_property(file_content SEND_APPLE_EVENTS_PERMISSION_ENABLED ${target} JUCE_SEND_APPLE_EVENTS_PERMISSION_ENABLED) - _juce_append_target_property(file_content SEND_APPLE_EVENTS_PERMISSION_TEXT ${target} JUCE_SEND_APPLE_EVENTS_PERMISSION_TEXT) - _juce_append_target_property(file_content SHOULD_ADD_STORYBOARD ${target} JUCE_SHOULD_ADD_STORYBOARD) - _juce_append_target_property(file_content LAUNCH_STORYBOARD_FILE ${target} JUCE_LAUNCH_STORYBOARD_FILE) - _juce_append_target_property(file_content ICON_FILE ${target} JUCE_ICON_FILE) - _juce_append_target_property(file_content PROJECT_NAME ${target} JUCE_PRODUCT_NAME) - _juce_append_target_property(file_content COMPANY_COPYRIGHT ${target} JUCE_COMPANY_COPYRIGHT) - _juce_append_target_property(file_content COMPANY_NAME ${target} JUCE_COMPANY_NAME) - _juce_append_target_property(file_content DOCUMENT_EXTENSIONS ${target} JUCE_DOCUMENT_EXTENSIONS) - _juce_append_target_property(file_content FILE_SHARING_ENABLED ${target} JUCE_FILE_SHARING_ENABLED) - _juce_append_target_property(file_content DOCUMENT_BROWSER_ENABLED ${target} JUCE_DOCUMENT_BROWSER_ENABLED) - _juce_append_target_property(file_content STATUS_BAR_HIDDEN ${target} JUCE_STATUS_BAR_HIDDEN) - _juce_append_target_property(file_content REQUIRES_FULL_SCREEN ${target} JUCE_REQUIRES_FULL_SCREEN) - _juce_append_target_property(file_content BACKGROUND_AUDIO_ENABLED ${target} JUCE_BACKGROUND_AUDIO_ENABLED) - _juce_append_target_property(file_content BACKGROUND_BLE_ENABLED ${target} JUCE_BACKGROUND_BLE_ENABLED) - _juce_append_target_property(file_content PUSH_NOTIFICATIONS_ENABLED ${target} JUCE_PUSH_NOTIFICATIONS_ENABLED) - _juce_append_target_property(file_content NETWORK_MULTICAST_ENABLED ${target} JUCE_NETWORK_MULTICAST_ENABLED) - _juce_append_target_property(file_content PLUGIN_MANUFACTURER_CODE ${target} JUCE_PLUGIN_MANUFACTURER_CODE) - _juce_append_target_property(file_content PLUGIN_CODE ${target} JUCE_PLUGIN_CODE) - _juce_append_target_property(file_content IPHONE_SCREEN_ORIENTATIONS ${target} JUCE_IPHONE_SCREEN_ORIENTATIONS) - _juce_append_target_property(file_content IPAD_SCREEN_ORIENTATIONS ${target} JUCE_IPAD_SCREEN_ORIENTATIONS) - _juce_append_target_property(file_content PLUGIN_NAME ${target} JUCE_PLUGIN_NAME) - _juce_append_target_property(file_content PLUGIN_MANUFACTURER ${target} JUCE_COMPANY_NAME) - _juce_append_target_property(file_content PLUGIN_DESCRIPTION ${target} JUCE_DESCRIPTION) - _juce_append_target_property(file_content PLUGIN_AU_EXPORT_PREFIX ${target} JUCE_AU_EXPORT_PREFIX) - _juce_append_target_property(file_content PLUGIN_AU_MAIN_TYPE ${target} JUCE_AU_MAIN_TYPE_CODE) - _juce_append_target_property(file_content IS_AU_SANDBOX_SAFE ${target} JUCE_AU_SANDBOX_SAFE) - _juce_append_target_property(file_content IS_PLUGIN_SYNTH ${target} JUCE_IS_SYNTH) - _juce_append_target_property(file_content IS_PLUGIN_ARA_EFFECT ${target} JUCE_IS_ARA_EFFECT) - _juce_append_target_property(file_content SUPPRESS_AU_PLIST_RESOURCE_USAGE ${target} JUCE_SUPPRESS_AU_PLIST_RESOURCE_USAGE) - _juce_append_target_property(file_content HARDENED_RUNTIME_ENABLED ${target} JUCE_HARDENED_RUNTIME_ENABLED) - _juce_append_target_property(file_content APP_SANDBOX_ENABLED ${target} JUCE_APP_SANDBOX_ENABLED) - _juce_append_target_property(file_content APP_SANDBOX_INHERIT ${target} JUCE_APP_SANDBOX_INHERIT) - _juce_append_target_property(file_content HARDENED_RUNTIME_OPTIONS ${target} JUCE_HARDENED_RUNTIME_OPTIONS) - _juce_append_target_property(file_content APP_SANDBOX_OPTIONS ${target} JUCE_APP_SANDBOX_OPTIONS) - _juce_append_target_property(file_content APP_SANDBOX_FILE_ACCESS_HOME_RO ${target} JUCE_APP_SANDBOX_FILE_ACCESS_HOME_RO) - _juce_append_target_property(file_content APP_SANDBOX_FILE_ACCESS_HOME_RW ${target} JUCE_APP_SANDBOX_FILE_ACCESS_HOME_RW) - _juce_append_target_property(file_content APP_SANDBOX_FILE_ACCESS_ABS_RO ${target} JUCE_APP_SANDBOX_FILE_ACCESS_ABS_RO) - _juce_append_target_property(file_content APP_SANDBOX_FILE_ACCESS_ABS_RW ${target} JUCE_APP_SANDBOX_FILE_ACCESS_ABS_RW) - _juce_append_target_property(file_content APP_SANDBOX_EXCEPTION_IOKIT ${target} JUCE_APP_SANDBOX_EXCEPTION_IOKIT) - _juce_append_target_property(file_content APP_GROUPS_ENABLED ${target} JUCE_APP_GROUPS_ENABLED) - _juce_append_target_property(file_content APP_GROUP_IDS ${target} JUCE_APP_GROUP_IDS) - _juce_append_target_property(file_content IS_PLUGIN ${target} JUCE_IS_PLUGIN) - _juce_append_target_property(file_content ICLOUD_PERMISSIONS_ENABLED ${target} JUCE_ICLOUD_PERMISSIONS_ENABLED) - _juce_append_target_property(file_content IS_AU_PLUGIN_HOST ${target} JUCE_PLUGINHOST_AU) - - if(CMAKE_SYSTEM_NAME STREQUAL "iOS") - _juce_append_record(file_content IS_IOS 1) - else() - _juce_append_record(file_content IS_IOS 0) - endif() - - get_target_property(juce_library_code ${target} JUCE_GENERATED_SOURCES_DIRECTORY) - - set(info_file "${juce_library_code}/Info.txt") - file(WRITE "${info_file}" "${file_content}") - set_target_properties(${target} PROPERTIES JUCE_INFO_FILE "${info_file}") -endfunction() - -# In this file, we put things that CMake is only able to divine at generate time, like preprocessor definitions. -# We use the target preprocessor definitions to work out which JUCE modules should go in the JuceHeader.h. -function(_juce_write_generate_time_info target) - _juce_get_module_definitions(${target} OFF module_defs) - _juce_append_record(defs MODULE_DEFINITIONS ${module_defs}) - - _juce_append_target_property(defs EXECUTABLE_NAME ${target} JUCE_PRODUCT_NAME) - _juce_append_target_property(defs PROJECT_NAME ${target} JUCE_PRODUCT_NAME) - _juce_append_target_property(defs VERSION ${target} JUCE_VERSION) - _juce_append_target_property(defs COMPANY_NAME ${target} JUCE_COMPANY_NAME) - - get_target_property(juce_library_code ${target} JUCE_GENERATED_SOURCES_DIRECTORY) - - set(defs_file "${juce_library_code}/$/Defs.txt") - file(GENERATE OUTPUT "${defs_file}" CONTENT "${defs}") - set_target_properties(${target} PROPERTIES JUCE_DEFS_FILE "${defs_file}") -endfunction() - -# ================================================================================================== - -function(juce_add_binary_data target) - set(one_value_args NAMESPACE HEADER_NAME) - set(multi_value_args SOURCES) - cmake_parse_arguments(JUCE_ARG "" "${one_value_args}" "${multi_value_args}" ${ARGN}) - - list(LENGTH JUCE_ARG_SOURCES num_binary_files) - - if(${num_binary_files} LESS 1) - message(FATAL_ERROR "juce_add_binary_data must be passed at least one file to encode") - endif() - - add_library(${target} STATIC) - - set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) - - set(juce_binary_data_folder "${CMAKE_CURRENT_BINARY_DIR}/juce_binarydata_${target}/JuceLibraryCode") - - set(binary_file_names) - - foreach(index RANGE 1 ${num_binary_files}) - list(APPEND binary_file_names "${juce_binary_data_folder}/BinaryData${index}.cpp") - endforeach() - - file(MAKE_DIRECTORY ${juce_binary_data_folder}) - - if(NOT JUCE_ARG_NAMESPACE) - set(JUCE_ARG_NAMESPACE BinaryData) - endif() - - if(NOT JUCE_ARG_HEADER_NAME) - set(JUCE_ARG_HEADER_NAME BinaryData.h) - endif() - - list(APPEND binary_file_names "${juce_binary_data_folder}/${JUCE_ARG_HEADER_NAME}") - - set(newline_delimited_input) - - foreach(name IN LISTS JUCE_ARG_SOURCES) - _juce_make_absolute(name) - set(newline_delimited_input "${newline_delimited_input}${name}\n") - endforeach() - - set(input_file_list "${juce_binary_data_folder}/input_file_list") - file(WRITE "${input_file_list}" "${newline_delimited_input}") - - add_custom_command(OUTPUT ${binary_file_names} - COMMAND juce::juceaide binarydata "${JUCE_ARG_NAMESPACE}" "${JUCE_ARG_HEADER_NAME}" - ${juce_binary_data_folder} "${input_file_list}" - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - DEPENDS "${input_file_list}" ${JUCE_ARG_SOURCES} - VERBATIM) - - target_sources(${target} PRIVATE "${binary_file_names}") - target_include_directories(${target} INTERFACE ${juce_binary_data_folder}) - target_compile_features(${target} PRIVATE cxx_std_17) - - # This fixes an issue where Xcode is unable to find binary data during archive. - if(CMAKE_GENERATOR STREQUAL "Xcode") - set_target_properties(${target} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "./") - endif() - - if(JUCE_ARG_HEADER_NAME STREQUAL "BinaryData.h") - target_compile_definitions(${target} INTERFACE JUCE_TARGET_HAS_BINARY_DATA=1) - endif() -endfunction() - -# ================================================================================================== - -function(_juce_version_code version_in out_var) - string(REGEX REPLACE "\\." ";" version_list ${version_in}) - list(LENGTH version_list num_version_components) - - set(version_major 0) - set(version_minor 0) - set(version_patch 0) - - if(num_version_components GREATER 0) - list(GET version_list 0 version_major) - endif() - - if(num_version_components GREATER 1) - list(GET version_list 1 version_minor) - endif() - - if(num_version_components GREATER 2) - list(GET version_list 2 version_patch) - endif() - - math(EXPR hex "(${version_major} << 16) + (${version_minor} << 8) + ${version_patch}" - OUTPUT_FORMAT HEXADECIMAL) - set(${out_var} "${hex}" PARENT_SCOPE) -endfunction() - -function(_juce_to_char_literal str out_var help_text) - string(LENGTH "${str}" string_length) - - if(NOT "${string_length}" EQUAL "4") - message(WARNING "The ${help_text} code must contain exactly four characters, but it was set to '${str}'") - endif() - - # Round-tripping through a file is the simplest way to convert a string to hex... - string(SUBSTRING "${str}" 0 4 four_chars) - string(RANDOM LENGTH 16 random_string) - set(scratch_file "${CMAKE_CURRENT_BINARY_DIR}/${random_string}_ascii_conversion.txt") - - file(WRITE "${scratch_file}" "${four_chars}") - file(READ "${scratch_file}" four_chars_hex HEX) - file(REMOVE "${scratch_file}") - - string(SUBSTRING "${four_chars_hex}00000000" 0 8 four_chars_hex) - set(${out_var} "${four_chars_hex}" PARENT_SCOPE) -endfunction() - -# ================================================================================================== - -function(juce_generate_juce_header target) - get_target_property(juce_library_code ${target} JUCE_GENERATED_SOURCES_DIRECTORY) - - if(NOT juce_library_code) - message(FATAL_ERROR "Target ${target} does not have a generated sources directory. Ensure it was created with a juce_add_* function") - endif() - - set(juce_header ${juce_library_code}/JuceHeader.h) - target_sources(${target} PRIVATE ${juce_header}) - - set(defs_file $>) - - set(extra_args) - - add_custom_command(OUTPUT "${juce_header}" - COMMAND juce::juceaide header "${defs_file}" "${juce_header}" ${extra_args} - DEPENDS "${defs_file}" - VERBATIM) -endfunction() - -# ================================================================================================== - -function(_juce_execute_juceaide) - if(NOT TARGET juce::juceaide) - message(FATAL_ERROR "The juceaide target does not exist") - endif() - - get_target_property(juceaide_location juce::juceaide IMPORTED_LOCATION) - - if(NOT EXISTS "${juceaide_location}") - message(FATAL_ERROR "juceaide was imported, but it doesn't exist!") - endif() - - execute_process(COMMAND "${juceaide_location}" ${ARGN} - RESULT_VARIABLE result_variable - OUTPUT_VARIABLE output - ERROR_VARIABLE output) - - if(result_variable) - message(FATAL_ERROR "Running juceaide failed:\ncommand: ${juceaide_location} ${ARGN}\noutput: ${output}") - endif() -endfunction() - -function(_juce_set_output_name target name) - if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android") - set_target_properties(${target} PROPERTIES - OUTPUT_NAME ${name} - XCODE_ATTRIBUTE_PRODUCT_NAME ${name}) - endif() -endfunction() - -function(_juce_check_icon_files_exist icon_files) - foreach(file IN LISTS icon_files) - if(NOT EXISTS "${file}") - message(FATAL_ERROR "Could not find icon file: ${file}") - endif() - endforeach() -endfunction() - -function(_juce_generate_icon source_target dest_target) - get_target_property(juce_library_code ${source_target} JUCE_GENERATED_SOURCES_DIRECTORY) - get_target_property(juce_property_icon_big ${source_target} JUCE_ICON_BIG) - get_target_property(juce_property_icon_small ${source_target} JUCE_ICON_SMALL) - - set(icon_args) - - if(juce_property_icon_big) - list(APPEND icon_args "${juce_property_icon_big}") - endif() - - if(juce_property_icon_small) - list(APPEND icon_args "${juce_property_icon_small}") - endif() - - set(generated_icon) - - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - if(NOT icon_args) - return() - endif() - - _juce_check_icon_files_exist("${icon_args}") - - set(generated_icon "${juce_library_code}/Icon.icns") - # To get compiled properly, we need the icon before the plist is generated! - _juce_execute_juceaide(macicon "${generated_icon}" ${icon_args}) - set_source_files_properties(${generated_icon} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") - if(NOT icon_args) - return() - endif() - - _juce_check_icon_files_exist("${icon_args}") - - set(generated_icon "${juce_library_code}/icon.ico") - _juce_execute_juceaide(winicon "${generated_icon}" ${icon_args}) - elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") - get_target_property(generated_icon ${source_target} JUCE_CUSTOM_XCASSETS_FOLDER) - - if(icon_args AND (NOT generated_icon)) - _juce_check_icon_files_exist("${icon_args}") - - set(out_path "${juce_library_code}/${dest_target}") - set(generated_icon "${out_path}/Images.xcassets") - - # To get compiled properly, we need iOS assets at configure time! - _juce_execute_juceaide(iosassets "${out_path}" ${icon_args}) - endif() - - if(NOT generated_icon) - return() - endif() - - set_target_properties(${dest_target} PROPERTIES - XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon") - - get_target_property(add_storyboard ${source_target} JUCE_SHOULD_ADD_STORYBOARD) - - if(NOT add_storyboard) - set_target_properties(${dest_target} PROPERTIES - XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME "LaunchImage") - endif() - endif() - - if(generated_icon) - _juce_check_icon_files_exist("${generated_icon}") - - target_sources(${dest_target} PRIVATE ${generated_icon}) - set_target_properties(${source_target} ${dest_target} PROPERTIES - JUCE_ICON_FILE "${generated_icon}" - RESOURCE "${generated_icon}") - endif() -endfunction() - -function(_juce_add_xcode_entitlements source_target dest_target) - if(NOT APPLE) - return() - endif() - - get_target_property(juce_kind_string ${dest_target} JUCE_TARGET_KIND_STRING) - get_target_property(input_info_file ${source_target} JUCE_INFO_FILE) - - get_target_property(juce_library_code ${source_target} JUCE_GENERATED_SOURCES_DIRECTORY) - set(entitlements_file "${juce_library_code}/${dest_target}.entitlements") - - _juce_execute_juceaide(entitlements "${juce_kind_string}" "${input_info_file}" "${entitlements_file}") - set_target_properties(${dest_target} PROPERTIES - XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS - "${entitlements_file}" - XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME - "$") -endfunction() - -function(_juce_configure_bundle source_target dest_target) - _juce_generate_icon(${source_target} ${dest_target}) - _juce_write_configure_time_info(${source_target}) - - if(NOT APPLE) - return() - endif() - - get_target_property(generated_icon ${source_target} JUCE_ICON_FILE) - set(icon_dependency) - - if(generated_icon) - set(icon_dependency "${generated_icon}") - endif() - - get_target_property(juce_library_code ${source_target} JUCE_GENERATED_SOURCES_DIRECTORY) - get_target_property(input_info_file ${source_target} JUCE_INFO_FILE) - - set(this_output_info_dir "${juce_library_code}/${dest_target}") - set(this_output_pkginfo "${this_output_info_dir}/PkgInfo") - set(this_output_plist "${this_output_info_dir}/Info.plist") - - get_target_property(juce_kind_string ${dest_target} JUCE_TARGET_KIND_STRING) - - _juce_execute_juceaide(plist "${juce_kind_string}" "${input_info_file}" "${this_output_plist}") - set_target_properties(${dest_target} PROPERTIES - BUNDLE TRUE - MACOSX_BUNDLE_INFO_PLIST "${this_output_plist}") - - add_custom_command(OUTPUT "${this_output_pkginfo}" - COMMAND juce::juceaide pkginfo "${juce_kind_string}" "${this_output_pkginfo}" - VERBATIM) - - set(output_folder "$") - - target_sources(${dest_target} PRIVATE "${this_output_pkginfo}") - set_source_files_properties("${this_output_pkginfo}" PROPERTIES - HEADER_FILE_ONLY TRUE - GENERATED TRUE) - add_custom_command(TARGET ${dest_target} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy "${this_output_pkginfo}" "${output_folder}" - VERBATIM) - - _juce_add_xcode_entitlements(${source_target} ${dest_target}) - - if(CMAKE_SYSTEM_NAME STREQUAL "iOS") - get_target_property(add_storyboard ${source_target} JUCE_SHOULD_ADD_STORYBOARD) - - if(add_storyboard) - get_target_property(storyboard_file ${source_target} JUCE_LAUNCH_STORYBOARD_FILE) - - if(NOT EXISTS "${storyboard_file}") - message(FATAL_ERROR "Could not find storyboard file: ${storyboard_file}") - endif() - - target_sources(${dest_target} PRIVATE "${storyboard_file}") - set_property(TARGET ${dest_target} APPEND PROPERTY RESOURCE "${storyboard_file}") - endif() - endif() - - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set_target_properties(${dest_target} PROPERTIES - XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "--timestamp") - endif() - - set_target_properties(${dest_target} PROPERTIES - XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY - "$") - - if(juce_kind_string STREQUAL "AUv3 AppExtension") - get_target_property(source_bundle_id ${source_target} JUCE_BUNDLE_ID) - - if(source_bundle_id MATCHES "\\.([^.]+)$") - set_target_properties(${dest_target} PROPERTIES - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER - "${source_bundle_id}.${CMAKE_MATCH_1}AUv3") - else() - message(FATAL_ERROR "Bundle ID should contain at least one `.`!") - endif() - else() - set_target_properties(${dest_target} PROPERTIES - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER - $) - endif() - - if(CMAKE_GENERATOR STREQUAL "Xcode") - get_target_property(product_name ${source_target} JUCE_PRODUCT_NAME) - set(skip_install NO) - set(install_path "$(LOCAL_APPS_DIR)") - - if(juce_kind_string STREQUAL "AUv3 AppExtension") - set(skip_install YES) - set(install_path "") - endif() - - set_target_properties(${dest_target} PROPERTIES - XCODE_ATTRIBUTE_INSTALL_PATH "${install_path}" - XCODE_ATTRIBUTE_SKIP_INSTALL "${skip_install}") - endif() -endfunction() - -function(_juce_add_resources_rc source_target dest_target) - if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") - return() - endif() - - if(NOT TARGET ${source_target}_rc_lib) - get_target_property(juce_library_code ${source_target} JUCE_GENERATED_SOURCES_DIRECTORY) - get_target_property(input_info_file ${source_target} JUCE_INFO_FILE) - - get_target_property(generated_icon ${source_target} JUCE_ICON_FILE) - set(dependency) - - if(generated_icon) - set(dependency DEPENDS "${generated_icon}") - endif() - - set(resource_rc_file "${juce_library_code}/${source_target}_resources.rc") - - add_custom_command(OUTPUT "${resource_rc_file}" - COMMAND juce::juceaide rcfile "${input_info_file}" "${resource_rc_file}" - ${dependency} - VERBATIM) - - add_library(${source_target}_rc_lib OBJECT ${resource_rc_file}) - - set(compile_defs $>) - set(include_dirs $>) - set(filtered $) - set(has_custom_rc_include $) - - target_include_directories(${source_target}_rc_lib - PRIVATE $<${has_custom_rc_include}:${include_dirs}>) - set_source_files_properties(${resource_rc_file} PROPERTIES - COMPILE_DEFINITIONS $<${has_custom_rc_include}:${compile_defs}>) - endif() - - target_link_libraries(${dest_target} PRIVATE ${source_target}_rc_lib) -endfunction() - -function(_juce_configure_app_bundle source_target dest_target) - set_target_properties(${dest_target} PROPERTIES - JUCE_TARGET_KIND_STRING "App" - MACOSX_BUNDLE TRUE - WIN32_EXECUTABLE TRUE) - - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(nib_path "${JUCE_CMAKE_UTILS_DIR}/RecentFilesMenuTemplate.nib") - target_sources("${dest_target}" PRIVATE "${nib_path}") - set_source_files_properties("${nib_path}" PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - endif() -endfunction() - -# ================================================================================================== - -function(_juce_create_windows_package source_target dest_target extension default_icon arch_string) - get_target_property(products_folder ${dest_target} LIBRARY_OUTPUT_DIRECTORY) - - set(product_name $) - set(output_folder "${products_folder}/${product_name}.${extension}") - - set_target_properties(${dest_target} - PROPERTIES - PDB_OUTPUT_DIRECTORY "${products_folder}" - LIBRARY_OUTPUT_DIRECTORY "${output_folder}/Contents/${arch_string}") - - get_target_property(icon_file ${source_target} JUCE_ICON_FILE) - - if(NOT icon_file) - set(icon_file "${default_icon}") - endif() - - if(icon_file) - set(desktop_ini "${output_folder}/desktop.ini") - set(plugin_ico "${output_folder}/Plugin.ico") - - file(GENERATE OUTPUT "${desktop_ini}" - CONTENT - "[.ShellClassInfo]\nIconResource=Plugin.ico,0\nIconFile=Plugin.ico\nIconIndex=0\n") - add_custom_command(TARGET ${dest_target} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy "${icon_file}" "${plugin_ico}" - COMMAND attrib +s "${desktop_ini}" - COMMAND attrib +s "${output_folder}" - DEPENDS "${icon_file}" "${desktop_ini}" - VERBATIM) - endif() -endfunction() - -# ================================================================================================== - -function(_juce_add_unity_plugin_prefix_if_necessary name out_var) - string(TOLOWER "${name}" lower) - - if(NOT lower MATCHES "^audioplugin") - set(${out_var} "audioplugin_${name}" PARENT_SCOPE) - else() - set(${out_var} "${name}" PARENT_SCOPE) - endif() -endfunction() - -function(_juce_add_unity_script_file shared_target out_var) - set(script_in "${JUCE_CMAKE_UTILS_DIR}/UnityPluginGUIScript.cs.in") - - get_target_property(plugin_name ${shared_target} JUCE_PLUGIN_NAME) - get_target_property(plugin_vendor ${shared_target} JUCE_COMPANY_NAME) - get_target_property(plugin_description ${shared_target} JUCE_DESCRIPTION) - - string(REGEX REPLACE " +" "_" plugin_class_name "${plugin_name}") - - get_target_property(juce_library_code ${shared_target} JUCE_GENERATED_SOURCES_DIRECTORY) - _juce_add_unity_plugin_prefix_if_necessary("${plugin_name}" script_prefix) - set(script_out "${juce_library_code}/${script_prefix}_UnityScript.cs") - configure_file(${script_in} ${script_out}) - set(${out_var} "${script_out}" PARENT_SCOPE) -endfunction() - -# ================================================================================================== - -function(_juce_copy_dir target from to) - # This is a shim to make CMake copy a whole directory, rather than just - # the contents of a directory - add_custom_command(TARGET ${target} POST_BUILD - COMMAND "${CMAKE_COMMAND}" - "-Dsrc=${from}" - "-Ddest=${to}" - "-P" "${JUCE_CMAKE_UTILS_DIR}/copyDir.cmake" - VERBATIM) -endfunction() - -function(_juce_set_copy_properties shared_code target from to_property) - get_target_property(destination "${shared_code}" "${to_property}") - - if(destination) - set_target_properties("${target}" PROPERTIES JUCE_PLUGIN_COPY_DIR "${destination}") - endif() - - set_target_properties("${target}" PROPERTIES JUCE_PLUGIN_ARTEFACT_FILE "${from}") -endfunction() - -function(_juce_adhoc_sign target) - if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") - return() - endif() - - get_target_property(bundle "${target}" BUNDLE) - - set(src "$") - - if(bundle) - set(src "$") - endif() - - add_custom_command(TARGET ${target} POST_BUILD - COMMAND "${CMAKE_COMMAND}" - "-Dsrc=${src}" - "-P" "${JUCE_CMAKE_UTILS_DIR}/checkBundleSigning.cmake" - VERBATIM) -endfunction() - -function(juce_enable_copy_plugin_step shared_code_target) - get_target_property(step_added ${shared_code_target} _JUCE_PLUGIN_COPY_STEP_ADDED) - - if(step_added) - message(WARNING "Plugin copy step requested multiple times for ${shared_code_target}") - return() - endif() - - set_target_properties(${shared_code_target} PROPERTIES _JUCE_PLUGIN_COPY_STEP_ADDED TRUE) - - get_target_property(active_targets "${shared_code_target}" JUCE_ACTIVE_PLUGIN_TARGETS) - - foreach(target IN LISTS active_targets) - get_target_property(target_kind "${target}" JUCE_TARGET_KIND_STRING) - - if(target_kind STREQUAL "App") - continue() - endif() - - _juce_adhoc_sign("${target}") - - get_target_property(source "${target}" JUCE_PLUGIN_ARTEFACT_FILE) - - if(NOT source) - continue() - endif() - - get_target_property(dest "${target}" JUCE_PLUGIN_COPY_DIR) - - if(dest) - _juce_copy_dir("${target}" "${source}" "$") - else() - message(WARNING "Target '${target}' requested copy but no destination is set") - endif() - endforeach() -endfunction() - -# ================================================================================================== - -function(_juce_add_lv2_manifest_helper_target) - if(TARGET juce_lv2_helper OR (CMAKE_SYSTEM_NAME STREQUAL "iOS") OR (CMAKE_SYSTEM_NAME STREQUAL "Android")) - return() - endif() - - get_target_property(module_path juce::juce_audio_plugin_client INTERFACE_JUCE_MODULE_PATH) - set(source "${module_path}/juce_audio_plugin_client/LV2/juce_LV2ManifestHelper.cpp") - add_executable(juce_lv2_helper "${source}") - add_executable(juce::juce_lv2_helper ALIAS juce_lv2_helper) - target_compile_features(juce_lv2_helper PRIVATE cxx_std_17) - set_target_properties(juce_lv2_helper PROPERTIES BUILD_WITH_INSTALL_RPATH ON) - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) - target_link_libraries(juce_lv2_helper PRIVATE Threads::Threads ${CMAKE_DL_LIBS}) -endfunction() - -# ================================================================================================== - -function(_juce_add_vst3_manifest_helper_target) - if(TARGET juce_vst3_helper - OR (CMAKE_SYSTEM_NAME STREQUAL "iOS") - OR (CMAKE_SYSTEM_NAME STREQUAL "Android") - OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) - return() - endif() - - get_target_property(module_path juce::juce_audio_processors INTERFACE_JUCE_MODULE_PATH) - set(vst3_dir "${module_path}/juce_audio_processors/format_types/VST3_SDK") - - set(extension "cpp") - - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(extension "mm") - endif() - - set(source "${module_path}/juce_audio_plugin_client/VST3/juce_VST3ManifestHelper.${extension}") - - add_executable(juce_vst3_helper "${source}") - add_executable(juce::juce_vst3_helper ALIAS juce_vst3_helper) - - target_include_directories(juce_vst3_helper PRIVATE "${vst3_dir}" "${module_path}") - - add_library(juce_interface_definitions INTERFACE) - _juce_add_standard_defs(juce_interface_definitions) - target_link_libraries(juce_vst3_helper PRIVATE juce_interface_definitions) - target_compile_features(juce_vst3_helper PRIVATE cxx_std_17) - - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - _juce_link_frameworks(juce_vst3_helper PRIVATE Cocoa) - target_compile_options(juce_vst3_helper PRIVATE -fobjc-arc) - endif() - - if(MSYS OR MINGW) - target_link_options(juce_vst3_helper PRIVATE -municode) - endif() - - set_target_properties(juce_vst3_helper PROPERTIES BUILD_WITH_INSTALL_RPATH ON) - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) - target_link_libraries(juce_vst3_helper PRIVATE Threads::Threads ${CMAKE_DL_LIBS} juce_recommended_config_flags) - - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9) - target_link_libraries(juce_vst3_helper PRIVATE stdc++fs) - endif() -endfunction() - -function(juce_enable_vst3_manifest_step shared_code_target) - get_target_property(manifest_step_added ${shared_code_target} _JUCE_VST3_MANIFEST_STEP_ADDED) - - if(manifest_step_added) - message(WARNING "VST3 manifest generation has already been enabled for target ${shared_code_target}. " - "You may need to set VST3_AUTO_MANIFEST FALSE in juce_add_plugin, and/or check that you're " - "not calling juce_enable_vst3_manifest_step multiple times.") - return() - endif() - - get_target_property(copy_step_added ${shared_code_target} _JUCE_PLUGIN_COPY_STEP_ADDED) - - if(copy_step_added) - message(FATAL_ERROR "VST3 manifest generation would run after plugin copy step, so it has been disabled. " - "If you're manually calling juce_enable_vst3_manifest_step, then you probably need to call " - "juce_enable_copy_plugin_step too.") - endif() - - if((MSYS OR MINGW) AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9) - message(WARNING "VST3 manifest generation is disabled for ${shared_code_target} because the compiler is not supported.") - return() - endif() - - if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND NOT JUCE_WINDOWS_HELPERS_CAN_RUN) - message(WARNING "VST3 manifest generation is disabled for ${shared_code_target} because a " - "${JUCE_TARGET_ARCHITECTURE} manifest helper cannot run on a host system processor detected to be " - "${CMAKE_HOST_SYSTEM_PROCESSOR}.") - return() - endif() - - set(target_name ${shared_code_target}_VST3) - get_target_property(product ${target_name} JUCE_PLUGIN_ARTEFACT_FILE) - - if(NOT product) - message(FATAL_ERROR "Property JUCE_PLUGIN_ARTEFACT_FILE not set for ${target_name}") - endif() - - # Add a target for the helper tool - _juce_add_vst3_manifest_helper_target() - - get_target_property(target_version_string ${shared_code_target} JUCE_VERSION) - - set(ouput_path "${product}/Contents/Resources/moduleinfo.json") - - # Use the helper tool to write out the moduleinfo.json - add_custom_command(TARGET ${target_name} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo "creating ${ouput_path}" - COMMAND ${CMAKE_COMMAND} -E make_directory "${product}/Contents/Resources" - COMMAND juce_vst3_helper - -create - -version "${target_version_string}" - -path "${product}" - -output "${ouput_path}" - VERBATIM) - - set_target_properties(${shared_code_target} PROPERTIES _JUCE_VST3_MANIFEST_STEP_ADDED TRUE) -endfunction() - -# ================================================================================================== - -function(_juce_disable_system_includes target) - if(CMAKE_VERSION VERSION_GREATER "3.25") - set_target_properties("${target}" PROPERTIES SYSTEM FALSE) - elseif(CMAKE_VERSION VERSION_GREATER "3.23") - set_target_properties("${target}" PROPERTIES IMPORTED_NO_SYSTEM TRUE) - endif() -endfunction() - -# ================================================================================================== - -function(juce_set_aax_sdk_path path) - if(TARGET juce_aax_sdk) - message(FATAL_ERROR "juce_set_aax_sdk_path should only be called once") - endif() - - _juce_make_absolute(path) - - if((NOT EXISTS "${path}") - OR (NOT EXISTS "${path}/Interfaces") - OR (NOT EXISTS "${path}/Interfaces/ACF")) - message(FATAL_ERROR "Could not find AAX SDK at the specified path: ${path}") - endif() - - if((CMAKE_SYSTEM_NAME STREQUAL "Darwin") OR (CMAKE_SYSTEM_NAME STREQUAL "Windows")) - add_library(juce_aax_sdk INTERFACE IMPORTED GLOBAL) - else() - return() - endif() - - _juce_disable_system_includes(juce_aax_sdk) - target_include_directories(juce_aax_sdk INTERFACE - "${path}" - "${path}/Interfaces" - "${path}/Interfaces/ACF") - set_target_properties(juce_aax_sdk PROPERTIES INTERFACE_JUCE_AAX_DEFAULT_ICON "${path}/Utilities/PlugIn.ico") -endfunction() - -function(_juce_init_bundled_aax_sdk) - if(TARGET juce_aax_sdk) - return() - endif() - - get_target_property(module_path juce::juce_audio_plugin_client INTERFACE_JUCE_MODULE_PATH) - juce_set_aax_sdk_path("${module_path}/juce_audio_plugin_client/AAX/SDK") -endfunction() - -# ================================================================================================== - -function(_juce_set_plugin_target_properties shared_code_target kind) - set(target_name ${shared_code_target}_${kind}) - - set_target_properties(${target_name} PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "$>/${kind}" - LIBRARY_OUTPUT_DIRECTORY "$>/${kind}" - RUNTIME_OUTPUT_DIRECTORY "$>/${kind}") - - get_target_property(products_folder ${target_name} LIBRARY_OUTPUT_DIRECTORY) - set(product_name $) - - if(kind STREQUAL "Standalone") - get_target_property(is_bundle "${target_name}" BUNDLE) - - if(is_bundle) - set_target_properties("${target_name}" PROPERTIES JUCE_PLUGIN_ARTEFACT_FILE "$") - else() - set_target_properties("${target_name}" PROPERTIES JUCE_PLUGIN_ARTEFACT_FILE "$") - endif() - elseif(kind STREQUAL "VST3") - set_target_properties(${target_name} PROPERTIES - BUNDLE_EXTENSION vst3 - PREFIX "" - SUFFIX .vst3 - BUNDLE TRUE - XCODE_ATTRIBUTE_WRAPPER_EXTENSION vst3 - XCODE_ATTRIBUTE_LIBRARY_STYLE Bundle - XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES) - - if(CMAKE_SYSTEM_NAME STREQUAL "Windows") - if(JUCE_TARGET_ARCHITECTURE STREQUAL "x86_64") - set(windows_arch "x86_64") - elseif(JUCE_TARGET_ARCHITECTURE STREQUAL "i386") - set(windows_arch "x86") - elseif(JUCE_TARGET_ARCHITECTURE STREQUAL "arm64ec") - set(windows_arch "arm64ec") - elseif(JUCE_TARGET_ARCHITECTURE STREQUAL "aarch64") - set(windows_arch "arm64") - else() - message(FATAL_ERROR "Unsupported target architecture for VST3: ${JUCE_TARGET_ARCHITECTURE}") - endif() - - _juce_create_windows_package(${shared_code_target} ${target_name} vst3 "" "${windows_arch}-win") - endif() - - set(output_path "${products_folder}/${product_name}.vst3") - - if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) - set_target_properties(${target_name} PROPERTIES - SUFFIX .so - LIBRARY_OUTPUT_DIRECTORY "${output_path}/Contents/${JUCE_TARGET_ARCHITECTURE}-linux") - endif() - - _juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_VST3_COPY_DIR) - - _juce_adhoc_sign(${target_name}) - - get_target_property(vst3_auto_manifest ${shared_code_target} JUCE_VST3_AUTO_MANIFEST) - - add_custom_command(TARGET ${target_name} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo "removing moduleinfo.json" - COMMAND ${CMAKE_COMMAND} -E remove -f - "${output_path}/Contents/moduleinfo.json" - "${output_path}/Contents/Resources/moduleinfo.json") - - if(vst3_auto_manifest) - juce_enable_vst3_manifest_step(${shared_code_target}) - endif() - elseif(kind STREQUAL "VST") - set_target_properties(${target_name} PROPERTIES - BUNDLE_EXTENSION vst - BUNDLE TRUE - XCODE_ATTRIBUTE_WRAPPER_EXTENSION vst - XCODE_ATTRIBUTE_LIBRARY_STYLE Bundle - XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES) - - set(output_path "$") - - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(output_path "$") - endif() - - _juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_VST_COPY_DIR) - elseif(kind STREQUAL "AU") - set_target_properties(${target_name} PROPERTIES - BUNDLE_EXTENSION component - XCODE_ATTRIBUTE_WRAPPER_EXTENSION component - BUNDLE TRUE - XCODE_ATTRIBUTE_LIBRARY_STYLE Bundle - XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES) - - set(output_path "$") - _juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_AU_COPY_DIR) - elseif(kind STREQUAL "AUv3") - set_target_properties(${target_name} PROPERTIES - XCODE_PRODUCT_TYPE "com.apple.product-type.app-extension" - BUNDLE_EXTENSION appex - XCODE_ATTRIBUTE_WRAPPER_EXTENSION appex - XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES) - elseif(kind STREQUAL "AAX") - set_target_properties(${target_name} PROPERTIES - BUNDLE_EXTENSION aaxplugin - PREFIX "" - SUFFIX .aaxplugin - XCODE_ATTRIBUTE_WRAPPER_EXTENSION aaxplugin - BUNDLE TRUE - XCODE_ATTRIBUTE_LIBRARY_STYLE Bundle - XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES) - - _juce_init_bundled_aax_sdk() - get_target_property(default_icon juce_aax_sdk INTERFACE_JUCE_AAX_DEFAULT_ICON) - - if(CMAKE_SYSTEM_NAME STREQUAL "Windows") - if(JUCE_TARGET_ARCHITECTURE STREQUAL "x86_64") - set(windows_arch "x64") - elseif(JUCE_TARGET_ARCHITECTURE STREQUAL "i386") - set(windows_arch "Win32") - else() - message(FATAL_ERROR "Unsupported target architecture for AAX: ${JUCE_TARGET_ARCHITECTURE}") - endif() - - _juce_create_windows_package(${shared_code_target} ${target_name} aaxplugin "${default_icon}" "${windows_arch}") - endif() - - set(output_path "${products_folder}/${product_name}.aaxplugin") - _juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_AAX_COPY_DIR) - elseif(kind STREQUAL "Unity") - set_target_properties(${target_name} PROPERTIES - BUNDLE_EXTENSION bundle - XCODE_ATTRIBUTE_WRAPPER_EXTENSION bundle - BUNDLE TRUE - XCODE_ATTRIBUTE_LIBRARY_STYLE Bundle - XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES) - - _juce_add_unity_script_file(${shared_code_target} script_file) - target_sources(${target_name} PRIVATE "${script_file}") - set_source_files_properties("${script_file}" PROPERTIES - GENERATED TRUE - MACOSX_PACKAGE_LOCATION Resources) - - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(output_path "$") - _juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_UNITY_COPY_DIR) - else() - # On windows and linux, the gui script needs to be copied next to the unity output - add_custom_command(TARGET ${target_name} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy "${script_file}" "${products_folder}" - DEPENDS "${script_file}" - VERBATIM) - - _juce_set_copy_properties(${shared_code_target} - ${target_name} - "$" - JUCE_UNITY_COPY_DIR) - _juce_set_copy_properties(${shared_code_target} - ${target_name} - "${script_file}" - JUCE_UNITY_COPY_DIR) - endif() - elseif(kind STREQUAL "LV2") - if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND NOT JUCE_WINDOWS_HELPERS_CAN_RUN) - message(FATAL_ERROR "You cannot build a ${JUCE_TARGET_ARCHITECTURE} LV2 plug-in on a host " - "system processor detected to be ${CMAKE_HOST_SYSTEM_PROCESSOR}.") - endif() - - set_target_properties(${target_name} PROPERTIES BUNDLE FALSE) - - get_target_property(JUCE_LV2URI "${shared_code_target}" JUCE_LV2URI) - - if(NOT JUCE_LV2URI MATCHES "https?://.*|urn:.*") - message(WARNING - "LV2URI should be well-formed with an 'http' or 'urn' prefix. " - "Check the LV2URI argument to juce_add_plugin.") - endif() - - set(source_header "${JUCE_CMAKE_UTILS_DIR}/JuceLV2Defines.h.in") - get_target_property(juce_library_code "${shared_code_target}" JUCE_GENERATED_SOURCES_DIRECTORY) - configure_file("${source_header}" "${juce_library_code}/JuceLV2Defines.h") - - set(output_path "${products_folder}/${product_name}.lv2") - set_target_properties(${target_name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${output_path}") - - _juce_adhoc_sign(${target_name}) - - _juce_add_lv2_manifest_helper_target() - - add_custom_command(TARGET ${target_name} POST_BUILD - COMMAND juce_lv2_helper "$" - VERBATIM) - - _juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_LV2_COPY_DIR) - endif() -endfunction() - -# Place plugin wrapper targets alongside the shared code target in IDEs -function(_juce_set_plugin_folder_property shared_target wrapper_target) - get_target_property(folder_to_use "${shared_target}" FOLDER) - - if(folder_to_use STREQUAL "folder_to_use-NOTFOUND") - set_target_properties("${shared_target}" PROPERTIES FOLDER "${shared_target}") - elseif(NOT folder_to_use MATCHES ".*${shared_target}$") - set_target_properties("${shared_target}" PROPERTIES FOLDER "${folder_to_use}/${shared_target}") - endif() - - get_target_property(folder_to_use "${shared_target}" FOLDER) - set_target_properties("${wrapper_target}" PROPERTIES FOLDER "${folder_to_use}") -endfunction() - -# Convert the cmake plugin kind ids to strings understood by ProjectType::Target::typeFromName -function(_juce_get_plugin_kind_name kind out_var) - if(kind STREQUAL "AU") - set(${out_var} "AU" PARENT_SCOPE) - elseif(kind STREQUAL "AUv3") - set(${out_var} "AUv3 AppExtension" PARENT_SCOPE) - elseif(kind STREQUAL "AAX") - set(${out_var} "AAX" PARENT_SCOPE) - elseif(kind STREQUAL "LV2") - set(${out_var} "LV2" PARENT_SCOPE) - elseif(kind STREQUAL "Standalone") - set(${out_var} "Standalone Plugin" PARENT_SCOPE) - elseif(kind STREQUAL "Unity") - set(${out_var} "Unity Plugin" PARENT_SCOPE) - elseif(kind STREQUAL "VST") - set(${out_var} "VST" PARENT_SCOPE) - elseif(kind STREQUAL "VST3") - set(${out_var} "VST3" PARENT_SCOPE) - endif() -endfunction() - -function(_juce_link_plugin_wrapper shared_code_target kind) - set(target_name ${shared_code_target}_${kind}) - - if(CMAKE_SYSTEM_NAME STREQUAL "Android") - add_library(${target_name} SHARED) - elseif((kind STREQUAL "Standalone") OR (kind STREQUAL "AUv3")) - add_executable(${target_name} WIN32 MACOSX_BUNDLE) - else() - add_library(${target_name} MODULE) - endif() - - if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) - target_link_options(${target_name} PRIVATE "-Wl,--no-undefined") - endif() - - # We re-export the shared code's private include dirs, because the wrapper targets need to - # see the module headers. We don't just link publicly, because that would introduce - # conflicting macro definitions. - target_include_directories(${target_name} PRIVATE - $) - - target_link_libraries(${target_name} PRIVATE - ${shared_code_target} - juce::juce_audio_plugin_client_${kind}) - - _juce_set_output_name(${target_name} $) - - _juce_set_plugin_folder_property("${shared_code_target}" "${target_name}") - - _juce_get_plugin_kind_name(${kind} juce_kind_string) - set_target_properties(${target_name} PROPERTIES - XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME NO - XCODE_ATTRIBUTE_COMBINE_HIDPI_IMAGES YES - POSITION_INDEPENDENT_CODE TRUE - VISIBILITY_INLINES_HIDDEN TRUE - C_VISIBILITY_PRESET hidden - CXX_VISIBILITY_PRESET hidden - JUCE_TARGET_KIND_STRING "${juce_kind_string}") - - # Under the Xcode generator, POST_BUILD commands (including the plugin copy step) run before - # signing, but M1 macs will only load signed binaries. Setting "adhoc_codesign" forces the - # linker to sign bundles, so that they can be loaded even if they are copied before the "real" - # signing step. See issue 21854 on the CMake Gitlab repo. - if("${CMAKE_GENERATOR};${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Xcode;Darwin;arm64") - target_link_options(${target_name} PRIVATE LINKER:-adhoc_codesign) - endif() - - add_dependencies(${shared_code_target}_All ${target_name}) - - if(NOT kind STREQUAL "LV2") - _juce_configure_bundle(${shared_code_target} ${target_name}) - else() - _juce_write_configure_time_info(${shared_code_target}) - endif() - - _juce_set_plugin_target_properties(${shared_code_target} ${kind}) - _juce_add_resources_rc(${shared_code_target} ${target_name}) -endfunction() - -# ================================================================================================== - -function(_juce_get_vst3_category_string target out_var) - get_target_property(vst3_categories ${target} JUCE_VST3_CATEGORIES) - - if((NOT Fx IN_LIST vst3_categories) AND (NOT Instrument IN_LIST vst3_categories)) - get_target_property(is_synth ${target} JUCE_IS_SYNTH) - - if(is_synth) - set(first_type Instrument) - else() - set(first_type Fx) - endif() - - list(INSERT vst3_categories 0 ${first_type}) - else() - if(Instrument IN_LIST vst3_categories) - list(REMOVE_ITEM vst3_categories Instrument) - list(INSERT vst3_categories 0 Instrument) - endif() - - if(Fx IN_LIST vst3_categories) - list(REMOVE_ITEM vst3_categories Fx) - list(INSERT vst3_categories 0 Fx) - endif() - endif() - - string(REGEX REPLACE ";" "|" result "${vst3_categories}") - set(${out_var} ${result} PARENT_SCOPE) -endfunction() - -function(_juce_configure_plugin_targets target) - _juce_set_output_name(${target} $_SharedCode) - - target_link_libraries(${target} PRIVATE juce::juce_audio_plugin_client) - - get_target_property(enabled_formats ${target} JUCE_FORMATS) - - set(active_formats) - _juce_get_platform_plugin_kinds(plugin_kinds) - - foreach(kind IN LISTS plugin_kinds) - if(kind IN_LIST enabled_formats) - list(APPEND active_formats "${kind}") - endif() - endforeach() - - if((VST IN_LIST active_formats) AND (NOT TARGET juce_vst2_sdk)) - message(FATAL_ERROR "Use juce_set_vst2_sdk_path to set up the VST sdk before adding VST targets") - endif() - - _juce_add_standard_defs(${target}) - _juce_add_plugin_definitions(${target} PRIVATE ${active_formats}) - - # The plugin wrappers need to know what other modules are available, especially - # juce_audio_utils and juce_gui_basics. We achieve this by searching for - # JUCE_MODULE_AVAILABLE_ private compile definitions, and reexporting them in - # the interface compile definitions. - _juce_get_module_definitions(${target} ON enabled_modules) - target_compile_definitions(${target} INTERFACE ${enabled_modules}) - - target_compile_definitions(${target} PRIVATE JUCE_SHARED_CODE=1) - - get_target_property(project_version_string ${target} JUCE_VERSION) - _juce_version_code(${project_version_string} project_version_hex) - - get_target_property(project_manufacturer_code ${target} JUCE_PLUGIN_MANUFACTURER_CODE) - get_target_property(project_plugin_code ${target} JUCE_PLUGIN_CODE) - - get_target_property(use_legacy_compatibility_plugin_code ${target} JUCE_USE_LEGACY_COMPATIBILITY_PLUGIN_CODE) - - if(use_legacy_compatibility_plugin_code) - set(project_manufacturer_code "proj") - endif() - - _juce_to_char_literal(${project_manufacturer_code} project_manufacturer_code "plugin manufacturer") - _juce_to_char_literal(${project_plugin_code} project_plugin_code "plugin") - - _juce_get_vst3_category_string(${target} vst3_category_string) - - target_compile_definitions(${target} PUBLIC - JUCE_STANDALONE_APPLICATION=JucePlugin_Build_Standalone - JucePlugin_IsSynth=$> - JucePlugin_ManufacturerCode=0x${project_manufacturer_code} - JucePlugin_Manufacturer="$" - JucePlugin_ManufacturerWebsite="$" - JucePlugin_ManufacturerEmail="$" - JucePlugin_PluginCode=0x${project_plugin_code} - JucePlugin_ProducesMidiOutput=$> - JucePlugin_IsMidiEffect=$> - JucePlugin_WantsMidiInput=$> - JucePlugin_EditorRequiresKeyboardFocus=$> - JucePlugin_Name="$" - JucePlugin_Desc="$" - JucePlugin_Version=${project_version_string} - JucePlugin_VersionString="${project_version_string}" - JucePlugin_VersionCode=${project_version_hex} - JucePlugin_VSTUniqueID=JucePlugin_PluginCode - JucePlugin_VSTCategory=$ - JucePlugin_Vst3Category="${vst3_category_string}" - JucePlugin_AUMainType=$ - JucePlugin_AUSubType=JucePlugin_PluginCode - JucePlugin_AUExportPrefix=$ - JucePlugin_AUExportPrefixQuoted="$" - JucePlugin_AUManufacturerCode=JucePlugin_ManufacturerCode - JucePlugin_CFBundleIdentifier=$ - JucePlugin_AAXIdentifier=$ - JucePlugin_AAXManufacturerCode=JucePlugin_ManufacturerCode - JucePlugin_AAXProductId=JucePlugin_PluginCode - JucePlugin_AAXCategory=$ - JucePlugin_AAXDisableBypass=$> - JucePlugin_AAXDisableMultiMono=$> - JucePlugin_VSTNumMidiInputs=$ - JucePlugin_VSTNumMidiOutputs=$ - JucePlugin_Enable_ARA=$> - JucePlugin_ARAFactoryID=$ - JucePlugin_ARADocumentArchiveID=$ - JucePlugin_ARACompatibleArchiveIDs=$ - JucePlugin_ARAContentTypes=$ - JucePlugin_ARATransformationFlags=$) - - set_target_properties(${target} PROPERTIES - POSITION_INDEPENDENT_CODE TRUE - INTERFACE_POSITION_INDEPENDENT_CODE TRUE - VISIBILITY_INLINES_HIDDEN TRUE - C_VISIBILITY_PRESET hidden - CXX_VISIBILITY_PRESET hidden) - - # A convenience target for building all plugin variations at once - add_custom_target(${target}_All) - _juce_set_plugin_folder_property("${target}" "${target}_All") - - foreach(kind IN LISTS active_formats) - _juce_link_plugin_wrapper(${target} ${kind}) - - if(TARGET ${target}_${kind}) - list(APPEND active_plugin_targets ${target}_${kind}) - endif() - endforeach() - - set_target_properties(${target} PROPERTIES JUCE_ACTIVE_PLUGIN_TARGETS "${active_plugin_targets}") - - if(TARGET ${target}_Standalone) - _juce_configure_app_bundle(${target} ${target}_Standalone) - endif() - - if(TARGET ${target}_AAX) - _juce_init_bundled_aax_sdk() - target_link_libraries(${target}_AAX PRIVATE juce_aax_sdk) - endif() - - if((TARGET ${target}_AUv3) AND (TARGET ${target}_Standalone)) - add_dependencies(${target}_Standalone ${target}_AUv3) - set_target_properties(${target}_Standalone PROPERTIES - XCODE_EMBED_APP_EXTENSIONS ${target}_AUv3) - endif() - - get_target_property(wants_copy "${target}" JUCE_COPY_PLUGIN_AFTER_BUILD) - - if(wants_copy) - juce_enable_copy_plugin_step("${target}") - endif() -endfunction() - -# ================================================================================================== - -# Only sets result if the categories list contains valid entries -function(_juce_aax_categories_to_int categories_list result) - set(aax_category_strings - None - EQ - Dynamics - PitchShift - Reverb - Delay - Modulation - Harmonic - NoiseReduction - Dither - SoundField - HWGenerators - SWGenerators - WrappedPlugin - Effect - placeholder # These placeholders are because there's a gap between Effect - placeholder # and MIDIEffect in the definition of AAX_EPlugInCategory. - MIDIEffect) - - unset(aax_category_int) - - foreach(category_string IN LISTS categories_list) - string(REGEX REPLACE "^AAX_[eE]PlugInCategory_" "" category_string "${category_string}") - list(FIND aax_category_strings ${category_string} aax_index) - - if(aax_index GREATER_EQUAL 0) - if(aax_index EQUAL 0) - set(aax_category_bit 0) - else() - set(aax_category_bit "1 << (${aax_index} - 1)") - endif() - - if(NOT DEFINED aax_category_int) - set(aax_category_int 0) - endif() - - math(EXPR aax_category_int "${aax_category_int} | (${aax_category_bit})") - else() - message(WARNING "Unrecognised AAX category: '${category_string}'. See the `CMake API.md` entry for `AAX_CATEGORY` for valid values.") - endif() - endforeach() - - if(DEFINED aax_category_int) - set(${result} "${aax_category_int}" PARENT_SCOPE) - endif() -endfunction() - -# ================================================================================================== - -function(_juce_set_generic_property_if_not_set target property) - list(LENGTH ARGN num_extra_args) - - if(num_extra_args EQUAL 0) - return() - endif() - - set(existing_property) - get_target_property(existing_property ${target} ${property}) - - if(existing_property STREQUAL "existing_property-NOTFOUND") - set_target_properties(${target} PROPERTIES ${property} "${ARGN}") - endif() -endfunction() - -function(_juce_set_property_if_not_set target property) - _juce_set_generic_property_if_not_set(${target} JUCE_${property} ${ARGN}) -endfunction() - -function(_juce_make_valid_4cc out_var) - string(RANDOM LENGTH 1 ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ" head) - string(RANDOM LENGTH 3 ALPHABET "abcdefghijklmnopqrstuvwxyz" tail) - set(${out_var} "${head}${tail}" PARENT_SCOPE) -endfunction() - -# This function adds some default properties that plugin targets expect to be -# set, in order to generate the correct compile definitions. -function(_juce_set_fallback_properties target) - _juce_set_property_if_not_set(${target} PRODUCT_NAME ${target}) - - get_target_property(output_name ${target} JUCE_PRODUCT_NAME) - _juce_set_property_if_not_set(${target} DESCRIPTION "${output_name}") - _juce_set_property_if_not_set(${target} PLUGIN_NAME "${output_name}") - - get_target_property(real_company_name ${target} JUCE_COMPANY_NAME) - _juce_set_property_if_not_set(${target} BUNDLE_ID "com.${real_company_name}.${target}") - - get_target_property(applied_bundle_id ${target} JUCE_BUNDLE_ID) - - if("${applied_bundle_id}" MATCHES ".* .*") - message(WARNING "Target ${target} has JUCE_BUNDLE_ID '${applied_bundle_id}', which contains spaces. Use the BUNDLE_ID option to specify a valid ID.") - endif() - - _juce_set_property_if_not_set(${target} VERSION ${PROJECT_VERSION}) - - get_target_property(final_version ${target} JUCE_VERSION) - - if(NOT final_version) - message(FATAL_ERROR "Target ${target} must have its VERSION argument set, or must be part of a project with a PROJECT_VERSION") - endif() - - _juce_set_property_if_not_set(${target} BUILD_VERSION "${final_version}") - - get_target_property(custom_xcassets ${target} JUCE_CUSTOM_XCASSETS_FOLDER) - get_target_property(custom_storyboard ${target} JUCE_LAUNCH_STORYBOARD_FILE) - - set(needs_storyboard TRUE) - - if((NOT custom_storyboard) AND custom_xcassets AND (EXISTS "${custom_xcassets}/LaunchImage.launchimage")) - set(needs_storyboard FALSE) - endif() - - set_target_properties(${target} PROPERTIES JUCE_SHOULD_ADD_STORYBOARD ${needs_storyboard}) - - _juce_set_property_if_not_set(${target} IPHONE_SCREEN_ORIENTATIONS - UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight) - - _juce_set_property_if_not_set(${target} IPAD_SCREEN_ORIENTATIONS - UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight) - - _juce_set_property_if_not_set(${target} - LAUNCH_STORYBOARD_FILE "${JUCE_CMAKE_UTILS_DIR}/LaunchScreen.storyboard") - - _juce_set_property_if_not_set(${target} PLUGIN_MANUFACTURER_CODE "Manu") - - # The plugin code will change on each run, unless you specify one manually! - _juce_make_valid_4cc(random_code) - _juce_set_property_if_not_set(${target} PLUGIN_CODE ${random_code}) - - _juce_set_property_if_not_set(${target} IS_SYNTH FALSE) - _juce_set_property_if_not_set(${target} NEEDS_MIDI_INPUT FALSE) - _juce_set_property_if_not_set(${target} NEEDS_MIDI_OUTPUT FALSE) - _juce_set_property_if_not_set(${target} IS_MIDI_EFFECT FALSE) - _juce_set_property_if_not_set(${target} EDITOR_WANTS_KEYBOARD_FOCUS FALSE) - _juce_set_property_if_not_set(${target} DISABLE_AAX_BYPASS FALSE) - _juce_set_property_if_not_set(${target} DISABLE_AAX_MULTI_MONO FALSE) - - _juce_set_property_if_not_set(${target} PLUGINHOST_AU FALSE) - - get_target_property(bundle_id ${target} JUCE_BUNDLE_ID) - _juce_set_property_if_not_set(${target} AAX_IDENTIFIER ${bundle_id}) - - _juce_set_property_if_not_set(${target} VST_NUM_MIDI_INS 16) - _juce_set_property_if_not_set(${target} VST_NUM_MIDI_OUTS 16) - - _juce_set_property_if_not_set(${target} AU_SANDBOX_SAFE FALSE) - - _juce_set_property_if_not_set(${target} SUPPRESS_AU_PLIST_RESOURCE_USAGE FALSE) - - _juce_set_property_if_not_set(${target} HARDENED_RUNTIME_ENABLED FALSE) - _juce_set_property_if_not_set(${target} APP_SANDBOX_ENABLED FALSE) - _juce_set_property_if_not_set(${target} APP_SANDBOX_INHERIT FALSE) - - _juce_set_property_if_not_set(${target} VST3_AUTO_MANIFEST TRUE) - - get_target_property(is_synth ${target} JUCE_IS_SYNTH) - - # VST3_CATEGORIES - if(is_synth) - _juce_set_property_if_not_set(${target} VST3_CATEGORIES Instrument Synth) - else() - _juce_set_property_if_not_set(${target} VST3_CATEGORIES Fx) - endif() - - # VST2_CATEGORY - if(is_synth) - _juce_set_property_if_not_set(${target} VST2_CATEGORY kPlugCategSynth) - else() - _juce_set_property_if_not_set(${target} VST2_CATEGORY kPlugCategEffect) - endif() - - get_target_property(is_midi_effect ${target} JUCE_IS_MIDI_EFFECT) - get_target_property(needs_midi_input ${target} JUCE_NEEDS_MIDI_INPUT) - - # AU MAIN TYPE - if(is_midi_effect) - _juce_set_property_if_not_set(${target} AU_MAIN_TYPE kAudioUnitType_MIDIProcessor) - elseif(is_synth) - _juce_set_property_if_not_set(${target} AU_MAIN_TYPE kAudioUnitType_MusicDevice) - elseif(needs_midi_input) - _juce_set_property_if_not_set(${target} AU_MAIN_TYPE kAudioUnitType_MusicEffect) - else() - _juce_set_property_if_not_set(${target} AU_MAIN_TYPE kAudioUnitType_Effect) - endif() - - _juce_set_property_if_not_set(${target} TARGETED_DEVICE_FAMILY "1,2") - - set(au_category_codes - 'aufx' - 'aufc' - 'augn' - 'aumi' - 'aumx' - 'aumu' - 'aumf' - 'auol' - 'auou' - 'aupn') - - set(au_category_strings - kAudioUnitType_Effect - kAudioUnitType_FormatConverter - kAudioUnitType_Generator - kAudioUnitType_MIDIProcessor - kAudioUnitType_Mixer - kAudioUnitType_MusicDevice - kAudioUnitType_MusicEffect - kAudioUnitType_OfflineEffect - kAudioUnitType_Output - kAudioUnitType_Panner) - - # AU export prefix - string(MAKE_C_IDENTIFIER ${output_name} au_prefix) - set(au_prefix "${au_prefix}AU") - _juce_set_property_if_not_set(${target} AU_EXPORT_PREFIX ${au_prefix}) - - # Find appropriate AU category code - get_target_property(actual_au_category ${target} JUCE_AU_MAIN_TYPE) - list(FIND au_category_strings ${actual_au_category} au_index) - - if(au_index GREATER_EQUAL 0) - list(GET au_category_codes ${au_index} au_code_representation) - set_target_properties(${target} PROPERTIES JUCE_AU_MAIN_TYPE_CODE ${au_code_representation}) - endif() - - # AAX category - - if(is_midi_effect) - set(default_aax_category AAX_ePlugInCategory_MIDIEffect) - elseif(is_synth) - set(default_aax_category AAX_ePlugInCategory_SWGenerators) - else() - set(default_aax_category AAX_ePlugInCategory_None) - endif() - - _juce_set_property_if_not_set(${target} AAX_CATEGORY ${default_aax_category}) - - get_target_property(actual_aax_category ${target} JUCE_AAX_CATEGORY) - _juce_aax_categories_to_int("${actual_aax_category}" aax_category_int) - - if(DEFINED aax_category_int) - set_target_properties(${target} PROPERTIES JUCE_AAX_CATEGORY ${aax_category_int}) - endif() - - # Ensure this matches the Projucer implementation - get_target_property(company_website ${target} JUCE_COMPANY_WEBSITE) - get_target_property(plugin_name ${target} JUCE_PLUGIN_NAME) - string(MAKE_C_IDENTIFIER "${plugin_name}" plugin_name_sanitised) - _juce_set_property_if_not_set(${target} LV2URI "${company_website}/plugins/${plugin_name_sanitised}") - - # ARA configuration - # Analysis types - set(ara_analysis_type_strings - kARAContentTypeNotes - kARAContentTypeTempoEntries - kARAContentTypeBarSignatures - kARAContentTypeStaticTuning - kARAContentTypeKeySignatures - kARAContentTypeSheetChords) - - get_target_property(actual_ara_analysis_types ${target} JUCE_ARA_ANALYSIS_TYPES) - - set(ara_analysis_types_int "") - - foreach(category_string IN LISTS actual_ara_analysis_types) - list(FIND ara_analysis_type_strings ${category_string} ara_index) - - if(ara_index GREATER_EQUAL 0) - set(ara_analysis_types_bit "1 << ${ara_index}") - - if(ara_analysis_types_int STREQUAL "") - set(ara_analysis_types_int 0) - endif() - - math(EXPR ara_analysis_types_int "${ara_analysis_types_int} | (${ara_analysis_types_bit})") - endif() - endforeach() - - if(NOT ara_analysis_types_int STREQUAL "") - set_target_properties(${target} PROPERTIES JUCE_ARA_ANALYSIS_TYPES ${ara_analysis_types_int}) - endif() - - _juce_set_property_if_not_set(${target} ARA_ANALYSIS_TYPES 0) - - # Transformation flags - set(ara_transformation_flags_strings - kARAPlaybackTransformationNoChanges - kARAPlaybackTransformationTimestretch - kARAPlaybackTransformationTimestretchReflectingTempo - kARAPlaybackTransformationContentBasedFadeAtTail - kARAPlaybackTransformationContentBasedFadeAtHead) - - set(default_ara_transformation_flags kARAPlaybackTransformationNoChanges) - - _juce_set_property_if_not_set(${target} ARA_TRANSFORMATION_FLAGS ${default_ara_transformation_flags}) - - get_target_property(actual_ara_transformation_flags ${target} JUCE_ARA_TRANSFORMATION_FLAGS) - - set(ara_transformation_flags_int "") - - foreach(transformation_string IN LISTS actual_ara_transformation_flags) - list(FIND ara_transformation_flags_strings ${transformation_string} ara_transformation_index) - - if(ara_transformation_index GREATER_EQUAL 0) - if(ara_transformation_index EQUAL 0) - set(ara_transformation_bit 0) - else() - set(ara_transformation_bit "1 << (${ara_transformation_index} - 1)") - endif() - - if(ara_transformation_flags_int STREQUAL "") - set(ara_transformation_flags_int 0) - endif() - - math(EXPR ara_transformation_flags_int "${ara_transformation_flags_int} | (${ara_transformation_bit})") - endif() - endforeach() - - if(NOT ara_transformation_flags_int STREQUAL "") - set_target_properties(${target} PROPERTIES JUCE_ARA_TRANSFORMATION_FLAGS ${ara_transformation_flags_int}) - endif() - - _juce_set_property_if_not_set(${target} IS_ARA_EFFECT FALSE) - get_target_property(final_bundle_id ${target} JUCE_BUNDLE_ID) - _juce_set_property_if_not_set(${target} ARA_FACTORY_ID "\"${final_bundle_id}.arafactory.${final_version}\"") - _juce_set_property_if_not_set(${target} ARA_DOCUMENT_ARCHIVE_ID "\"${final_bundle_id}.aradocumentarchive.1\"") - _juce_set_property_if_not_set(${target} ARA_COMPATIBLE_ARCHIVE_IDS "\"\"") -endfunction() - -# ================================================================================================== - -function(_juce_initialise_target target) - set(one_value_args - VERSION - BUILD_VERSION - PRODUCT_NAME - PLIST_TO_MERGE - BUNDLE_ID - MICROPHONE_PERMISSION_ENABLED - MICROPHONE_PERMISSION_TEXT - CAMERA_PERMISSION_ENABLED - CAMERA_PERMISSION_TEXT - SEND_APPLE_EVENTS_PERMISSION_ENABLED - SEND_APPLE_EVENTS_PERMISSION_TEXT - BLUETOOTH_PERMISSION_ENABLED - BLUETOOTH_PERMISSION_TEXT - FILE_SHARING_ENABLED # iOS only - DOCUMENT_BROWSER_ENABLED # iOS only - LAUNCH_STORYBOARD_FILE # iOS only - APP_GROUPS_ENABLED # iOS only - ICLOUD_PERMISSIONS_ENABLED # iOS only - STATUS_BAR_HIDDEN # iOS only - BACKGROUND_AUDIO_ENABLED # iOS only - BACKGROUND_BLE_ENABLED # iOS only - CUSTOM_XCASSETS_FOLDER # iOS only - TARGETED_DEVICE_FAMILY # iOS only - REQUIRES_FULL_SCREEN # iOS only - ICON_BIG - ICON_SMALL - COMPANY_COPYRIGHT - COMPANY_NAME - COMPANY_WEBSITE - COMPANY_EMAIL - NEEDS_CURL # Set this true if you want to link curl on Linux - NEEDS_WEB_BROWSER # Set this true if you want to link webkit on Linux - NEEDS_WEBVIEW2 # Set this true if you want to link WebView2 statically on Windows - NEEDS_STORE_KIT # Set this true if you want in-app-purchases on Mac - PUSH_NOTIFICATIONS_ENABLED - NETWORK_MULTICAST_ENABLED - HARDENED_RUNTIME_ENABLED - APP_SANDBOX_ENABLED - APP_SANDBOX_INHERIT - VST3_AUTO_MANIFEST - - PLUGIN_NAME - PLUGIN_MANUFACTURER_CODE - PLUGIN_CODE - DESCRIPTION - IS_SYNTH - NEEDS_MIDI_INPUT - NEEDS_MIDI_OUTPUT - IS_MIDI_EFFECT - EDITOR_WANTS_KEYBOARD_FOCUS - DISABLE_AAX_BYPASS - DISABLE_AAX_MULTI_MONO - AAX_IDENTIFIER - VST_NUM_MIDI_INS - VST_NUM_MIDI_OUTS - VST2_CATEGORY - AU_MAIN_TYPE - AU_EXPORT_PREFIX - AU_SANDBOX_SAFE - SUPPRESS_AU_PLIST_RESOURCE_USAGE - PLUGINHOST_AU # Set this true if you want to host AU plugins - USE_LEGACY_COMPATIBILITY_PLUGIN_CODE - LV2URI - IS_ARA_EFFECT - ARA_FACTORY_ID - ARA_DOCUMENT_ARCHIVE_ID - - VST_COPY_DIR - VST3_COPY_DIR - AAX_COPY_DIR - AU_COPY_DIR - UNITY_COPY_DIR - COPY_PLUGIN_AFTER_BUILD) - - set(multi_value_args - FORMATS - VST3_CATEGORIES - HARDENED_RUNTIME_OPTIONS - APP_SANDBOX_OPTIONS - APP_SANDBOX_FILE_ACCESS_HOME_RO - APP_SANDBOX_FILE_ACCESS_HOME_RW - APP_SANDBOX_FILE_ACCESS_ABS_RO - APP_SANDBOX_FILE_ACCESS_ABS_RW - APP_SANDBOX_EXCEPTION_IOKIT - DOCUMENT_EXTENSIONS - AAX_CATEGORY - IPHONE_SCREEN_ORIENTATIONS # iOS only - IPAD_SCREEN_ORIENTATIONS # iOS only - APP_GROUP_IDS # iOS only - ARA_COMPATIBLE_ARCHIVE_IDS - ARA_ANALYSIS_TYPES - ARA_TRANSFORMATION_FLAGS) - - cmake_parse_arguments(JUCE_ARG "" "${one_value_args}" "${multi_value_args}" ${ARGN}) - - set(base_folder "${CMAKE_CURRENT_BINARY_DIR}/${target}_artefacts") - set(products_folder "${base_folder}/$") - set(juce_library_code "${base_folder}/JuceLibraryCode") - - set_target_properties(${target} PROPERTIES JUCE_GENERATED_SOURCES_DIRECTORY "${juce_library_code}") - - set_target_properties(${target} PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${products_folder}" - LIBRARY_OUTPUT_DIRECTORY "${products_folder}" - RUNTIME_OUTPUT_DIRECTORY "${products_folder}") - - if(JUCE_ARG_ICON_BIG) - _juce_make_absolute_and_check(JUCE_ARG_ICON_BIG) - endif() - - if(JUCE_ARG_ICON_SMALL) - _juce_make_absolute_and_check(JUCE_ARG_ICON_SMALL) - endif() - - set(inherited_properties - COMPANY_NAME - COMPANY_WEBSITE - COMPANY_EMAIL - COMPANY_COPYRIGHT - VST_COPY_DIR - VST3_COPY_DIR - AU_COPY_DIR - AAX_COPY_DIR - UNITY_COPY_DIR - COPY_PLUGIN_AFTER_BUILD) - - # Overwrite any properties that might be inherited - foreach(prop_string IN LISTS inherited_properties) - if(NOT ${JUCE_ARG_${prop_string}} STREQUAL "") - set_target_properties(${target} PROPERTIES JUCE_${prop_string} "${JUCE_ARG_${prop_string}}") - endif() - endforeach() - - # Add each of the function arguments as target properties, so that it's easier to - # extract them in other functions - foreach(arg_string IN LISTS one_value_args multi_value_args) - _juce_set_property_if_not_set(${target} ${arg_string} "${JUCE_ARG_${arg_string}}") - endforeach() - - _juce_set_fallback_properties(${target}) - - target_include_directories(${target} PRIVATE - $) - target_link_libraries(${target} PUBLIC $<$:juce_vst2_sdk>) - - get_target_property(is_pluginhost_au ${target} JUCE_PLUGINHOST_AU) - - if(is_pluginhost_au) - target_compile_definitions(${target} PUBLIC JUCE_PLUGINHOST_AU=1) - - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS") - _juce_link_frameworks("${target}" PRIVATE CoreAudioKit) - endif() - - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - _juce_link_frameworks("${target}" PRIVATE AudioUnit) - endif() - endif() - - _juce_write_generate_time_info(${target}) - _juce_link_optional_libraries(${target}) - _juce_fixup_module_source_groups() -endfunction() - -# ================================================================================================== - -function(juce_add_console_app target) - # The _NO_RESOURCERC option is private, and is only intended for use when building juceaide. - # We can't add a resources.rc to juceaide because we need juceaide to generate the resources.rc! - cmake_parse_arguments(JUCE_ARG "_NO_RESOURCERC" "" "" ${ARGN}) - - add_executable(${target}) - target_compile_definitions(${target} PRIVATE JUCE_STANDALONE_APPLICATION=1) - - if(CMAKE_SYSTEM_NAME STREQUAL "Windows") - target_compile_definitions(${target} PRIVATE _CONSOLE=1) - endif() - - # When building for iOS, these properties will be read in order to populate - # a plist for the app. We probably don't care whether these values are sane; - # if we wanted to run on iOS, we'd use juce_gui_app instead. - # We clear these explicitly to avoid warnings when configuring with - # --warn-uninitialized - set_target_properties(${target} PROPERTIES - MACOSX_BUNDLE_BUNDLE_NAME "" - MACOSX_BUNDLE_BUNDLE_VERSION "" - MACOSX_BUNDLE_COPYRIGHT "" - MACOSX_BUNDLE_GUI_IDENTIFIER "" - MACOSX_BUNDLE_ICON_FILE "" - MACOSX_BUNDLE_INFO_STRING "" - MACOSX_BUNDLE_LONG_VERSION_STRING "" - MACOSX_BUNDLE_SHORT_VERSION_STRING "") - - _juce_initialise_target(${target} ${ARGN}) - - if(NOT JUCE_ARG__NO_RESOURCERC) - set_target_properties(${target} PROPERTIES JUCE_TARGET_KIND_STRING "ConsoleApp") - _juce_write_configure_time_info(${target}) - _juce_add_resources_rc(${target} ${target}) - _juce_add_xcode_entitlements(${target} ${target}) - endif() -endfunction() - -function(juce_add_gui_app target) - if(CMAKE_SYSTEM_NAME STREQUAL "Android") - add_library(${target} SHARED) - else() - add_executable(${target}) - endif() - - target_compile_definitions(${target} PRIVATE JUCE_STANDALONE_APPLICATION=1) - _juce_initialise_target(${target} ${ARGN}) - _juce_set_output_name(${target} $) - set_target_properties(${target} PROPERTIES JUCE_TARGET_KIND_STRING "App") - _juce_configure_bundle(${target} ${target}) - _juce_configure_app_bundle(${target} ${target}) - _juce_add_resources_rc(${target} ${target}) -endfunction() - -function(juce_add_plugin target) - add_library(${target} STATIC) - set_target_properties(${target} PROPERTIES JUCE_IS_PLUGIN TRUE) - _juce_initialise_target(${target} ${ARGN}) - _juce_configure_plugin_targets(${target}) -endfunction() - -# ================================================================================================== - -function(_juce_target_args_from_plugin_characteristics out_var) - set(pairs - "pluginIsSynth\;IS_SYNTH" - "pluginWantsMidiIn\;NEEDS_MIDI_INPUT" - "pluginProducesMidiOut\;NEEDS_MIDI_OUTPUT" - "pluginIsMidiEffectPlugin\;IS_MIDI_EFFECT" - "pluginEditorRequiresKeys\;EDITOR_WANTS_KEYBOARD_FOCUS") - - set(result) - - foreach(pair IN LISTS pairs) - list(GET pair 0 old_key) - - if("${old_key}" IN_LIST ARGN) - list(GET pair 1 new_key) - list(APPEND result ${new_key} TRUE) - endif() - endforeach() - - set(${out_var} ${result} PARENT_SCOPE) -endfunction() - -# ================================================================================================== - -function(_juce_get_pip_targets pip out_var) - set(test_targets "${pip}") - - _juce_get_all_plugin_kinds(plugin_kinds) - - foreach(plugin_kind IN LISTS plugin_kinds) - list(APPEND test_targets "${JUCE_PIP_NAME}_${plugin_kind}") - endforeach() - - set(${out_var} ${test_targets} PARENT_SCOPE) -endfunction() - -function(juce_add_pip header) - _juce_make_absolute(header) - - _juce_extract_metadata_block(JUCE_PIP_METADATA "${header}" metadata_dict) - - _juce_get_metadata("${metadata_dict}" name JUCE_PIP_NAME) - - if(NOT JUCE_PIP_NAME) - message(FATAL_ERROR "Error in '${header}': PIP headers must declare a `name` field") - endif() - - string(MAKE_C_IDENTIFIER "${JUCE_PIP_NAME}" pip_name_sanitised) - - if(NOT JUCE_PIP_NAME STREQUAL pip_name_sanitised) - message(FATAL_ERROR "Error in '${header}': PIP `name` value '${JUCE_PIP_NAME}' must be a valid C identifier") - endif() - - if(TARGET "${JUCE_PIP_NAME}") - # We already added a target with this name, let's try using the filename instead - get_filename_component(JUCE_PIP_NAME "${header}" NAME_WE) - endif() - - if(TARGET "${JUCE_PIP_NAME}") - message(FATAL_ERROR "Error in '${header}': Could not create a unique target name for PIP ${header}") - endif() - - _juce_get_metadata("${metadata_dict}" type pip_kind) - - if(NOT pip_kind) - message(FATAL_ERROR "Error in '${header}': PIP headers must declare a `type` field") - endif() - - _juce_get_metadata("${metadata_dict}" pluginCharacteristics pip_charateristics) - - _juce_target_args_from_plugin_characteristics(extra_target_args ${pip_charateristics}) - - list(APPEND extra_target_args - NEEDS_CURL TRUE - NEEDS_WEB_BROWSER TRUE) - - _juce_get_metadata("${metadata_dict}" moduleFlags pip_moduleflags) - - if("JUCE_IN_APP_PURCHASES=1" IN_LIST pip_moduleflags) - list(APPEND extra_target_args - BUNDLE_ID "com.rmsl.juceInAppPurchaseSample" - NEEDS_STORE_KIT TRUE) - endif() - - if("JUCE_PLUGINHOST_AU=1" IN_LIST pip_moduleflags) - list(APPEND extra_target_args PLUGINHOST_AU TRUE) - endif() - - if("JUCE_USE_WIN_WEBVIEW2_WITH_STATIC_LINKING=1" IN_LIST pip_moduleflags) - list(APPEND extra_target_args NEEDS_WEBVIEW2 TRUE) - endif() - - if(pip_kind STREQUAL "AudioProcessor") - _juce_get_metadata("${metadata_dict}" documentControllerClass JUCE_PIP_DOCUMENTCONTROLLER_CLASS) - - if(JUCE_PIP_DOCUMENTCONTROLLER_CLASS) - if(NOT TARGET juce_ara_sdk) - message(WARNING - "${header} specifies a documentControllerClass, but the ARA SDK could not be located. " - "Use juce_set_ara_sdk_path to specify the ARA SDK location. " - "This PIP will not be configured.") - endif() - - set(source_main "${JUCE_CMAKE_UTILS_DIR}/PIPAudioProcessorWithARA.cpp.in") - - juce_add_plugin(${JUCE_PIP_NAME} - FORMATS AU VST3 - IS_ARA_EFFECT TRUE - ${extra_target_args}) - else() - set(source_main "${JUCE_CMAKE_UTILS_DIR}/PIPAudioProcessor.cpp.in") - - set(formats AAX AU AUv3 LV2 Standalone Unity VST3) - - # We add VST2 targets too, if the user has set up those SDKs - if(TARGET juce_vst2_sdk) - list(APPEND formats VST) - endif() - - if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND NOT JUCE_WINDOWS_HELPERS_CAN_RUN) - list(REMOVE_ITEM formats LV2) - endif() - - # Standalone plugins might want to access the mic - list(APPEND extra_target_args MICROPHONE_PERMISSION_ENABLED TRUE) - - juce_add_plugin(${JUCE_PIP_NAME} - FORMATS ${formats} - ${extra_target_args}) - endif() - elseif(pip_kind STREQUAL "Component") - set(source_main "${JUCE_CMAKE_UTILS_DIR}/PIPComponent.cpp.in") - juce_add_gui_app(${JUCE_PIP_NAME} ${extra_target_args}) - elseif(pip_kind STREQUAL "Console") - set(source_main "${JUCE_CMAKE_UTILS_DIR}/PIPConsole.cpp.in") - juce_add_console_app(${JUCE_PIP_NAME} ${extra_target_args}) - else() - message(FATAL_ERROR "Error in '${header}': PIP kind must be either AudioProcessor, Component, or Console") - endif() - - if(NOT ARGV1 STREQUAL "") - set("${ARGV1}" "${JUCE_PIP_NAME}" PARENT_SCOPE) - endif() - - # Generate Main.cpp - _juce_get_metadata("${metadata_dict}" mainClass JUCE_PIP_MAIN_CLASS) - get_target_property(juce_library_code ${JUCE_PIP_NAME} JUCE_GENERATED_SOURCES_DIRECTORY) - set(pip_main "${juce_library_code}/Main.cpp") - - set(JUCE_PIP_HEADER "${header}") - configure_file(${source_main} ${pip_main}) - target_sources(${JUCE_PIP_NAME} PRIVATE ${pip_main}) - - _juce_get_metadata("${metadata_dict}" dependencies pip_dependencies) - - juce_generate_juce_header(${JUCE_PIP_NAME}) - - foreach(module IN LISTS pip_dependencies) - if(module STREQUAL "") - continue() - endif() - - set(discovered_module) - - if(TARGET "${module}") - set(discovered_module "${module}") - else() - message(FATAL_ERROR "Error in '${header}': No such module: ${module}") - endif() - - target_link_libraries(${JUCE_PIP_NAME} PRIVATE ${discovered_module}) - endforeach() - - target_compile_definitions(${JUCE_PIP_NAME} - PRIVATE ${pip_moduleflags} - PUBLIC - JUCE_VST3_CAN_REPLACE_VST2=0) - - _juce_get_pip_targets(${JUCE_PIP_NAME} pip_targets) - - # This keeps the PIPs slightly better organised in the JUCE megaproject - if((DEFINED JUCE_SOURCE_DIR) AND (header MATCHES "^${JUCE_SOURCE_DIR}")) - file(RELATIVE_PATH folder "${JUCE_SOURCE_DIR}" "${header}") - get_filename_component(folder_parent "${folder}" DIRECTORY) - - foreach(target_name IN ITEMS ${pip_targets} ${JUCE_PIP_NAME}_All) - if(TARGET "${target_name}") - set_target_properties("${target_name}" PROPERTIES - FOLDER "${folder_parent}/${JUCE_PIP_NAME}") - endif() - endforeach() - endif() - - # We're building JUCE itself - if(DEFINED JUCE_SOURCE_DIR) - # PIPs need to know about the resources folder - target_compile_definitions(${JUCE_PIP_NAME} PRIVATE - PIP_JUCE_EXAMPLES_DIRECTORY_STRING="${JUCE_SOURCE_DIR}/examples") - - get_filename_component(pip_parent_path "${header}" DIRECTORY) - target_include_directories(${JUCE_PIP_NAME} PRIVATE "${pip_parent_path}") - - if((CMAKE_SYSTEM_NAME STREQUAL "iOS") AND (header MATCHES "^${JUCE_SOURCE_DIR}")) - foreach(target_name IN LISTS pip_targets) - if(TARGET "${target_name}") - juce_add_bundle_resources_directory("${target_name}" "${JUCE_SOURCE_DIR}/examples/Assets") - endif() - endforeach() - endif() - - if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) - target_compile_options(${JUCE_PIP_NAME} PRIVATE /bigobj) - endif() - endif() -endfunction() - -# ================================================================================================== - -function(juce_set_vst2_sdk_path path) - if(TARGET juce_vst2_sdk) - message(FATAL_ERROR "juce_set_vst2_sdk_path should only be called once") - endif() - - _juce_make_absolute(path) - - if(NOT EXISTS "${path}") - message(FATAL_ERROR "Could not find VST2 SDK at the specified path: ${path}") - endif() - - add_library(juce_vst2_sdk INTERFACE IMPORTED GLOBAL) - - _juce_disable_system_includes(juce_vst2_sdk) - # This is a bit of a hack, but we really need the VST2 paths to always follow the VST3 paths. - target_include_directories(juce_vst2_sdk INTERFACE - $ - "${path}") -endfunction() - -function(juce_set_vst3_sdk_path path) - if(TARGET juce_vst3_sdk) - message(FATAL_ERROR "juce_set_vst3_sdk_path should only be called once") - endif() - - _juce_make_absolute(path) - - if(NOT EXISTS "${path}") - message(FATAL_ERROR "Could not find VST3 SDK at the specified path: ${path}") - endif() - - add_library(juce_vst3_sdk INTERFACE IMPORTED GLOBAL) - - _juce_disable_system_includes(juce_vst3_sdk) - target_include_directories(juce_vst3_sdk INTERFACE "${path}") -endfunction() - -function(juce_set_ara_sdk_path path) - if(TARGET juce_ara_sdk) - message(FATAL_ERROR "juce_set_ara_sdk_path should only be called once") - endif() - - _juce_make_absolute(path) - - if(NOT EXISTS "${path}") - message(FATAL_ERROR "Could not find ARA SDK at the specified path: ${path}") - endif() - - add_library(juce_ara_sdk INTERFACE IMPORTED GLOBAL) - - _juce_disable_system_includes(juce_ara_sdk) - target_include_directories(juce_ara_sdk INTERFACE "${path}") -endfunction() - -# ================================================================================================== - -function(juce_disable_default_flags) - set(langs C CXX) - set(modes DEBUG RELEASE RELWITHDEBINFO MINSIZEREL) - - foreach(lang IN LISTS langs) - foreach(mode IN LISTS modes) - list(FILTER CMAKE_${lang}_FLAGS_${mode} INCLUDE REGEX "[/-]M[TD]d?") - set(CMAKE_${lang}_FLAGS_${mode} "${CMAKE_${lang}_FLAGS_${mode}}" PARENT_SCOPE) - endforeach() - endforeach() -endfunction() +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +# ================================================================================================== +# JUCE Target Support Helper Functions +# +# In this file, functions intended for use by end-users have the prefix `juce_`. +# Functions beginning with an underscore should be considered private and susceptible to +# change, so don't call them directly. +# +# See the readme at `docs/CMake API.md` for more information about CMake usage, +# including documentation of the public functions in this file. +# ================================================================================================== + +include_guard(GLOBAL) +cmake_minimum_required(VERSION 3.22) + +define_property(TARGET PROPERTY JUCE_COMPANY_NAME INHERITED + BRIEF_DOCS "The company name for a particular target" + FULL_DOCS "This can be found in ProjectInfo::companyName in a generated JuceHeader.h") +set_property(GLOBAL PROPERTY JUCE_COMPANY_NAME "yourcompany") + +define_property(TARGET PROPERTY JUCE_COMPANY_WEBSITE INHERITED + BRIEF_DOCS "The company website for a particular target" + FULL_DOCS "This will be placed in the Info.plist for the target") +set_property(GLOBAL PROPERTY JUCE_COMPANY_WEBSITE "") + +define_property(TARGET PROPERTY JUCE_COMPANY_EMAIL INHERITED + BRIEF_DOCS "The company email address for a particular target" + FULL_DOCS "This will be placed in the Info.plist for the target") +set_property(GLOBAL PROPERTY JUCE_COMPANY_EMAIL "") + +define_property(TARGET PROPERTY JUCE_COMPANY_COPYRIGHT INHERITED + BRIEF_DOCS "The company copyright for a particular target" + FULL_DOCS "This will be placed in the Info.plist for the target") +set_property(GLOBAL PROPERTY JUCE_COMPANY_COPYRIGHT "") + +define_property(TARGET PROPERTY JUCE_VST_COPY_DIR INHERITED + BRIEF_DOCS "Install location for VST2 plugins" + FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled") + +define_property(TARGET PROPERTY JUCE_VST3_COPY_DIR INHERITED + BRIEF_DOCS "Install location for VST3 plugins" + FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled") + +define_property(TARGET PROPERTY JUCE_AU_COPY_DIR INHERITED + BRIEF_DOCS "Install location for AU plugins" + FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled") + +define_property(TARGET PROPERTY JUCE_AAX_COPY_DIR INHERITED + BRIEF_DOCS "Install location for AAX plugins" + FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled") + +define_property(TARGET PROPERTY JUCE_UNITY_COPY_DIR INHERITED + BRIEF_DOCS "Install location for Unity plugins" + FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled") + +define_property(TARGET PROPERTY JUCE_LV2_COPY_DIR INHERITED + BRIEF_DOCS "Install location for LV2 plugins" + FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled") + +define_property(TARGET PROPERTY JUCE_COPY_PLUGIN_AFTER_BUILD INHERITED + BRIEF_DOCS "Whether or not plugins should be copied after building" + FULL_DOCS "Whether or not plugins should be copied after building") +set_property(GLOBAL PROPERTY JUCE_COPY_PLUGIN_AFTER_BUILD FALSE) + +function(_juce_available_pkgconfig_module_or_else out package alternative_package) + find_package(PkgConfig REQUIRED) + pkg_check_modules(package_to_be_found ${package} QUIET) + + if(package_to_be_found_FOUND) + set(${out} ${package} PARENT_SCOPE) + else() + set(${out} ${alternative_package} PARENT_SCOPE) + endif() +endfunction() + +if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) + _juce_create_pkgconfig_target(JUCE_CURL_LINUX_DEPS libcurl) + _juce_available_pkgconfig_module_or_else(webkit_package_name webkit2gtk-4.1 webkit2gtk-4.0) + + # All browser related libs are loaded dynamically only if they are available during runtime + _juce_create_pkgconfig_target(JUCE_BROWSER_LINUX_DEPS NOLINK ${webkit_package_name} gtk+-x11-3.0) +endif() + +# We set up default/fallback copy dirs here. If you need different copy dirs, use +# set_directory_properties or set_target_properties to adjust the values of `JUCE_*_COPY_DIR` at +# the appropriate scope. + +function(_juce_set_default_properties) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set_property(GLOBAL PROPERTY JUCE_LV2_COPY_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/LV2") + set_property(GLOBAL PROPERTY JUCE_VST_COPY_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/VST") + set_property(GLOBAL PROPERTY JUCE_VST3_COPY_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/VST3") + set_property(GLOBAL PROPERTY JUCE_AU_COPY_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/Components") + set_property(GLOBAL PROPERTY JUCE_UNITY_COPY_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/Unity") + set_property(GLOBAL PROPERTY JUCE_AAX_COPY_DIR "/Library/Application Support/Avid/Audio/Plug-Ins") + elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set_property(GLOBAL PROPERTY JUCE_VST_COPY_DIR "$ENV{ProgramW6432}/Steinberg/Vstplugins") + set(prefix "$ENV{CommonProgramW6432}") + else() + set_property(GLOBAL PROPERTY JUCE_VST_COPY_DIR "$ENV{programfiles\(x86\)}/Steinberg/Vstplugins") + set(prefix "$ENV{CommonProgramFiles\(x86\)}") + endif() + + set_property(GLOBAL PROPERTY JUCE_VST3_COPY_DIR "${prefix}/VST3") + set_property(GLOBAL PROPERTY JUCE_AAX_COPY_DIR "${prefix}/Avid/Audio/Plug-Ins") + set_property(GLOBAL PROPERTY JUCE_LV2_COPY_DIR "$ENV{APPDATA}/LV2") + set_property(GLOBAL PROPERTY JUCE_UNITY_COPY_DIR "$ENV{APPDATA}/Unity") + elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) + set_property(GLOBAL PROPERTY JUCE_LV2_COPY_DIR "$ENV{HOME}/.lv2") + set_property(GLOBAL PROPERTY JUCE_VST_COPY_DIR "$ENV{HOME}/.vst") + set_property(GLOBAL PROPERTY JUCE_VST3_COPY_DIR "$ENV{HOME}/.vst3") + set_property(GLOBAL PROPERTY JUCE_UNITY_COPY_DIR "$ENV{HOME}/.unity") + endif() +endfunction() + +_juce_set_default_properties() + +# ================================================================================================== + +function(juce_add_bundle_resources_directory target folder) + _juce_make_absolute(folder) + + if(NOT EXISTS "${folder}") + message(FATAL_ERROR "Could not find resource folder ${folder}") + endif() + + get_filename_component(folder_parent_path "${folder}" DIRECTORY) + file(GLOB_RECURSE resources RELATIVE "${folder_parent_path}" "${folder}/*") + + foreach(file IN LISTS resources) + target_sources(${target} PRIVATE "${folder_parent_path}/${file}") + get_filename_component(resource_parent_path "${file}" DIRECTORY) + set_source_files_properties("${folder_parent_path}/${file}" PROPERTIES + HEADER_FILE_ONLY TRUE + MACOSX_PACKAGE_LOCATION "Resources/${resource_parent_path}") + endforeach() +endfunction() + +# ================================================================================================== + +function(_juce_create_linux_subprocess_helper_target) + if(TARGET juce_linux_subprocess_helper) + return() + endif() + + set(source "${JUCE_CMAKE_UTILS_DIR}/juce_LinuxSubprocessHelper.cpp") + + add_executable(juce_linux_subprocess_helper ${source}) + add_executable(juce::juce_linux_subprocess_helper ALIAS juce_linux_subprocess_helper) + target_compile_features(juce_linux_subprocess_helper PRIVATE cxx_std_17) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + target_link_libraries(juce_linux_subprocess_helper PRIVATE Threads::Threads ${CMAKE_DL_LIBS}) +endfunction() + +function(_juce_create_embedded_linux_subprocess_target output_target_name target) + # This library needs to be created in every directory where a target wants to link against it. + # Pre CMake 3.20 the GENERATED property is only visible in the directory of the current target, + # and even post 3.20, CMake will not know how to generate the sources outside this directory. + set(target_directory_key JUCE_EMBEDDED_LINUX_SUBPROCESS_TARGET) + get_directory_property(embedded_linux_subprocess_target ${target_directory_key}) + + if(embedded_linux_subprocess_target) + set(${output_target_name} juce::${embedded_linux_subprocess_target} PARENT_SCOPE) + return() + endif() + + set(prefix "_juce_directory_prefix") + set(embedded_linux_subprocess_target ${prefix}_embedded_linux_subprocess) + + while(TARGET ${embedded_linux_subprocess_target}) + set(embedded_linux_subprocess_target ${prefix}_${embedded_linux_subprocess_target}) + endwhile() + + _juce_create_linux_subprocess_helper_target() + + get_target_property(generated_sources_directory ${target} JUCE_GENERATED_SOURCES_DIRECTORY) + + if(generated_sources_directory) + set(juce_linux_subprocess_helper_binary_dir "${generated_sources_directory}/$/") + else() + set(juce_linux_subprocess_helper_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/juce_LinuxSubprocessHelper/$/") + endif() + + set(binary_header_file "${juce_linux_subprocess_helper_binary_dir}/juce_LinuxSubprocessHelperBinaryData.h") + set(binary_source_file "${juce_linux_subprocess_helper_binary_dir}/juce_LinuxSubprocessHelperBinaryData.cpp") + set(juceaide_input_file "${juce_linux_subprocess_helper_binary_dir}/input_file_list") + + file(GENERATE OUTPUT ${juceaide_input_file} CONTENT "$") + file(MAKE_DIRECTORY ${juce_linux_subprocess_helper_binary_dir}) + + add_custom_command( + OUTPUT + ${binary_header_file} + ${binary_source_file} + COMMAND juce::juceaide binarydata "LinuxSubprocessHelperBinaryData" "${binary_header_file}" + ${juce_linux_subprocess_helper_binary_dir} "${juceaide_input_file}" + COMMAND + ${CMAKE_COMMAND} -E rename "${juce_linux_subprocess_helper_binary_dir}/BinaryData1.cpp" "${binary_source_file}" + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + DEPENDS juce_linux_subprocess_helper + VERBATIM) + + add_library(${embedded_linux_subprocess_target} INTERFACE) + target_sources(${embedded_linux_subprocess_target} INTERFACE ${binary_source_file}) + target_include_directories(${embedded_linux_subprocess_target} INTERFACE ${juce_linux_subprocess_helper_binary_dir}) + target_compile_definitions(${embedded_linux_subprocess_target} INTERFACE JUCE_USE_EXTERNAL_TEMPORARY_SUBPROCESS=1) + add_library(juce::${embedded_linux_subprocess_target} ALIAS ${embedded_linux_subprocess_target}) + + set_directory_properties(PROPERTIES ${target_directory_key} ${embedded_linux_subprocess_target}) + set(${output_target_name} juce::${embedded_linux_subprocess_target} PARENT_SCOPE) +endfunction() + +function(juce_link_with_embedded_linux_subprocess target) + _juce_create_embedded_linux_subprocess_target(embedded_linux_subprocess_target ${target}) + target_link_libraries(${target} PRIVATE ${embedded_linux_subprocess_target}) +endfunction() + +# ================================================================================================== + +# Ideally, we'd check the preprocessor defs on the target to see whether +# JUCE_USE_CURL, JUCE_WEB_BROWSER, or JUCE_IN_APP_PURCHASES have been explicitly turned off, +# and then link libraries as appropriate. +# Unfortunately, this doesn't work, because linking a new library (curl/webkit/StoreKit) +# updates the target's compile defs, which results in a recursion/circular-dependency. +# Instead, we ask the user to explicitly request curl/webkit/StoreKit linking if they +# know they need it. Otherwise, we won't link anything. +# See the NEEDS_CURL, NEEDS_WEB_BROWSER, and NEEDS_STORE_KIT options in the CMake/readme.md. +function(_juce_link_optional_libraries target) + if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) + get_target_property(needs_curl ${target} JUCE_NEEDS_CURL) + + if(needs_curl) + target_link_libraries(${target} PRIVATE juce::pkgconfig_JUCE_CURL_LINUX_DEPS) + endif() + + get_target_property(needs_browser ${target} JUCE_NEEDS_WEB_BROWSER) + + if(needs_browser) + target_link_libraries(${target} PRIVATE juce::pkgconfig_JUCE_BROWSER_LINUX_DEPS) + + get_target_property(is_plugin ${target} JUCE_IS_PLUGIN) + + if(is_plugin) + juce_link_with_embedded_linux_subprocess(${target}) + endif() + endif() + elseif(APPLE) + get_target_property(needs_storekit ${target} JUCE_NEEDS_STORE_KIT) + + if(needs_storekit) + _juce_link_frameworks("${target}" PRIVATE StoreKit) + endif() + + get_target_property(needs_camera ${target} JUCE_CAMERA_PERMISSION_ENABLED) + + if(CMAKE_SYSTEM_NAME STREQUAL "iOS" AND needs_camera) + _juce_link_frameworks("${target}" PRIVATE ImageIO) + endif() + elseif(WIN32) + get_target_property(needs_webview2 ${target} JUCE_NEEDS_WEBVIEW2) + + if (needs_webview2) + if(NOT ("${JUCE_CMAKE_UTILS_DIR}" IN_LIST CMAKE_MODULE_PATH)) + list(APPEND CMAKE_MODULE_PATH "${JUCE_CMAKE_UTILS_DIR}") + endif() + + find_package(WebView2 REQUIRED) + target_link_libraries(${target} PRIVATE juce::juce_webview2) + endif() + endif() +endfunction() + +# ================================================================================================== + +function(_juce_get_module_definitions target filter out_var) + set(compile_defs $>) + + if(filter) + set(${out_var} $ PARENT_SCOPE) + else() + set(${out_var} ${compile_defs} PARENT_SCOPE) + endif() +endfunction() + +function(_juce_append_record output key) + string(ASCII 30 RS) + string(ASCII 31 US) + + set(prev) + + if(DEFINED "${output}") + set(prev "${${output}}") + endif() + + set(${output} "${prev}${key}${US}${ARGN}${RS}" PARENT_SCOPE) +endfunction() + +function(_juce_append_target_property output key target property) + get_target_property(prop ${target} ${property}) + + if(prop STREQUAL "prop-NOTFOUND") + set(prop) + endif() + + _juce_append_record(${output} ${key} ${prop}) + set(${output} "${${output}}" PARENT_SCOPE) +endfunction() + +# This is all info that should be known at configure time (i.e. no generator expressions here!) +# We use this info to generate plists and entitlements files, also at configure time. +function(_juce_write_configure_time_info target) + _juce_append_target_property(file_content EXECUTABLE_NAME ${target} JUCE_PRODUCT_NAME) + _juce_append_target_property(file_content VERSION ${target} JUCE_VERSION) + _juce_append_target_property(file_content BUILD_VERSION ${target} JUCE_BUILD_VERSION) + _juce_append_target_property(file_content PLIST_TO_MERGE ${target} JUCE_PLIST_TO_MERGE) + _juce_append_target_property(file_content BUNDLE_ID ${target} JUCE_BUNDLE_ID) + _juce_append_target_property(file_content XCODE_EXTRA_PLIST_ENTRIES ${target} JUCE_XCODE_EXTRA_PLIST_ENTRIES) + _juce_append_target_property(file_content MICROPHONE_PERMISSION_ENABLED ${target} JUCE_MICROPHONE_PERMISSION_ENABLED) + _juce_append_target_property(file_content MICROPHONE_PERMISSION_TEXT ${target} JUCE_MICROPHONE_PERMISSION_TEXT) + _juce_append_target_property(file_content CAMERA_PERMISSION_ENABLED ${target} JUCE_CAMERA_PERMISSION_ENABLED) + _juce_append_target_property(file_content CAMERA_PERMISSION_TEXT ${target} JUCE_CAMERA_PERMISSION_TEXT) + _juce_append_target_property(file_content BLUETOOTH_PERMISSION_ENABLED ${target} JUCE_BLUETOOTH_PERMISSION_ENABLED) + _juce_append_target_property(file_content BLUETOOTH_PERMISSION_TEXT ${target} JUCE_BLUETOOTH_PERMISSION_TEXT) + _juce_append_target_property(file_content SEND_APPLE_EVENTS_PERMISSION_ENABLED ${target} JUCE_SEND_APPLE_EVENTS_PERMISSION_ENABLED) + _juce_append_target_property(file_content SEND_APPLE_EVENTS_PERMISSION_TEXT ${target} JUCE_SEND_APPLE_EVENTS_PERMISSION_TEXT) + _juce_append_target_property(file_content SHOULD_ADD_STORYBOARD ${target} JUCE_SHOULD_ADD_STORYBOARD) + _juce_append_target_property(file_content LAUNCH_STORYBOARD_FILE ${target} JUCE_LAUNCH_STORYBOARD_FILE) + _juce_append_target_property(file_content ICON_FILE ${target} JUCE_ICON_FILE) + _juce_append_target_property(file_content PROJECT_NAME ${target} JUCE_PRODUCT_NAME) + _juce_append_target_property(file_content COMPANY_COPYRIGHT ${target} JUCE_COMPANY_COPYRIGHT) + _juce_append_target_property(file_content COMPANY_NAME ${target} JUCE_COMPANY_NAME) + _juce_append_target_property(file_content DOCUMENT_EXTENSIONS ${target} JUCE_DOCUMENT_EXTENSIONS) + _juce_append_target_property(file_content FILE_SHARING_ENABLED ${target} JUCE_FILE_SHARING_ENABLED) + _juce_append_target_property(file_content DOCUMENT_BROWSER_ENABLED ${target} JUCE_DOCUMENT_BROWSER_ENABLED) + _juce_append_target_property(file_content STATUS_BAR_HIDDEN ${target} JUCE_STATUS_BAR_HIDDEN) + _juce_append_target_property(file_content REQUIRES_FULL_SCREEN ${target} JUCE_REQUIRES_FULL_SCREEN) + _juce_append_target_property(file_content BACKGROUND_AUDIO_ENABLED ${target} JUCE_BACKGROUND_AUDIO_ENABLED) + _juce_append_target_property(file_content BACKGROUND_BLE_ENABLED ${target} JUCE_BACKGROUND_BLE_ENABLED) + _juce_append_target_property(file_content PUSH_NOTIFICATIONS_ENABLED ${target} JUCE_PUSH_NOTIFICATIONS_ENABLED) + _juce_append_target_property(file_content NETWORK_MULTICAST_ENABLED ${target} JUCE_NETWORK_MULTICAST_ENABLED) + _juce_append_target_property(file_content PLUGIN_MANUFACTURER_CODE ${target} JUCE_PLUGIN_MANUFACTURER_CODE) + _juce_append_target_property(file_content PLUGIN_CODE ${target} JUCE_PLUGIN_CODE) + _juce_append_target_property(file_content IPHONE_SCREEN_ORIENTATIONS ${target} JUCE_IPHONE_SCREEN_ORIENTATIONS) + _juce_append_target_property(file_content IPAD_SCREEN_ORIENTATIONS ${target} JUCE_IPAD_SCREEN_ORIENTATIONS) + _juce_append_target_property(file_content PLUGIN_NAME ${target} JUCE_PLUGIN_NAME) + _juce_append_target_property(file_content PLUGIN_MANUFACTURER ${target} JUCE_COMPANY_NAME) + _juce_append_target_property(file_content PLUGIN_DESCRIPTION ${target} JUCE_DESCRIPTION) + _juce_append_target_property(file_content PLUGIN_AU_EXPORT_PREFIX ${target} JUCE_AU_EXPORT_PREFIX) + _juce_append_target_property(file_content PLUGIN_AU_MAIN_TYPE ${target} JUCE_AU_MAIN_TYPE_CODE) + _juce_append_target_property(file_content IS_AU_SANDBOX_SAFE ${target} JUCE_AU_SANDBOX_SAFE) + _juce_append_target_property(file_content IS_PLUGIN_SYNTH ${target} JUCE_IS_SYNTH) + _juce_append_target_property(file_content IS_PLUGIN_ARA_EFFECT ${target} JUCE_IS_ARA_EFFECT) + _juce_append_target_property(file_content SUPPRESS_AU_PLIST_RESOURCE_USAGE ${target} JUCE_SUPPRESS_AU_PLIST_RESOURCE_USAGE) + _juce_append_target_property(file_content HARDENED_RUNTIME_ENABLED ${target} JUCE_HARDENED_RUNTIME_ENABLED) + _juce_append_target_property(file_content APP_SANDBOX_ENABLED ${target} JUCE_APP_SANDBOX_ENABLED) + _juce_append_target_property(file_content APP_SANDBOX_INHERIT ${target} JUCE_APP_SANDBOX_INHERIT) + _juce_append_target_property(file_content HARDENED_RUNTIME_OPTIONS ${target} JUCE_HARDENED_RUNTIME_OPTIONS) + _juce_append_target_property(file_content APP_SANDBOX_OPTIONS ${target} JUCE_APP_SANDBOX_OPTIONS) + _juce_append_target_property(file_content APP_SANDBOX_FILE_ACCESS_HOME_RO ${target} JUCE_APP_SANDBOX_FILE_ACCESS_HOME_RO) + _juce_append_target_property(file_content APP_SANDBOX_FILE_ACCESS_HOME_RW ${target} JUCE_APP_SANDBOX_FILE_ACCESS_HOME_RW) + _juce_append_target_property(file_content APP_SANDBOX_FILE_ACCESS_ABS_RO ${target} JUCE_APP_SANDBOX_FILE_ACCESS_ABS_RO) + _juce_append_target_property(file_content APP_SANDBOX_FILE_ACCESS_ABS_RW ${target} JUCE_APP_SANDBOX_FILE_ACCESS_ABS_RW) + _juce_append_target_property(file_content APP_SANDBOX_EXCEPTION_IOKIT ${target} JUCE_APP_SANDBOX_EXCEPTION_IOKIT) + _juce_append_target_property(file_content APP_GROUPS_ENABLED ${target} JUCE_APP_GROUPS_ENABLED) + _juce_append_target_property(file_content APP_GROUP_IDS ${target} JUCE_APP_GROUP_IDS) + _juce_append_target_property(file_content IS_PLUGIN ${target} JUCE_IS_PLUGIN) + _juce_append_target_property(file_content ICLOUD_PERMISSIONS_ENABLED ${target} JUCE_ICLOUD_PERMISSIONS_ENABLED) + _juce_append_target_property(file_content IS_AU_PLUGIN_HOST ${target} JUCE_PLUGINHOST_AU) + + if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + _juce_append_record(file_content IS_IOS 1) + else() + _juce_append_record(file_content IS_IOS 0) + endif() + + get_target_property(juce_library_code ${target} JUCE_GENERATED_SOURCES_DIRECTORY) + + set(info_file "${juce_library_code}/Info.txt") + file(WRITE "${info_file}" "${file_content}") + set_target_properties(${target} PROPERTIES JUCE_INFO_FILE "${info_file}") +endfunction() + +# In this file, we put things that CMake is only able to divine at generate time, like preprocessor definitions. +# We use the target preprocessor definitions to work out which JUCE modules should go in the JuceHeader.h. +function(_juce_write_generate_time_info target) + _juce_get_module_definitions(${target} OFF module_defs) + _juce_append_record(defs MODULE_DEFINITIONS ${module_defs}) + + _juce_append_target_property(defs EXECUTABLE_NAME ${target} JUCE_PRODUCT_NAME) + _juce_append_target_property(defs PROJECT_NAME ${target} JUCE_PRODUCT_NAME) + _juce_append_target_property(defs VERSION ${target} JUCE_VERSION) + _juce_append_target_property(defs COMPANY_NAME ${target} JUCE_COMPANY_NAME) + + get_target_property(juce_library_code ${target} JUCE_GENERATED_SOURCES_DIRECTORY) + + set(defs_file "${juce_library_code}/$/Defs.txt") + file(GENERATE OUTPUT "${defs_file}" CONTENT "${defs}") + set_target_properties(${target} PROPERTIES JUCE_DEFS_FILE "${defs_file}") +endfunction() + +# ================================================================================================== + +function(juce_add_binary_data target) + set(one_value_args NAMESPACE HEADER_NAME) + set(multi_value_args SOURCES) + cmake_parse_arguments(JUCE_ARG "" "${one_value_args}" "${multi_value_args}" ${ARGN}) + + list(LENGTH JUCE_ARG_SOURCES num_binary_files) + + if(${num_binary_files} LESS 1) + message(FATAL_ERROR "juce_add_binary_data must be passed at least one file to encode") + endif() + + add_library(${target} STATIC) + + set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) + + set(juce_binary_data_folder "${CMAKE_CURRENT_BINARY_DIR}/juce_binarydata_${target}/JuceLibraryCode") + + set(binary_file_names) + + foreach(index RANGE 1 ${num_binary_files}) + list(APPEND binary_file_names "${juce_binary_data_folder}/BinaryData${index}.cpp") + endforeach() + + file(MAKE_DIRECTORY ${juce_binary_data_folder}) + + if(NOT JUCE_ARG_NAMESPACE) + set(JUCE_ARG_NAMESPACE BinaryData) + endif() + + if(NOT JUCE_ARG_HEADER_NAME) + set(JUCE_ARG_HEADER_NAME BinaryData.h) + endif() + + list(APPEND binary_file_names "${juce_binary_data_folder}/${JUCE_ARG_HEADER_NAME}") + + set(newline_delimited_input) + + foreach(name IN LISTS JUCE_ARG_SOURCES) + _juce_make_absolute(name) + set(newline_delimited_input "${newline_delimited_input}${name}\n") + endforeach() + + set(input_file_list "${juce_binary_data_folder}/input_file_list") + file(WRITE "${input_file_list}" "${newline_delimited_input}") + + add_custom_command(OUTPUT ${binary_file_names} + COMMAND juce::juceaide binarydata "${JUCE_ARG_NAMESPACE}" "${JUCE_ARG_HEADER_NAME}" + ${juce_binary_data_folder} "${input_file_list}" + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + DEPENDS "${input_file_list}" ${JUCE_ARG_SOURCES} + VERBATIM) + + target_sources(${target} PRIVATE "${binary_file_names}") + target_include_directories(${target} INTERFACE ${juce_binary_data_folder}) + target_compile_features(${target} PRIVATE cxx_std_17) + + # This fixes an issue where Xcode is unable to find binary data during archive. + if(CMAKE_GENERATOR STREQUAL "Xcode") + set_target_properties(${target} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "./") + endif() + + if(JUCE_ARG_HEADER_NAME STREQUAL "BinaryData.h") + target_compile_definitions(${target} INTERFACE JUCE_TARGET_HAS_BINARY_DATA=1) + endif() +endfunction() + +# ================================================================================================== + +function(_juce_version_code version_in out_var) + string(REGEX REPLACE "\\." ";" version_list ${version_in}) + list(LENGTH version_list num_version_components) + + set(version_major 0) + set(version_minor 0) + set(version_patch 0) + + if(num_version_components GREATER 0) + list(GET version_list 0 version_major) + endif() + + if(num_version_components GREATER 1) + list(GET version_list 1 version_minor) + endif() + + if(num_version_components GREATER 2) + list(GET version_list 2 version_patch) + endif() + + math(EXPR hex "(${version_major} << 16) + (${version_minor} << 8) + ${version_patch}" + OUTPUT_FORMAT HEXADECIMAL) + set(${out_var} "${hex}" PARENT_SCOPE) +endfunction() + +function(_juce_to_char_literal str out_var help_text) + string(LENGTH "${str}" string_length) + + if(NOT "${string_length}" EQUAL "4") + message(WARNING "The ${help_text} code must contain exactly four characters, but it was set to '${str}'") + endif() + + # Round-tripping through a file is the simplest way to convert a string to hex... + string(SUBSTRING "${str}" 0 4 four_chars) + string(RANDOM LENGTH 16 random_string) + set(scratch_file "${CMAKE_CURRENT_BINARY_DIR}/${random_string}_ascii_conversion.txt") + + file(WRITE "${scratch_file}" "${four_chars}") + file(READ "${scratch_file}" four_chars_hex HEX) + file(REMOVE "${scratch_file}") + + string(SUBSTRING "${four_chars_hex}00000000" 0 8 four_chars_hex) + set(${out_var} "${four_chars_hex}" PARENT_SCOPE) +endfunction() + +# ================================================================================================== + +function(juce_generate_juce_header target) + get_target_property(juce_library_code ${target} JUCE_GENERATED_SOURCES_DIRECTORY) + + if(NOT juce_library_code) + message(FATAL_ERROR "Target ${target} does not have a generated sources directory. Ensure it was created with a juce_add_* function") + endif() + + set(juce_header ${juce_library_code}/JuceHeader.h) + target_sources(${target} PRIVATE ${juce_header}) + + set(defs_file $>) + + set(extra_args) + + add_custom_command(OUTPUT "${juce_header}" + COMMAND juce::juceaide header "${defs_file}" "${juce_header}" ${extra_args} + DEPENDS "${defs_file}" + VERBATIM) +endfunction() + +# ================================================================================================== + +function(_juce_execute_juceaide) + if(NOT TARGET juce::juceaide) + message(FATAL_ERROR "The juceaide target does not exist") + endif() + + get_target_property(juceaide_location juce::juceaide IMPORTED_LOCATION) + + if(NOT EXISTS "${juceaide_location}") + message(FATAL_ERROR "juceaide was imported, but it doesn't exist!") + endif() + + execute_process(COMMAND "${juceaide_location}" ${ARGN} + RESULT_VARIABLE result_variable + OUTPUT_VARIABLE output + ERROR_VARIABLE output) + + if(result_variable) + message(FATAL_ERROR "Running juceaide failed:\ncommand: ${juceaide_location} ${ARGN}\noutput: ${output}") + endif() +endfunction() + +function(_juce_set_output_name target name) + if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android") + set_target_properties(${target} PROPERTIES + OUTPUT_NAME ${name} + XCODE_ATTRIBUTE_PRODUCT_NAME ${name}) + endif() +endfunction() + +function(_juce_check_icon_files_exist icon_files) + foreach(file IN LISTS icon_files) + if(NOT EXISTS "${file}") + message(FATAL_ERROR "Could not find icon file: ${file}") + endif() + endforeach() +endfunction() + +function(_juce_generate_icon source_target dest_target) + get_target_property(juce_library_code ${source_target} JUCE_GENERATED_SOURCES_DIRECTORY) + get_target_property(juce_property_icon_big ${source_target} JUCE_ICON_BIG) + get_target_property(juce_property_icon_small ${source_target} JUCE_ICON_SMALL) + + set(icon_args) + + if(juce_property_icon_big) + list(APPEND icon_args "${juce_property_icon_big}") + endif() + + if(juce_property_icon_small) + list(APPEND icon_args "${juce_property_icon_small}") + endif() + + set(generated_icon) + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + if(NOT icon_args) + return() + endif() + + _juce_check_icon_files_exist("${icon_args}") + + set(generated_icon "${juce_library_code}/Icon.icns") + # To get compiled properly, we need the icon before the plist is generated! + _juce_execute_juceaide(macicon "${generated_icon}" ${icon_args}) + set_source_files_properties(${generated_icon} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") + if(NOT icon_args) + return() + endif() + + _juce_check_icon_files_exist("${icon_args}") + + set(generated_icon "${juce_library_code}/icon.ico") + _juce_execute_juceaide(winicon "${generated_icon}" ${icon_args}) + elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") + get_target_property(generated_icon ${source_target} JUCE_CUSTOM_XCASSETS_FOLDER) + + if(icon_args AND (NOT generated_icon)) + _juce_check_icon_files_exist("${icon_args}") + + set(out_path "${juce_library_code}/${dest_target}") + set(generated_icon "${out_path}/Images.xcassets") + + # To get compiled properly, we need iOS assets at configure time! + _juce_execute_juceaide(iosassets "${out_path}" ${icon_args}) + endif() + + if(NOT generated_icon) + return() + endif() + + set_target_properties(${dest_target} PROPERTIES + XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon") + + get_target_property(add_storyboard ${source_target} JUCE_SHOULD_ADD_STORYBOARD) + + if(NOT add_storyboard) + set_target_properties(${dest_target} PROPERTIES + XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME "LaunchImage") + endif() + endif() + + if(generated_icon) + _juce_check_icon_files_exist("${generated_icon}") + + target_sources(${dest_target} PRIVATE ${generated_icon}) + set_target_properties(${source_target} ${dest_target} PROPERTIES + JUCE_ICON_FILE "${generated_icon}" + RESOURCE "${generated_icon}") + endif() +endfunction() + +function(_juce_add_xcode_entitlements source_target dest_target) + if(NOT APPLE) + return() + endif() + + get_target_property(juce_kind_string ${dest_target} JUCE_TARGET_KIND_STRING) + get_target_property(input_info_file ${source_target} JUCE_INFO_FILE) + + get_target_property(juce_library_code ${source_target} JUCE_GENERATED_SOURCES_DIRECTORY) + set(entitlements_file "${juce_library_code}/${dest_target}.entitlements") + + _juce_execute_juceaide(entitlements "${juce_kind_string}" "${input_info_file}" "${entitlements_file}") + set_target_properties(${dest_target} PROPERTIES + XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS + "${entitlements_file}" + XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME + "$") +endfunction() + +function(_juce_configure_bundle source_target dest_target) + _juce_generate_icon(${source_target} ${dest_target}) + _juce_write_configure_time_info(${source_target}) + + if(NOT APPLE) + return() + endif() + + get_target_property(generated_icon ${source_target} JUCE_ICON_FILE) + set(icon_dependency) + + if(generated_icon) + set(icon_dependency "${generated_icon}") + endif() + + get_target_property(juce_library_code ${source_target} JUCE_GENERATED_SOURCES_DIRECTORY) + get_target_property(input_info_file ${source_target} JUCE_INFO_FILE) + + set(this_output_info_dir "${juce_library_code}/${dest_target}") + set(this_output_pkginfo "${this_output_info_dir}/PkgInfo") + set(this_output_plist "${this_output_info_dir}/Info.plist") + + get_target_property(juce_kind_string ${dest_target} JUCE_TARGET_KIND_STRING) + + _juce_execute_juceaide(plist "${juce_kind_string}" "${input_info_file}" "${this_output_plist}") + set_target_properties(${dest_target} PROPERTIES + BUNDLE TRUE + MACOSX_BUNDLE_INFO_PLIST "${this_output_plist}") + + add_custom_command(OUTPUT "${this_output_pkginfo}" + COMMAND juce::juceaide pkginfo "${juce_kind_string}" "${this_output_pkginfo}" + VERBATIM) + + set(output_folder "$") + + target_sources(${dest_target} PRIVATE "${this_output_pkginfo}") + set_source_files_properties("${this_output_pkginfo}" PROPERTIES + HEADER_FILE_ONLY TRUE + GENERATED TRUE) + add_custom_command(TARGET ${dest_target} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy "${this_output_pkginfo}" "${output_folder}" + VERBATIM) + + _juce_add_xcode_entitlements(${source_target} ${dest_target}) + + if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + get_target_property(add_storyboard ${source_target} JUCE_SHOULD_ADD_STORYBOARD) + + if(add_storyboard) + get_target_property(storyboard_file ${source_target} JUCE_LAUNCH_STORYBOARD_FILE) + + if(NOT EXISTS "${storyboard_file}") + message(FATAL_ERROR "Could not find storyboard file: ${storyboard_file}") + endif() + + target_sources(${dest_target} PRIVATE "${storyboard_file}") + set_property(TARGET ${dest_target} APPEND PROPERTY RESOURCE "${storyboard_file}") + endif() + endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set_target_properties(${dest_target} PROPERTIES + XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "--timestamp") + endif() + + set_target_properties(${dest_target} PROPERTIES + XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY + "$") + + if(juce_kind_string STREQUAL "AUv3 AppExtension") + get_target_property(source_bundle_id ${source_target} JUCE_BUNDLE_ID) + + if(source_bundle_id MATCHES "\\.([^.]+)$") + set_target_properties(${dest_target} PROPERTIES + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER + "${source_bundle_id}.${CMAKE_MATCH_1}AUv3") + else() + message(FATAL_ERROR "Bundle ID should contain at least one `.`!") + endif() + else() + set_target_properties(${dest_target} PROPERTIES + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER + $) + endif() + + if(CMAKE_GENERATOR STREQUAL "Xcode") + get_target_property(product_name ${source_target} JUCE_PRODUCT_NAME) + set(skip_install NO) + set(install_path "$(LOCAL_APPS_DIR)") + + if(juce_kind_string STREQUAL "AUv3 AppExtension") + set(skip_install YES) + set(install_path "") + endif() + + set_target_properties(${dest_target} PROPERTIES + XCODE_ATTRIBUTE_INSTALL_PATH "${install_path}" + XCODE_ATTRIBUTE_SKIP_INSTALL "${skip_install}") + endif() +endfunction() + +function(_juce_add_resources_rc source_target dest_target) + if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") + return() + endif() + + if(NOT TARGET ${source_target}_rc_lib) + get_target_property(juce_library_code ${source_target} JUCE_GENERATED_SOURCES_DIRECTORY) + get_target_property(input_info_file ${source_target} JUCE_INFO_FILE) + + get_target_property(generated_icon ${source_target} JUCE_ICON_FILE) + set(dependency) + + if(generated_icon) + set(dependency DEPENDS "${generated_icon}") + endif() + + set(resource_rc_file "${juce_library_code}/${source_target}_resources.rc") + + add_custom_command(OUTPUT "${resource_rc_file}" + COMMAND juce::juceaide rcfile "${input_info_file}" "${resource_rc_file}" + ${dependency} + VERBATIM) + + add_library(${source_target}_rc_lib OBJECT ${resource_rc_file}) + + set(compile_defs $>) + set(include_dirs $>) + set(filtered $) + set(has_custom_rc_include $) + + target_include_directories(${source_target}_rc_lib + PRIVATE $<${has_custom_rc_include}:${include_dirs}>) + set_source_files_properties(${resource_rc_file} PROPERTIES + COMPILE_DEFINITIONS $<${has_custom_rc_include}:${compile_defs}>) + endif() + + target_link_libraries(${dest_target} PRIVATE ${source_target}_rc_lib) +endfunction() + +function(_juce_configure_app_bundle source_target dest_target) + set_target_properties(${dest_target} PROPERTIES + JUCE_TARGET_KIND_STRING "App" + MACOSX_BUNDLE TRUE + WIN32_EXECUTABLE TRUE) + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(nib_path "${JUCE_CMAKE_UTILS_DIR}/RecentFilesMenuTemplate.nib") + target_sources("${dest_target}" PRIVATE "${nib_path}") + set_source_files_properties("${nib_path}" PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + endif() +endfunction() + +# ================================================================================================== + +function(_juce_create_windows_package source_target dest_target extension default_icon arch_string) + get_target_property(products_folder ${dest_target} LIBRARY_OUTPUT_DIRECTORY) + + set(product_name $) + set(output_folder "${products_folder}/${product_name}.${extension}") + + set_target_properties(${dest_target} + PROPERTIES + PDB_OUTPUT_DIRECTORY "${products_folder}" + LIBRARY_OUTPUT_DIRECTORY "${output_folder}/Contents/${arch_string}") + + get_target_property(icon_file ${source_target} JUCE_ICON_FILE) + + if(NOT icon_file) + set(icon_file "${default_icon}") + endif() + + if(icon_file) + set(desktop_ini "${output_folder}/desktop.ini") + set(plugin_ico "${output_folder}/Plugin.ico") + + file(GENERATE OUTPUT "${desktop_ini}" + CONTENT + "[.ShellClassInfo]\nIconResource=Plugin.ico,0\nIconFile=Plugin.ico\nIconIndex=0\n") + add_custom_command(TARGET ${dest_target} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy "${icon_file}" "${plugin_ico}" + COMMAND attrib +s "${desktop_ini}" + COMMAND attrib +s "${output_folder}" + DEPENDS "${icon_file}" "${desktop_ini}" + VERBATIM) + endif() +endfunction() + +# ================================================================================================== + +function(_juce_add_unity_plugin_prefix_if_necessary name out_var) + string(TOLOWER "${name}" lower) + + if(NOT lower MATCHES "^audioplugin") + set(${out_var} "audioplugin_${name}" PARENT_SCOPE) + else() + set(${out_var} "${name}" PARENT_SCOPE) + endif() +endfunction() + +function(_juce_add_unity_script_file shared_target out_var) + set(script_in "${JUCE_CMAKE_UTILS_DIR}/UnityPluginGUIScript.cs.in") + + get_target_property(plugin_name ${shared_target} JUCE_PLUGIN_NAME) + get_target_property(plugin_vendor ${shared_target} JUCE_COMPANY_NAME) + get_target_property(plugin_description ${shared_target} JUCE_DESCRIPTION) + + string(REGEX REPLACE " +" "_" plugin_class_name "${plugin_name}") + + get_target_property(juce_library_code ${shared_target} JUCE_GENERATED_SOURCES_DIRECTORY) + _juce_add_unity_plugin_prefix_if_necessary("${plugin_name}" script_prefix) + set(script_out "${juce_library_code}/${script_prefix}_UnityScript.cs") + configure_file(${script_in} ${script_out}) + set(${out_var} "${script_out}" PARENT_SCOPE) +endfunction() + +# ================================================================================================== + +function(_juce_copy_dir target from to) + # This is a shim to make CMake copy a whole directory, rather than just + # the contents of a directory + add_custom_command(TARGET ${target} POST_BUILD + COMMAND "${CMAKE_COMMAND}" + "-Dsrc=${from}" + "-Ddest=${to}" + "-P" "${JUCE_CMAKE_UTILS_DIR}/copyDir.cmake" + VERBATIM) +endfunction() + +function(_juce_set_copy_properties shared_code target from to_property) + get_target_property(destination "${shared_code}" "${to_property}") + + if(destination) + set_target_properties("${target}" PROPERTIES JUCE_PLUGIN_COPY_DIR "${destination}") + endif() + + set_target_properties("${target}" PROPERTIES JUCE_PLUGIN_ARTEFACT_FILE "${from}") +endfunction() + +function(_juce_adhoc_sign target) + if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") + return() + endif() + + get_target_property(bundle "${target}" BUNDLE) + + set(src "$") + + if(bundle) + set(src "$") + endif() + + add_custom_command(TARGET ${target} POST_BUILD + COMMAND "${CMAKE_COMMAND}" + "-Dsrc=${src}" + "-P" "${JUCE_CMAKE_UTILS_DIR}/checkBundleSigning.cmake" + VERBATIM) +endfunction() + +function(juce_enable_copy_plugin_step shared_code_target) + get_target_property(step_added ${shared_code_target} _JUCE_PLUGIN_COPY_STEP_ADDED) + + if(step_added) + message(WARNING "Plugin copy step requested multiple times for ${shared_code_target}") + return() + endif() + + set_target_properties(${shared_code_target} PROPERTIES _JUCE_PLUGIN_COPY_STEP_ADDED TRUE) + + get_target_property(active_targets "${shared_code_target}" JUCE_ACTIVE_PLUGIN_TARGETS) + + foreach(target IN LISTS active_targets) + get_target_property(target_kind "${target}" JUCE_TARGET_KIND_STRING) + + if(target_kind STREQUAL "App") + continue() + endif() + + _juce_adhoc_sign("${target}") + + get_target_property(source "${target}" JUCE_PLUGIN_ARTEFACT_FILE) + + if(NOT source) + continue() + endif() + + get_target_property(dest "${target}" JUCE_PLUGIN_COPY_DIR) + + if(dest) + _juce_copy_dir("${target}" "${source}" "$") + else() + message(WARNING "Target '${target}' requested copy but no destination is set") + endif() + endforeach() +endfunction() + +# ================================================================================================== + +function(_juce_add_lv2_manifest_helper_target) + if(TARGET juce_lv2_helper OR (CMAKE_SYSTEM_NAME STREQUAL "iOS") OR (CMAKE_SYSTEM_NAME STREQUAL "Android")) + return() + endif() + + get_target_property(module_path juce::juce_audio_plugin_client INTERFACE_JUCE_MODULE_PATH) + set(source "${module_path}/juce_audio_plugin_client/LV2/juce_LV2ManifestHelper.cpp") + add_executable(juce_lv2_helper "${source}") + add_executable(juce::juce_lv2_helper ALIAS juce_lv2_helper) + target_compile_features(juce_lv2_helper PRIVATE cxx_std_17) + set_target_properties(juce_lv2_helper PROPERTIES BUILD_WITH_INSTALL_RPATH ON) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + target_link_libraries(juce_lv2_helper PRIVATE Threads::Threads ${CMAKE_DL_LIBS}) +endfunction() + +# ================================================================================================== + +function(_juce_add_vst3_manifest_helper_target) + if(TARGET juce_vst3_helper + OR (CMAKE_SYSTEM_NAME STREQUAL "iOS") + OR (CMAKE_SYSTEM_NAME STREQUAL "Android") + OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) + return() + endif() + + get_target_property(module_path juce::juce_audio_processors INTERFACE_JUCE_MODULE_PATH) + set(vst3_dir "${module_path}/juce_audio_processors/format_types/VST3_SDK") + + set(extension "cpp") + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(extension "mm") + endif() + + set(source "${module_path}/juce_audio_plugin_client/VST3/juce_VST3ManifestHelper.${extension}") + + add_executable(juce_vst3_helper "${source}") + add_executable(juce::juce_vst3_helper ALIAS juce_vst3_helper) + + target_include_directories(juce_vst3_helper PRIVATE "${vst3_dir}" "${module_path}") + + add_library(juce_interface_definitions INTERFACE) + _juce_add_standard_defs(juce_interface_definitions) + target_link_libraries(juce_vst3_helper PRIVATE juce_interface_definitions) + target_compile_features(juce_vst3_helper PRIVATE cxx_std_17) + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + _juce_link_frameworks(juce_vst3_helper PRIVATE Cocoa) + target_compile_options(juce_vst3_helper PRIVATE -fobjc-arc) + endif() + + if(MSYS OR MINGW) + target_link_options(juce_vst3_helper PRIVATE -municode) + endif() + + set_target_properties(juce_vst3_helper PROPERTIES BUILD_WITH_INSTALL_RPATH ON) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + target_link_libraries(juce_vst3_helper PRIVATE Threads::Threads ${CMAKE_DL_LIBS} juce_recommended_config_flags) + + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9) + target_link_libraries(juce_vst3_helper PRIVATE stdc++fs) + endif() +endfunction() + +function(juce_enable_vst3_manifest_step shared_code_target) + get_target_property(manifest_step_added ${shared_code_target} _JUCE_VST3_MANIFEST_STEP_ADDED) + + if(manifest_step_added) + message(WARNING "VST3 manifest generation has already been enabled for target ${shared_code_target}. " + "You may need to set VST3_AUTO_MANIFEST FALSE in juce_add_plugin, and/or check that you're " + "not calling juce_enable_vst3_manifest_step multiple times.") + return() + endif() + + get_target_property(copy_step_added ${shared_code_target} _JUCE_PLUGIN_COPY_STEP_ADDED) + + if(copy_step_added) + message(FATAL_ERROR "VST3 manifest generation would run after plugin copy step, so it has been disabled. " + "If you're manually calling juce_enable_vst3_manifest_step, then you probably need to call " + "juce_enable_copy_plugin_step too.") + endif() + + if((MSYS OR MINGW) AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9) + message(WARNING "VST3 manifest generation is disabled for ${shared_code_target} because the compiler is not supported.") + return() + endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND NOT JUCE_WINDOWS_HELPERS_CAN_RUN) + message(WARNING "VST3 manifest generation is disabled for ${shared_code_target} because a " + "${JUCE_TARGET_ARCHITECTURE} manifest helper cannot run on a host system processor detected to be " + "${CMAKE_HOST_SYSTEM_PROCESSOR}.") + return() + endif() + + set(target_name ${shared_code_target}_VST3) + get_target_property(product ${target_name} JUCE_PLUGIN_ARTEFACT_FILE) + + if(NOT product) + message(FATAL_ERROR "Property JUCE_PLUGIN_ARTEFACT_FILE not set for ${target_name}") + endif() + + # Add a target for the helper tool + _juce_add_vst3_manifest_helper_target() + + get_target_property(target_version_string ${shared_code_target} JUCE_VERSION) + + set(ouput_path "${product}/Contents/Resources/moduleinfo.json") + + # Use the helper tool to write out the moduleinfo.json + add_custom_command(TARGET ${target_name} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "creating ${ouput_path}" + COMMAND ${CMAKE_COMMAND} -E make_directory "${product}/Contents/Resources" + COMMAND juce_vst3_helper + -create + -version "${target_version_string}" + -path "${product}" + -output "${ouput_path}" + VERBATIM) + + set_target_properties(${shared_code_target} PROPERTIES _JUCE_VST3_MANIFEST_STEP_ADDED TRUE) +endfunction() + +# ================================================================================================== + +function(_juce_disable_system_includes target) + if(CMAKE_VERSION VERSION_GREATER "3.25") + set_target_properties("${target}" PROPERTIES SYSTEM FALSE) + elseif(CMAKE_VERSION VERSION_GREATER "3.23") + set_target_properties("${target}" PROPERTIES IMPORTED_NO_SYSTEM TRUE) + endif() +endfunction() + +# ================================================================================================== + +function(juce_set_aax_sdk_path path) + if(TARGET juce_aax_sdk) + message(FATAL_ERROR "juce_set_aax_sdk_path should only be called once") + endif() + + _juce_make_absolute(path) + + if((NOT EXISTS "${path}") + OR (NOT EXISTS "${path}/Interfaces") + OR (NOT EXISTS "${path}/Interfaces/ACF")) + message(FATAL_ERROR "Could not find AAX SDK at the specified path: ${path}") + endif() + + if((CMAKE_SYSTEM_NAME STREQUAL "Darwin") OR (CMAKE_SYSTEM_NAME STREQUAL "Windows")) + add_library(juce_aax_sdk INTERFACE IMPORTED GLOBAL) + else() + return() + endif() + + _juce_disable_system_includes(juce_aax_sdk) + target_include_directories(juce_aax_sdk INTERFACE + "${path}" + "${path}/Interfaces" + "${path}/Interfaces/ACF") + set_target_properties(juce_aax_sdk PROPERTIES INTERFACE_JUCE_AAX_DEFAULT_ICON "${path}/Utilities/PlugIn.ico") +endfunction() + +function(_juce_init_bundled_aax_sdk) + if(TARGET juce_aax_sdk) + return() + endif() + + get_target_property(module_path juce::juce_audio_plugin_client INTERFACE_JUCE_MODULE_PATH) + juce_set_aax_sdk_path("${module_path}/juce_audio_plugin_client/AAX/SDK") +endfunction() + +# ================================================================================================== + +function(_juce_set_plugin_target_properties shared_code_target kind) + set(target_name ${shared_code_target}_${kind}) + + set_target_properties(${target_name} PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "$>/${kind}" + LIBRARY_OUTPUT_DIRECTORY "$>/${kind}" + RUNTIME_OUTPUT_DIRECTORY "$>/${kind}") + + get_target_property(products_folder ${target_name} LIBRARY_OUTPUT_DIRECTORY) + set(product_name $) + + if(kind STREQUAL "Standalone") + get_target_property(is_bundle "${target_name}" BUNDLE) + + if(is_bundle) + set_target_properties("${target_name}" PROPERTIES JUCE_PLUGIN_ARTEFACT_FILE "$") + else() + set_target_properties("${target_name}" PROPERTIES JUCE_PLUGIN_ARTEFACT_FILE "$") + endif() + elseif(kind STREQUAL "VST3") + set_target_properties(${target_name} PROPERTIES + BUNDLE_EXTENSION vst3 + PREFIX "" + SUFFIX .vst3 + BUNDLE TRUE + XCODE_ATTRIBUTE_WRAPPER_EXTENSION vst3 + XCODE_ATTRIBUTE_LIBRARY_STYLE Bundle + XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES) + + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + if(JUCE_TARGET_ARCHITECTURE STREQUAL "x86_64") + set(windows_arch "x86_64") + elseif(JUCE_TARGET_ARCHITECTURE STREQUAL "i386") + set(windows_arch "x86") + elseif(JUCE_TARGET_ARCHITECTURE STREQUAL "arm64ec") + set(windows_arch "arm64ec") + elseif(JUCE_TARGET_ARCHITECTURE STREQUAL "aarch64") + set(windows_arch "arm64") + else() + message(FATAL_ERROR "Unsupported target architecture for VST3: ${JUCE_TARGET_ARCHITECTURE}") + endif() + + _juce_create_windows_package(${shared_code_target} ${target_name} vst3 "" "${windows_arch}-win") + endif() + + set(output_path "${products_folder}/${product_name}.vst3") + + if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) + set_target_properties(${target_name} PROPERTIES + SUFFIX .so + LIBRARY_OUTPUT_DIRECTORY "${output_path}/Contents/${JUCE_TARGET_ARCHITECTURE}-linux") + endif() + + _juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_VST3_COPY_DIR) + + _juce_adhoc_sign(${target_name}) + + get_target_property(vst3_auto_manifest ${shared_code_target} JUCE_VST3_AUTO_MANIFEST) + + add_custom_command(TARGET ${target_name} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "removing moduleinfo.json" + COMMAND ${CMAKE_COMMAND} -E remove -f + "${output_path}/Contents/moduleinfo.json" + "${output_path}/Contents/Resources/moduleinfo.json") + + if(vst3_auto_manifest) + juce_enable_vst3_manifest_step(${shared_code_target}) + endif() + elseif(kind STREQUAL "VST") + set_target_properties(${target_name} PROPERTIES + BUNDLE_EXTENSION vst + BUNDLE TRUE + XCODE_ATTRIBUTE_WRAPPER_EXTENSION vst + XCODE_ATTRIBUTE_LIBRARY_STYLE Bundle + XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES) + + set(output_path "$") + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(output_path "$") + endif() + + _juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_VST_COPY_DIR) + elseif(kind STREQUAL "AU") + set_target_properties(${target_name} PROPERTIES + BUNDLE_EXTENSION component + XCODE_ATTRIBUTE_WRAPPER_EXTENSION component + BUNDLE TRUE + XCODE_ATTRIBUTE_LIBRARY_STYLE Bundle + XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES) + + set(output_path "$") + _juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_AU_COPY_DIR) + elseif(kind STREQUAL "AUv3") + set_target_properties(${target_name} PROPERTIES + XCODE_PRODUCT_TYPE "com.apple.product-type.app-extension" + BUNDLE_EXTENSION appex + XCODE_ATTRIBUTE_WRAPPER_EXTENSION appex + XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES) + elseif(kind STREQUAL "AAX") + set_target_properties(${target_name} PROPERTIES + BUNDLE_EXTENSION aaxplugin + PREFIX "" + SUFFIX .aaxplugin + XCODE_ATTRIBUTE_WRAPPER_EXTENSION aaxplugin + BUNDLE TRUE + XCODE_ATTRIBUTE_LIBRARY_STYLE Bundle + XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES) + + _juce_init_bundled_aax_sdk() + get_target_property(default_icon juce_aax_sdk INTERFACE_JUCE_AAX_DEFAULT_ICON) + + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + if(JUCE_TARGET_ARCHITECTURE STREQUAL "x86_64") + set(windows_arch "x64") + elseif(JUCE_TARGET_ARCHITECTURE STREQUAL "i386") + set(windows_arch "Win32") + else() + message(FATAL_ERROR "Unsupported target architecture for AAX: ${JUCE_TARGET_ARCHITECTURE}") + endif() + + _juce_create_windows_package(${shared_code_target} ${target_name} aaxplugin "${default_icon}" "${windows_arch}") + endif() + + set(output_path "${products_folder}/${product_name}.aaxplugin") + _juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_AAX_COPY_DIR) + elseif(kind STREQUAL "Unity") + set_target_properties(${target_name} PROPERTIES + BUNDLE_EXTENSION bundle + XCODE_ATTRIBUTE_WRAPPER_EXTENSION bundle + BUNDLE TRUE + XCODE_ATTRIBUTE_LIBRARY_STYLE Bundle + XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES) + + _juce_add_unity_script_file(${shared_code_target} script_file) + target_sources(${target_name} PRIVATE "${script_file}") + set_source_files_properties("${script_file}" PROPERTIES + GENERATED TRUE + MACOSX_PACKAGE_LOCATION Resources) + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(output_path "$") + _juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_UNITY_COPY_DIR) + else() + # On windows and linux, the gui script needs to be copied next to the unity output + add_custom_command(TARGET ${target_name} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy "${script_file}" "${products_folder}" + DEPENDS "${script_file}" + VERBATIM) + + _juce_set_copy_properties(${shared_code_target} + ${target_name} + "$" + JUCE_UNITY_COPY_DIR) + _juce_set_copy_properties(${shared_code_target} + ${target_name} + "${script_file}" + JUCE_UNITY_COPY_DIR) + endif() + elseif(kind STREQUAL "LV2") + if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND NOT JUCE_WINDOWS_HELPERS_CAN_RUN) + message(FATAL_ERROR "You cannot build a ${JUCE_TARGET_ARCHITECTURE} LV2 plug-in on a host " + "system processor detected to be ${CMAKE_HOST_SYSTEM_PROCESSOR}.") + endif() + + set_target_properties(${target_name} PROPERTIES BUNDLE FALSE) + + get_target_property(JUCE_LV2URI "${shared_code_target}" JUCE_LV2URI) + + if(NOT JUCE_LV2URI MATCHES "https?://.*|urn:.*") + message(WARNING + "LV2URI should be well-formed with an 'http' or 'urn' prefix. " + "Check the LV2URI argument to juce_add_plugin.") + endif() + + set(source_header "${JUCE_CMAKE_UTILS_DIR}/JuceLV2Defines.h.in") + get_target_property(juce_library_code "${shared_code_target}" JUCE_GENERATED_SOURCES_DIRECTORY) + configure_file("${source_header}" "${juce_library_code}/JuceLV2Defines.h") + + set(output_path "${products_folder}/${product_name}.lv2") + set_target_properties(${target_name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${output_path}") + + _juce_adhoc_sign(${target_name}) + + _juce_add_lv2_manifest_helper_target() + + add_custom_command(TARGET ${target_name} POST_BUILD + COMMAND juce_lv2_helper "$" + VERBATIM) + + _juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_LV2_COPY_DIR) + endif() +endfunction() + +# Place plugin wrapper targets alongside the shared code target in IDEs +function(_juce_set_plugin_folder_property shared_target wrapper_target) + get_target_property(folder_to_use "${shared_target}" FOLDER) + + if(folder_to_use STREQUAL "folder_to_use-NOTFOUND") + set_target_properties("${shared_target}" PROPERTIES FOLDER "${shared_target}") + elseif(NOT folder_to_use MATCHES ".*${shared_target}$") + set_target_properties("${shared_target}" PROPERTIES FOLDER "${folder_to_use}/${shared_target}") + endif() + + get_target_property(folder_to_use "${shared_target}" FOLDER) + set_target_properties("${wrapper_target}" PROPERTIES FOLDER "${folder_to_use}") +endfunction() + +# Convert the cmake plugin kind ids to strings understood by ProjectType::Target::typeFromName +function(_juce_get_plugin_kind_name kind out_var) + if(kind STREQUAL "AU") + set(${out_var} "AU" PARENT_SCOPE) + elseif(kind STREQUAL "AUv3") + set(${out_var} "AUv3 AppExtension" PARENT_SCOPE) + elseif(kind STREQUAL "AAX") + set(${out_var} "AAX" PARENT_SCOPE) + elseif(kind STREQUAL "LV2") + set(${out_var} "LV2" PARENT_SCOPE) + elseif(kind STREQUAL "Standalone") + set(${out_var} "Standalone Plugin" PARENT_SCOPE) + elseif(kind STREQUAL "Unity") + set(${out_var} "Unity Plugin" PARENT_SCOPE) + elseif(kind STREQUAL "VST") + set(${out_var} "VST" PARENT_SCOPE) + elseif(kind STREQUAL "VST3") + set(${out_var} "VST3" PARENT_SCOPE) + endif() +endfunction() + +function(_juce_link_plugin_wrapper shared_code_target kind) + set(target_name ${shared_code_target}_${kind}) + + if(CMAKE_SYSTEM_NAME STREQUAL "Android") + add_library(${target_name} SHARED) + elseif((kind STREQUAL "Standalone") OR (kind STREQUAL "AUv3")) + add_executable(${target_name} WIN32 MACOSX_BUNDLE) + else() + add_library(${target_name} MODULE) + endif() + + if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) + target_link_options(${target_name} PRIVATE "-Wl,--no-undefined") + endif() + + # We re-export the shared code's private include dirs, because the wrapper targets need to + # see the module headers. We don't just link publicly, because that would introduce + # conflicting macro definitions. + target_include_directories(${target_name} PRIVATE + $) + + target_link_libraries(${target_name} PRIVATE + ${shared_code_target} + juce::juce_audio_plugin_client_${kind}) + + _juce_set_output_name(${target_name} $) + + _juce_set_plugin_folder_property("${shared_code_target}" "${target_name}") + + _juce_get_plugin_kind_name(${kind} juce_kind_string) + set_target_properties(${target_name} PROPERTIES + XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME NO + XCODE_ATTRIBUTE_COMBINE_HIDPI_IMAGES YES + POSITION_INDEPENDENT_CODE TRUE + VISIBILITY_INLINES_HIDDEN TRUE + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + JUCE_TARGET_KIND_STRING "${juce_kind_string}") + + # Under the Xcode generator, POST_BUILD commands (including the plugin copy step) run before + # signing, but M1 macs will only load signed binaries. Setting "adhoc_codesign" forces the + # linker to sign bundles, so that they can be loaded even if they are copied before the "real" + # signing step. See issue 21854 on the CMake Gitlab repo. + if("${CMAKE_GENERATOR};${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Xcode;Darwin;arm64") + target_link_options(${target_name} PRIVATE LINKER:-adhoc_codesign) + endif() + + add_dependencies(${shared_code_target}_All ${target_name}) + + if(NOT kind STREQUAL "LV2") + _juce_configure_bundle(${shared_code_target} ${target_name}) + else() + _juce_write_configure_time_info(${shared_code_target}) + endif() + + _juce_set_plugin_target_properties(${shared_code_target} ${kind}) + _juce_add_resources_rc(${shared_code_target} ${target_name}) +endfunction() + +# ================================================================================================== + +function(_juce_get_vst3_category_string target out_var) + get_target_property(vst3_categories ${target} JUCE_VST3_CATEGORIES) + + if((NOT Fx IN_LIST vst3_categories) AND (NOT Instrument IN_LIST vst3_categories)) + get_target_property(is_synth ${target} JUCE_IS_SYNTH) + + if(is_synth) + set(first_type Instrument) + else() + set(first_type Fx) + endif() + + list(INSERT vst3_categories 0 ${first_type}) + else() + if(Instrument IN_LIST vst3_categories) + list(REMOVE_ITEM vst3_categories Instrument) + list(INSERT vst3_categories 0 Instrument) + endif() + + if(Fx IN_LIST vst3_categories) + list(REMOVE_ITEM vst3_categories Fx) + list(INSERT vst3_categories 0 Fx) + endif() + endif() + + string(REGEX REPLACE ";" "|" result "${vst3_categories}") + set(${out_var} ${result} PARENT_SCOPE) +endfunction() + +function(_juce_configure_plugin_targets target) + _juce_set_output_name(${target} $_SharedCode) + + target_link_libraries(${target} PRIVATE juce::juce_audio_plugin_client) + + get_target_property(enabled_formats ${target} JUCE_FORMATS) + + set(active_formats) + _juce_get_platform_plugin_kinds(plugin_kinds) + + foreach(kind IN LISTS plugin_kinds) + if(kind IN_LIST enabled_formats) + list(APPEND active_formats "${kind}") + endif() + endforeach() + + if((VST IN_LIST active_formats) AND (NOT TARGET juce_vst2_sdk)) + message(FATAL_ERROR "Use juce_set_vst2_sdk_path to set up the VST sdk before adding VST targets") + endif() + + _juce_add_standard_defs(${target}) + _juce_add_plugin_definitions(${target} PRIVATE ${active_formats}) + + # The plugin wrappers need to know what other modules are available, especially + # juce_audio_utils and juce_gui_basics. We achieve this by searching for + # JUCE_MODULE_AVAILABLE_ private compile definitions, and reexporting them in + # the interface compile definitions. + _juce_get_module_definitions(${target} ON enabled_modules) + target_compile_definitions(${target} INTERFACE ${enabled_modules}) + + target_compile_definitions(${target} PRIVATE JUCE_SHARED_CODE=1) + + get_target_property(project_version_string ${target} JUCE_VERSION) + _juce_version_code(${project_version_string} project_version_hex) + + get_target_property(project_manufacturer_code ${target} JUCE_PLUGIN_MANUFACTURER_CODE) + get_target_property(project_plugin_code ${target} JUCE_PLUGIN_CODE) + + get_target_property(use_legacy_compatibility_plugin_code ${target} JUCE_USE_LEGACY_COMPATIBILITY_PLUGIN_CODE) + + if(use_legacy_compatibility_plugin_code) + set(project_manufacturer_code "proj") + endif() + + _juce_to_char_literal(${project_manufacturer_code} project_manufacturer_code "plugin manufacturer") + _juce_to_char_literal(${project_plugin_code} project_plugin_code "plugin") + + _juce_get_vst3_category_string(${target} vst3_category_string) + + target_compile_definitions(${target} PUBLIC + JUCE_STANDALONE_APPLICATION=JucePlugin_Build_Standalone + JucePlugin_IsSynth=$> + JucePlugin_ManufacturerCode=0x${project_manufacturer_code} + JucePlugin_Manufacturer="$" + JucePlugin_ManufacturerWebsite="$" + JucePlugin_ManufacturerEmail="$" + JucePlugin_PluginCode=0x${project_plugin_code} + JucePlugin_ProducesMidiOutput=$> + JucePlugin_IsMidiEffect=$> + JucePlugin_WantsMidiInput=$> + JucePlugin_EditorRequiresKeyboardFocus=$> + JucePlugin_Name="$" + JucePlugin_Desc="$" + JucePlugin_Version=${project_version_string} + JucePlugin_VersionString="${project_version_string}" + JucePlugin_VersionCode=${project_version_hex} + JucePlugin_VSTUniqueID=JucePlugin_PluginCode + JucePlugin_VSTCategory=$ + JucePlugin_Vst3Category="${vst3_category_string}" + JucePlugin_AUMainType=$ + JucePlugin_AUSubType=JucePlugin_PluginCode + JucePlugin_AUExportPrefix=$ + JucePlugin_AUExportPrefixQuoted="$" + JucePlugin_AUManufacturerCode=JucePlugin_ManufacturerCode + JucePlugin_CFBundleIdentifier=$ + JucePlugin_AAXIdentifier=$ + JucePlugin_AAXManufacturerCode=JucePlugin_ManufacturerCode + JucePlugin_AAXProductId=JucePlugin_PluginCode + JucePlugin_AAXCategory=$ + JucePlugin_AAXDisableBypass=$> + JucePlugin_AAXDisableMultiMono=$> + JucePlugin_VSTNumMidiInputs=$ + JucePlugin_VSTNumMidiOutputs=$ + JucePlugin_Enable_ARA=$> + JucePlugin_ARAFactoryID=$ + JucePlugin_ARADocumentArchiveID=$ + JucePlugin_ARACompatibleArchiveIDs=$ + JucePlugin_ARAContentTypes=$ + JucePlugin_ARATransformationFlags=$) + + set_target_properties(${target} PROPERTIES + POSITION_INDEPENDENT_CODE TRUE + INTERFACE_POSITION_INDEPENDENT_CODE TRUE + VISIBILITY_INLINES_HIDDEN TRUE + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden) + + # A convenience target for building all plugin variations at once + add_custom_target(${target}_All) + _juce_set_plugin_folder_property("${target}" "${target}_All") + + foreach(kind IN LISTS active_formats) + _juce_link_plugin_wrapper(${target} ${kind}) + + if(TARGET ${target}_${kind}) + list(APPEND active_plugin_targets ${target}_${kind}) + endif() + endforeach() + + set_target_properties(${target} PROPERTIES JUCE_ACTIVE_PLUGIN_TARGETS "${active_plugin_targets}") + + if(TARGET ${target}_Standalone) + _juce_configure_app_bundle(${target} ${target}_Standalone) + endif() + + if(TARGET ${target}_AAX) + _juce_init_bundled_aax_sdk() + target_link_libraries(${target}_AAX PRIVATE juce_aax_sdk) + endif() + + if((TARGET ${target}_AUv3) AND (TARGET ${target}_Standalone)) + add_dependencies(${target}_Standalone ${target}_AUv3) + set_target_properties(${target}_Standalone PROPERTIES + XCODE_EMBED_APP_EXTENSIONS ${target}_AUv3) + endif() + + get_target_property(wants_copy "${target}" JUCE_COPY_PLUGIN_AFTER_BUILD) + + if(wants_copy) + juce_enable_copy_plugin_step("${target}") + endif() +endfunction() + +# ================================================================================================== + +# Only sets result if the categories list contains valid entries +function(_juce_aax_categories_to_int categories_list result) + set(aax_category_strings + None + EQ + Dynamics + PitchShift + Reverb + Delay + Modulation + Harmonic + NoiseReduction + Dither + SoundField + HWGenerators + SWGenerators + WrappedPlugin + Effect + placeholder # These placeholders are because there's a gap between Effect + placeholder # and MIDIEffect in the definition of AAX_EPlugInCategory. + MIDIEffect) + + unset(aax_category_int) + + foreach(category_string IN LISTS categories_list) + string(REGEX REPLACE "^AAX_[eE]PlugInCategory_" "" category_string "${category_string}") + list(FIND aax_category_strings ${category_string} aax_index) + + if(aax_index GREATER_EQUAL 0) + if(aax_index EQUAL 0) + set(aax_category_bit 0) + else() + set(aax_category_bit "1 << (${aax_index} - 1)") + endif() + + if(NOT DEFINED aax_category_int) + set(aax_category_int 0) + endif() + + math(EXPR aax_category_int "${aax_category_int} | (${aax_category_bit})") + else() + message(WARNING "Unrecognised AAX category: '${category_string}'. See the `CMake API.md` entry for `AAX_CATEGORY` for valid values.") + endif() + endforeach() + + if(DEFINED aax_category_int) + set(${result} "${aax_category_int}" PARENT_SCOPE) + endif() +endfunction() + +# ================================================================================================== + +function(_juce_set_generic_property_if_not_set target property) + list(LENGTH ARGN num_extra_args) + + if(num_extra_args EQUAL 0) + return() + endif() + + set(existing_property) + get_target_property(existing_property ${target} ${property}) + + if(existing_property STREQUAL "existing_property-NOTFOUND") + set_target_properties(${target} PROPERTIES ${property} "${ARGN}") + endif() +endfunction() + +function(_juce_set_property_if_not_set target property) + _juce_set_generic_property_if_not_set(${target} JUCE_${property} ${ARGN}) +endfunction() + +function(_juce_make_valid_4cc out_var) + string(RANDOM LENGTH 1 ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ" head) + string(RANDOM LENGTH 3 ALPHABET "abcdefghijklmnopqrstuvwxyz" tail) + set(${out_var} "${head}${tail}" PARENT_SCOPE) +endfunction() + +# This function adds some default properties that plugin targets expect to be +# set, in order to generate the correct compile definitions. +function(_juce_set_fallback_properties target) + _juce_set_property_if_not_set(${target} PRODUCT_NAME ${target}) + + get_target_property(output_name ${target} JUCE_PRODUCT_NAME) + _juce_set_property_if_not_set(${target} DESCRIPTION "${output_name}") + _juce_set_property_if_not_set(${target} PLUGIN_NAME "${output_name}") + + get_target_property(real_company_name ${target} JUCE_COMPANY_NAME) + _juce_set_property_if_not_set(${target} BUNDLE_ID "com.${real_company_name}.${target}") + + get_target_property(applied_bundle_id ${target} JUCE_BUNDLE_ID) + + if("${applied_bundle_id}" MATCHES ".* .*") + message(WARNING "Target ${target} has JUCE_BUNDLE_ID '${applied_bundle_id}', which contains spaces. Use the BUNDLE_ID option to specify a valid ID.") + endif() + + _juce_set_property_if_not_set(${target} VERSION ${PROJECT_VERSION}) + + get_target_property(final_version ${target} JUCE_VERSION) + + if(NOT final_version) + message(FATAL_ERROR "Target ${target} must have its VERSION argument set, or must be part of a project with a PROJECT_VERSION") + endif() + + _juce_set_property_if_not_set(${target} BUILD_VERSION "${final_version}") + + get_target_property(custom_xcassets ${target} JUCE_CUSTOM_XCASSETS_FOLDER) + get_target_property(custom_storyboard ${target} JUCE_LAUNCH_STORYBOARD_FILE) + + set(needs_storyboard TRUE) + + if((NOT custom_storyboard) AND custom_xcassets AND (EXISTS "${custom_xcassets}/LaunchImage.launchimage")) + set(needs_storyboard FALSE) + endif() + + set_target_properties(${target} PROPERTIES JUCE_SHOULD_ADD_STORYBOARD ${needs_storyboard}) + + _juce_set_property_if_not_set(${target} IPHONE_SCREEN_ORIENTATIONS + UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight) + + _juce_set_property_if_not_set(${target} IPAD_SCREEN_ORIENTATIONS + UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight) + + _juce_set_property_if_not_set(${target} + LAUNCH_STORYBOARD_FILE "${JUCE_CMAKE_UTILS_DIR}/LaunchScreen.storyboard") + + _juce_set_property_if_not_set(${target} PLUGIN_MANUFACTURER_CODE "Manu") + + # The plugin code will change on each run, unless you specify one manually! + _juce_make_valid_4cc(random_code) + _juce_set_property_if_not_set(${target} PLUGIN_CODE ${random_code}) + + _juce_set_property_if_not_set(${target} IS_SYNTH FALSE) + _juce_set_property_if_not_set(${target} NEEDS_MIDI_INPUT FALSE) + _juce_set_property_if_not_set(${target} NEEDS_MIDI_OUTPUT FALSE) + _juce_set_property_if_not_set(${target} IS_MIDI_EFFECT FALSE) + _juce_set_property_if_not_set(${target} EDITOR_WANTS_KEYBOARD_FOCUS FALSE) + _juce_set_property_if_not_set(${target} DISABLE_AAX_BYPASS FALSE) + _juce_set_property_if_not_set(${target} DISABLE_AAX_MULTI_MONO FALSE) + + _juce_set_property_if_not_set(${target} PLUGINHOST_AU FALSE) + + get_target_property(bundle_id ${target} JUCE_BUNDLE_ID) + _juce_set_property_if_not_set(${target} AAX_IDENTIFIER ${bundle_id}) + + _juce_set_property_if_not_set(${target} VST_NUM_MIDI_INS 16) + _juce_set_property_if_not_set(${target} VST_NUM_MIDI_OUTS 16) + + _juce_set_property_if_not_set(${target} AU_SANDBOX_SAFE FALSE) + + _juce_set_property_if_not_set(${target} SUPPRESS_AU_PLIST_RESOURCE_USAGE FALSE) + + _juce_set_property_if_not_set(${target} HARDENED_RUNTIME_ENABLED FALSE) + _juce_set_property_if_not_set(${target} APP_SANDBOX_ENABLED FALSE) + _juce_set_property_if_not_set(${target} APP_SANDBOX_INHERIT FALSE) + + _juce_set_property_if_not_set(${target} VST3_AUTO_MANIFEST TRUE) + + get_target_property(is_synth ${target} JUCE_IS_SYNTH) + + # VST3_CATEGORIES + if(is_synth) + _juce_set_property_if_not_set(${target} VST3_CATEGORIES Instrument Synth) + else() + _juce_set_property_if_not_set(${target} VST3_CATEGORIES Fx) + endif() + + # VST2_CATEGORY + if(is_synth) + _juce_set_property_if_not_set(${target} VST2_CATEGORY kPlugCategSynth) + else() + _juce_set_property_if_not_set(${target} VST2_CATEGORY kPlugCategEffect) + endif() + + get_target_property(is_midi_effect ${target} JUCE_IS_MIDI_EFFECT) + get_target_property(needs_midi_input ${target} JUCE_NEEDS_MIDI_INPUT) + + # AU MAIN TYPE + if(is_midi_effect) + _juce_set_property_if_not_set(${target} AU_MAIN_TYPE kAudioUnitType_MIDIProcessor) + elseif(is_synth) + _juce_set_property_if_not_set(${target} AU_MAIN_TYPE kAudioUnitType_MusicDevice) + elseif(needs_midi_input) + _juce_set_property_if_not_set(${target} AU_MAIN_TYPE kAudioUnitType_MusicEffect) + else() + _juce_set_property_if_not_set(${target} AU_MAIN_TYPE kAudioUnitType_Effect) + endif() + + _juce_set_property_if_not_set(${target} TARGETED_DEVICE_FAMILY "1,2") + + set(au_category_codes + 'aufx' + 'aufc' + 'augn' + 'aumi' + 'aumx' + 'aumu' + 'aumf' + 'auol' + 'auou' + 'aupn') + + set(au_category_strings + kAudioUnitType_Effect + kAudioUnitType_FormatConverter + kAudioUnitType_Generator + kAudioUnitType_MIDIProcessor + kAudioUnitType_Mixer + kAudioUnitType_MusicDevice + kAudioUnitType_MusicEffect + kAudioUnitType_OfflineEffect + kAudioUnitType_Output + kAudioUnitType_Panner) + + # AU export prefix + string(MAKE_C_IDENTIFIER ${output_name} au_prefix) + set(au_prefix "${au_prefix}AU") + _juce_set_property_if_not_set(${target} AU_EXPORT_PREFIX ${au_prefix}) + + # Find appropriate AU category code + get_target_property(actual_au_category ${target} JUCE_AU_MAIN_TYPE) + list(FIND au_category_strings ${actual_au_category} au_index) + + if(au_index GREATER_EQUAL 0) + list(GET au_category_codes ${au_index} au_code_representation) + set_target_properties(${target} PROPERTIES JUCE_AU_MAIN_TYPE_CODE ${au_code_representation}) + endif() + + # AAX category + + if(is_midi_effect) + set(default_aax_category AAX_ePlugInCategory_MIDIEffect) + elseif(is_synth) + set(default_aax_category AAX_ePlugInCategory_SWGenerators) + else() + set(default_aax_category AAX_ePlugInCategory_None) + endif() + + _juce_set_property_if_not_set(${target} AAX_CATEGORY ${default_aax_category}) + + get_target_property(actual_aax_category ${target} JUCE_AAX_CATEGORY) + _juce_aax_categories_to_int("${actual_aax_category}" aax_category_int) + + if(DEFINED aax_category_int) + set_target_properties(${target} PROPERTIES JUCE_AAX_CATEGORY ${aax_category_int}) + endif() + + # Ensure this matches the Projucer implementation + get_target_property(company_website ${target} JUCE_COMPANY_WEBSITE) + get_target_property(plugin_name ${target} JUCE_PLUGIN_NAME) + string(MAKE_C_IDENTIFIER "${plugin_name}" plugin_name_sanitised) + _juce_set_property_if_not_set(${target} LV2URI "${company_website}/plugins/${plugin_name_sanitised}") + + # ARA configuration + # Analysis types + set(ara_analysis_type_strings + kARAContentTypeNotes + kARAContentTypeTempoEntries + kARAContentTypeBarSignatures + kARAContentTypeStaticTuning + kARAContentTypeKeySignatures + kARAContentTypeSheetChords) + + get_target_property(actual_ara_analysis_types ${target} JUCE_ARA_ANALYSIS_TYPES) + + set(ara_analysis_types_int "") + + foreach(category_string IN LISTS actual_ara_analysis_types) + list(FIND ara_analysis_type_strings ${category_string} ara_index) + + if(ara_index GREATER_EQUAL 0) + set(ara_analysis_types_bit "1 << ${ara_index}") + + if(ara_analysis_types_int STREQUAL "") + set(ara_analysis_types_int 0) + endif() + + math(EXPR ara_analysis_types_int "${ara_analysis_types_int} | (${ara_analysis_types_bit})") + endif() + endforeach() + + if(NOT ara_analysis_types_int STREQUAL "") + set_target_properties(${target} PROPERTIES JUCE_ARA_ANALYSIS_TYPES ${ara_analysis_types_int}) + endif() + + _juce_set_property_if_not_set(${target} ARA_ANALYSIS_TYPES 0) + + # Transformation flags + set(ara_transformation_flags_strings + kARAPlaybackTransformationNoChanges + kARAPlaybackTransformationTimestretch + kARAPlaybackTransformationTimestretchReflectingTempo + kARAPlaybackTransformationContentBasedFadeAtTail + kARAPlaybackTransformationContentBasedFadeAtHead) + + set(default_ara_transformation_flags kARAPlaybackTransformationNoChanges) + + _juce_set_property_if_not_set(${target} ARA_TRANSFORMATION_FLAGS ${default_ara_transformation_flags}) + + get_target_property(actual_ara_transformation_flags ${target} JUCE_ARA_TRANSFORMATION_FLAGS) + + set(ara_transformation_flags_int "") + + foreach(transformation_string IN LISTS actual_ara_transformation_flags) + list(FIND ara_transformation_flags_strings ${transformation_string} ara_transformation_index) + + if(ara_transformation_index GREATER_EQUAL 0) + if(ara_transformation_index EQUAL 0) + set(ara_transformation_bit 0) + else() + set(ara_transformation_bit "1 << (${ara_transformation_index} - 1)") + endif() + + if(ara_transformation_flags_int STREQUAL "") + set(ara_transformation_flags_int 0) + endif() + + math(EXPR ara_transformation_flags_int "${ara_transformation_flags_int} | (${ara_transformation_bit})") + endif() + endforeach() + + if(NOT ara_transformation_flags_int STREQUAL "") + set_target_properties(${target} PROPERTIES JUCE_ARA_TRANSFORMATION_FLAGS ${ara_transformation_flags_int}) + endif() + + _juce_set_property_if_not_set(${target} IS_ARA_EFFECT FALSE) + get_target_property(final_bundle_id ${target} JUCE_BUNDLE_ID) + _juce_set_property_if_not_set(${target} ARA_FACTORY_ID "\"${final_bundle_id}.arafactory.${final_version}\"") + _juce_set_property_if_not_set(${target} ARA_DOCUMENT_ARCHIVE_ID "\"${final_bundle_id}.aradocumentarchive.1\"") + _juce_set_property_if_not_set(${target} ARA_COMPATIBLE_ARCHIVE_IDS "\"\"") +endfunction() + +# ================================================================================================== + +function(_juce_initialise_target target) + set(one_value_args + VERSION + BUILD_VERSION + PRODUCT_NAME + PLIST_TO_MERGE + BUNDLE_ID + MICROPHONE_PERMISSION_ENABLED + MICROPHONE_PERMISSION_TEXT + CAMERA_PERMISSION_ENABLED + CAMERA_PERMISSION_TEXT + SEND_APPLE_EVENTS_PERMISSION_ENABLED + SEND_APPLE_EVENTS_PERMISSION_TEXT + BLUETOOTH_PERMISSION_ENABLED + BLUETOOTH_PERMISSION_TEXT + FILE_SHARING_ENABLED # iOS only + DOCUMENT_BROWSER_ENABLED # iOS only + LAUNCH_STORYBOARD_FILE # iOS only + APP_GROUPS_ENABLED # iOS only + ICLOUD_PERMISSIONS_ENABLED # iOS only + STATUS_BAR_HIDDEN # iOS only + BACKGROUND_AUDIO_ENABLED # iOS only + BACKGROUND_BLE_ENABLED # iOS only + CUSTOM_XCASSETS_FOLDER # iOS only + TARGETED_DEVICE_FAMILY # iOS only + REQUIRES_FULL_SCREEN # iOS only + ICON_BIG + ICON_SMALL + COMPANY_COPYRIGHT + COMPANY_NAME + COMPANY_WEBSITE + COMPANY_EMAIL + NEEDS_CURL # Set this true if you want to link curl on Linux + NEEDS_WEB_BROWSER # Set this true if you want to link webkit on Linux + NEEDS_WEBVIEW2 # Set this true if you want to link WebView2 statically on Windows + NEEDS_STORE_KIT # Set this true if you want in-app-purchases on Mac + PUSH_NOTIFICATIONS_ENABLED + NETWORK_MULTICAST_ENABLED + HARDENED_RUNTIME_ENABLED + APP_SANDBOX_ENABLED + APP_SANDBOX_INHERIT + VST3_AUTO_MANIFEST + + PLUGIN_NAME + PLUGIN_MANUFACTURER_CODE + PLUGIN_CODE + DESCRIPTION + IS_SYNTH + NEEDS_MIDI_INPUT + NEEDS_MIDI_OUTPUT + IS_MIDI_EFFECT + EDITOR_WANTS_KEYBOARD_FOCUS + DISABLE_AAX_BYPASS + DISABLE_AAX_MULTI_MONO + AAX_IDENTIFIER + VST_NUM_MIDI_INS + VST_NUM_MIDI_OUTS + VST2_CATEGORY + AU_MAIN_TYPE + AU_EXPORT_PREFIX + AU_SANDBOX_SAFE + SUPPRESS_AU_PLIST_RESOURCE_USAGE + PLUGINHOST_AU # Set this true if you want to host AU plugins + USE_LEGACY_COMPATIBILITY_PLUGIN_CODE + LV2URI + IS_ARA_EFFECT + ARA_FACTORY_ID + ARA_DOCUMENT_ARCHIVE_ID + + VST_COPY_DIR + VST3_COPY_DIR + AAX_COPY_DIR + AU_COPY_DIR + UNITY_COPY_DIR + COPY_PLUGIN_AFTER_BUILD) + + set(multi_value_args + FORMATS + VST3_CATEGORIES + HARDENED_RUNTIME_OPTIONS + APP_SANDBOX_OPTIONS + APP_SANDBOX_FILE_ACCESS_HOME_RO + APP_SANDBOX_FILE_ACCESS_HOME_RW + APP_SANDBOX_FILE_ACCESS_ABS_RO + APP_SANDBOX_FILE_ACCESS_ABS_RW + APP_SANDBOX_EXCEPTION_IOKIT + DOCUMENT_EXTENSIONS + AAX_CATEGORY + IPHONE_SCREEN_ORIENTATIONS # iOS only + IPAD_SCREEN_ORIENTATIONS # iOS only + APP_GROUP_IDS # iOS only + ARA_COMPATIBLE_ARCHIVE_IDS + ARA_ANALYSIS_TYPES + ARA_TRANSFORMATION_FLAGS) + + cmake_parse_arguments(JUCE_ARG "" "${one_value_args}" "${multi_value_args}" ${ARGN}) + + set(base_folder "${CMAKE_CURRENT_BINARY_DIR}/${target}_artefacts") + set(products_folder "${base_folder}/$") + set(juce_library_code "${base_folder}/JuceLibraryCode") + + set_target_properties(${target} PROPERTIES JUCE_GENERATED_SOURCES_DIRECTORY "${juce_library_code}") + + set_target_properties(${target} PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${products_folder}" + LIBRARY_OUTPUT_DIRECTORY "${products_folder}" + RUNTIME_OUTPUT_DIRECTORY "${products_folder}") + + if(JUCE_ARG_ICON_BIG) + _juce_make_absolute_and_check(JUCE_ARG_ICON_BIG) + endif() + + if(JUCE_ARG_ICON_SMALL) + _juce_make_absolute_and_check(JUCE_ARG_ICON_SMALL) + endif() + + set(inherited_properties + COMPANY_NAME + COMPANY_WEBSITE + COMPANY_EMAIL + COMPANY_COPYRIGHT + VST_COPY_DIR + VST3_COPY_DIR + AU_COPY_DIR + AAX_COPY_DIR + UNITY_COPY_DIR + COPY_PLUGIN_AFTER_BUILD) + + # Overwrite any properties that might be inherited + foreach(prop_string IN LISTS inherited_properties) + if(NOT ${JUCE_ARG_${prop_string}} STREQUAL "") + set_target_properties(${target} PROPERTIES JUCE_${prop_string} "${JUCE_ARG_${prop_string}}") + endif() + endforeach() + + # Add each of the function arguments as target properties, so that it's easier to + # extract them in other functions + foreach(arg_string IN LISTS one_value_args multi_value_args) + _juce_set_property_if_not_set(${target} ${arg_string} "${JUCE_ARG_${arg_string}}") + endforeach() + + _juce_set_fallback_properties(${target}) + + target_include_directories(${target} PRIVATE + $) + target_link_libraries(${target} PUBLIC $<$:juce_vst2_sdk>) + + get_target_property(is_pluginhost_au ${target} JUCE_PLUGINHOST_AU) + + if(is_pluginhost_au) + target_compile_definitions(${target} PUBLIC JUCE_PLUGINHOST_AU=1) + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS") + _juce_link_frameworks("${target}" PRIVATE CoreAudioKit) + endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + _juce_link_frameworks("${target}" PRIVATE AudioUnit) + endif() + endif() + + _juce_write_generate_time_info(${target}) + _juce_link_optional_libraries(${target}) + _juce_fixup_module_source_groups() +endfunction() + +# ================================================================================================== + +function(juce_add_console_app target) + # The _NO_RESOURCERC option is private, and is only intended for use when building juceaide. + # We can't add a resources.rc to juceaide because we need juceaide to generate the resources.rc! + cmake_parse_arguments(JUCE_ARG "_NO_RESOURCERC" "" "" ${ARGN}) + + add_executable(${target}) + target_compile_definitions(${target} PRIVATE JUCE_STANDALONE_APPLICATION=1) + + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + target_compile_definitions(${target} PRIVATE _CONSOLE=1) + endif() + + # When building for iOS, these properties will be read in order to populate + # a plist for the app. We probably don't care whether these values are sane; + # if we wanted to run on iOS, we'd use juce_gui_app instead. + # We clear these explicitly to avoid warnings when configuring with + # --warn-uninitialized + set_target_properties(${target} PROPERTIES + MACOSX_BUNDLE_BUNDLE_NAME "" + MACOSX_BUNDLE_BUNDLE_VERSION "" + MACOSX_BUNDLE_COPYRIGHT "" + MACOSX_BUNDLE_GUI_IDENTIFIER "" + MACOSX_BUNDLE_ICON_FILE "" + MACOSX_BUNDLE_INFO_STRING "" + MACOSX_BUNDLE_LONG_VERSION_STRING "" + MACOSX_BUNDLE_SHORT_VERSION_STRING "") + + _juce_initialise_target(${target} ${ARGN}) + + if(NOT JUCE_ARG__NO_RESOURCERC) + set_target_properties(${target} PROPERTIES JUCE_TARGET_KIND_STRING "ConsoleApp") + _juce_write_configure_time_info(${target}) + _juce_add_resources_rc(${target} ${target}) + _juce_add_xcode_entitlements(${target} ${target}) + endif() +endfunction() + +function(juce_add_gui_app target) + if(CMAKE_SYSTEM_NAME STREQUAL "Android") + add_library(${target} SHARED) + else() + add_executable(${target}) + endif() + + target_compile_definitions(${target} PRIVATE JUCE_STANDALONE_APPLICATION=1) + _juce_initialise_target(${target} ${ARGN}) + _juce_set_output_name(${target} $) + set_target_properties(${target} PROPERTIES JUCE_TARGET_KIND_STRING "App") + _juce_configure_bundle(${target} ${target}) + _juce_configure_app_bundle(${target} ${target}) + _juce_add_resources_rc(${target} ${target}) +endfunction() + +function(juce_add_plugin target) + add_library(${target} STATIC) + set_target_properties(${target} PROPERTIES JUCE_IS_PLUGIN TRUE) + _juce_initialise_target(${target} ${ARGN}) + _juce_configure_plugin_targets(${target}) +endfunction() + +# ================================================================================================== + +function(_juce_target_args_from_plugin_characteristics out_var) + set(pairs + "pluginIsSynth\;IS_SYNTH" + "pluginWantsMidiIn\;NEEDS_MIDI_INPUT" + "pluginProducesMidiOut\;NEEDS_MIDI_OUTPUT" + "pluginIsMidiEffectPlugin\;IS_MIDI_EFFECT" + "pluginEditorRequiresKeys\;EDITOR_WANTS_KEYBOARD_FOCUS") + + set(result) + + foreach(pair IN LISTS pairs) + list(GET pair 0 old_key) + + if("${old_key}" IN_LIST ARGN) + list(GET pair 1 new_key) + list(APPEND result ${new_key} TRUE) + endif() + endforeach() + + set(${out_var} ${result} PARENT_SCOPE) +endfunction() + +# ================================================================================================== + +function(_juce_get_pip_targets pip out_var) + set(test_targets "${pip}") + + _juce_get_all_plugin_kinds(plugin_kinds) + + foreach(plugin_kind IN LISTS plugin_kinds) + list(APPEND test_targets "${JUCE_PIP_NAME}_${plugin_kind}") + endforeach() + + set(${out_var} ${test_targets} PARENT_SCOPE) +endfunction() + +function(juce_add_pip header) + _juce_make_absolute(header) + + _juce_extract_metadata_block(JUCE_PIP_METADATA "${header}" metadata_dict) + + _juce_get_metadata("${metadata_dict}" name JUCE_PIP_NAME) + + if(NOT JUCE_PIP_NAME) + message(FATAL_ERROR "Error in '${header}': PIP headers must declare a `name` field") + endif() + + string(MAKE_C_IDENTIFIER "${JUCE_PIP_NAME}" pip_name_sanitised) + + if(NOT JUCE_PIP_NAME STREQUAL pip_name_sanitised) + message(FATAL_ERROR "Error in '${header}': PIP `name` value '${JUCE_PIP_NAME}' must be a valid C identifier") + endif() + + if(TARGET "${JUCE_PIP_NAME}") + # We already added a target with this name, let's try using the filename instead + get_filename_component(JUCE_PIP_NAME "${header}" NAME_WE) + endif() + + if(TARGET "${JUCE_PIP_NAME}") + message(FATAL_ERROR "Error in '${header}': Could not create a unique target name for PIP ${header}") + endif() + + _juce_get_metadata("${metadata_dict}" type pip_kind) + + if(NOT pip_kind) + message(FATAL_ERROR "Error in '${header}': PIP headers must declare a `type` field") + endif() + + _juce_get_metadata("${metadata_dict}" pluginCharacteristics pip_charateristics) + + _juce_target_args_from_plugin_characteristics(extra_target_args ${pip_charateristics}) + + list(APPEND extra_target_args + NEEDS_CURL TRUE + NEEDS_WEB_BROWSER TRUE) + + _juce_get_metadata("${metadata_dict}" moduleFlags pip_moduleflags) + + if("JUCE_IN_APP_PURCHASES=1" IN_LIST pip_moduleflags) + list(APPEND extra_target_args + BUNDLE_ID "com.rmsl.juceInAppPurchaseSample" + NEEDS_STORE_KIT TRUE) + endif() + + if("JUCE_PLUGINHOST_AU=1" IN_LIST pip_moduleflags) + list(APPEND extra_target_args PLUGINHOST_AU TRUE) + endif() + + if("JUCE_USE_WIN_WEBVIEW2_WITH_STATIC_LINKING=1" IN_LIST pip_moduleflags) + list(APPEND extra_target_args NEEDS_WEBVIEW2 TRUE) + endif() + + if(pip_kind STREQUAL "AudioProcessor") + _juce_get_metadata("${metadata_dict}" documentControllerClass JUCE_PIP_DOCUMENTCONTROLLER_CLASS) + + if(JUCE_PIP_DOCUMENTCONTROLLER_CLASS) + if(NOT TARGET juce_ara_sdk) + message(WARNING + "${header} specifies a documentControllerClass, but the ARA SDK could not be located. " + "Use juce_set_ara_sdk_path to specify the ARA SDK location. " + "This PIP will not be configured.") + endif() + + set(source_main "${JUCE_CMAKE_UTILS_DIR}/PIPAudioProcessorWithARA.cpp.in") + + juce_add_plugin(${JUCE_PIP_NAME} + FORMATS AU VST3 + IS_ARA_EFFECT TRUE + ${extra_target_args}) + else() + set(source_main "${JUCE_CMAKE_UTILS_DIR}/PIPAudioProcessor.cpp.in") + + set(formats AAX AU AUv3 LV2 Standalone Unity VST3) + + # We add VST2 targets too, if the user has set up those SDKs + if(TARGET juce_vst2_sdk) + list(APPEND formats VST) + endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND NOT JUCE_WINDOWS_HELPERS_CAN_RUN) + list(REMOVE_ITEM formats LV2) + endif() + + # Standalone plugins might want to access the mic + list(APPEND extra_target_args MICROPHONE_PERMISSION_ENABLED TRUE) + + juce_add_plugin(${JUCE_PIP_NAME} + FORMATS ${formats} + ${extra_target_args}) + endif() + elseif(pip_kind STREQUAL "Component") + set(source_main "${JUCE_CMAKE_UTILS_DIR}/PIPComponent.cpp.in") + juce_add_gui_app(${JUCE_PIP_NAME} ${extra_target_args}) + elseif(pip_kind STREQUAL "Console") + set(source_main "${JUCE_CMAKE_UTILS_DIR}/PIPConsole.cpp.in") + juce_add_console_app(${JUCE_PIP_NAME} ${extra_target_args}) + else() + message(FATAL_ERROR "Error in '${header}': PIP kind must be either AudioProcessor, Component, or Console") + endif() + + if(NOT ARGV1 STREQUAL "") + set("${ARGV1}" "${JUCE_PIP_NAME}" PARENT_SCOPE) + endif() + + # Generate Main.cpp + _juce_get_metadata("${metadata_dict}" mainClass JUCE_PIP_MAIN_CLASS) + get_target_property(juce_library_code ${JUCE_PIP_NAME} JUCE_GENERATED_SOURCES_DIRECTORY) + set(pip_main "${juce_library_code}/Main.cpp") + + set(JUCE_PIP_HEADER "${header}") + configure_file(${source_main} ${pip_main}) + target_sources(${JUCE_PIP_NAME} PRIVATE ${pip_main}) + + _juce_get_metadata("${metadata_dict}" dependencies pip_dependencies) + + juce_generate_juce_header(${JUCE_PIP_NAME}) + + foreach(module IN LISTS pip_dependencies) + if(module STREQUAL "") + continue() + endif() + + set(discovered_module) + + if(TARGET "${module}") + set(discovered_module "${module}") + else() + message(FATAL_ERROR "Error in '${header}': No such module: ${module}") + endif() + + target_link_libraries(${JUCE_PIP_NAME} PRIVATE ${discovered_module}) + endforeach() + + target_compile_definitions(${JUCE_PIP_NAME} + PRIVATE ${pip_moduleflags} + PUBLIC + JUCE_VST3_CAN_REPLACE_VST2=0) + + _juce_get_pip_targets(${JUCE_PIP_NAME} pip_targets) + + # This keeps the PIPs slightly better organised in the JUCE megaproject + if((DEFINED JUCE_SOURCE_DIR) AND (header MATCHES "^${JUCE_SOURCE_DIR}")) + file(RELATIVE_PATH folder "${JUCE_SOURCE_DIR}" "${header}") + get_filename_component(folder_parent "${folder}" DIRECTORY) + + foreach(target_name IN ITEMS ${pip_targets} ${JUCE_PIP_NAME}_All) + if(TARGET "${target_name}") + set_target_properties("${target_name}" PROPERTIES + FOLDER "${folder_parent}/${JUCE_PIP_NAME}") + endif() + endforeach() + endif() + + # We're building JUCE itself + if(DEFINED JUCE_SOURCE_DIR) + # PIPs need to know about the resources folder + target_compile_definitions(${JUCE_PIP_NAME} PRIVATE + PIP_JUCE_EXAMPLES_DIRECTORY_STRING="${JUCE_SOURCE_DIR}/examples") + + get_filename_component(pip_parent_path "${header}" DIRECTORY) + target_include_directories(${JUCE_PIP_NAME} PRIVATE "${pip_parent_path}") + + if((CMAKE_SYSTEM_NAME STREQUAL "iOS") AND (header MATCHES "^${JUCE_SOURCE_DIR}")) + foreach(target_name IN LISTS pip_targets) + if(TARGET "${target_name}") + juce_add_bundle_resources_directory("${target_name}" "${JUCE_SOURCE_DIR}/examples/Assets") + endif() + endforeach() + endif() + + if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) + target_compile_options(${JUCE_PIP_NAME} PRIVATE /bigobj) + endif() + endif() +endfunction() + +# ================================================================================================== + +function(juce_set_vst2_sdk_path path) + if(TARGET juce_vst2_sdk) + message(FATAL_ERROR "juce_set_vst2_sdk_path should only be called once") + endif() + + _juce_make_absolute(path) + + if(NOT EXISTS "${path}") + message(FATAL_ERROR "Could not find VST2 SDK at the specified path: ${path}") + endif() + + add_library(juce_vst2_sdk INTERFACE IMPORTED GLOBAL) + + _juce_disable_system_includes(juce_vst2_sdk) + # This is a bit of a hack, but we really need the VST2 paths to always follow the VST3 paths. + target_include_directories(juce_vst2_sdk INTERFACE + $ + "${path}") +endfunction() + +function(juce_set_vst3_sdk_path path) + if(TARGET juce_vst3_sdk) + message(FATAL_ERROR "juce_set_vst3_sdk_path should only be called once") + endif() + + _juce_make_absolute(path) + + if(NOT EXISTS "${path}") + message(FATAL_ERROR "Could not find VST3 SDK at the specified path: ${path}") + endif() + + add_library(juce_vst3_sdk INTERFACE IMPORTED GLOBAL) + + _juce_disable_system_includes(juce_vst3_sdk) + target_include_directories(juce_vst3_sdk INTERFACE "${path}") +endfunction() + +function(juce_set_ara_sdk_path path) + if(TARGET juce_ara_sdk) + message(FATAL_ERROR "juce_set_ara_sdk_path should only be called once") + endif() + + _juce_make_absolute(path) + + if(NOT EXISTS "${path}") + message(FATAL_ERROR "Could not find ARA SDK at the specified path: ${path}") + endif() + + add_library(juce_ara_sdk INTERFACE IMPORTED GLOBAL) + + _juce_disable_system_includes(juce_ara_sdk) + target_include_directories(juce_ara_sdk INTERFACE "${path}") +endfunction() + +# ================================================================================================== + +function(juce_disable_default_flags) + set(langs C CXX) + set(modes DEBUG RELEASE RELWITHDEBINFO MINSIZEREL) + + foreach(lang IN LISTS langs) + foreach(mode IN LISTS modes) + list(FILTER CMAKE_${lang}_FLAGS_${mode} INCLUDE REGEX "[/-]M[TD]d?") + set(CMAKE_${lang}_FLAGS_${mode} "${CMAKE_${lang}_FLAGS_${mode}}" PARENT_SCOPE) + endforeach() + endforeach() +endfunction() diff --git a/extras/Build/CMake/checkBundleSigning.cmake b/extras/Build/CMake/checkBundleSigning.cmake index 2dfdedce5d..7d6ed4e955 100644 --- a/extras/Build/CMake/checkBundleSigning.cmake +++ b/extras/Build/CMake/checkBundleSigning.cmake @@ -1,46 +1,46 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -find_program(JUCE_XCRUN xcrun) - -if(NOT JUCE_XCRUN) - return() -endif() - -execute_process( - COMMAND "${JUCE_XCRUN}" codesign --verify "${src}" - RESULT_VARIABLE result) - -if(result) - message(STATUS "Replacing invalid signature with ad-hoc signature") - execute_process(COMMAND "${JUCE_XCRUN}" codesign -f -s - "${src}") -endif() +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +find_program(JUCE_XCRUN xcrun) + +if(NOT JUCE_XCRUN) + return() +endif() + +execute_process( + COMMAND "${JUCE_XCRUN}" codesign --verify "${src}" + RESULT_VARIABLE result) + +if(result) + message(STATUS "Replacing invalid signature with ad-hoc signature") + execute_process(COMMAND "${JUCE_XCRUN}" codesign -f -s - "${src}") +endif() diff --git a/extras/Build/CMake/copyDir.cmake b/extras/Build/CMake/copyDir.cmake index c23f5d0f82..df5f18ca90 100644 --- a/extras/Build/CMake/copyDir.cmake +++ b/extras/Build/CMake/copyDir.cmake @@ -1,45 +1,45 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -if(NOT EXISTS "${src}") - message(STATUS "Unable to copy ${src} as it does not exist") - return() -endif() - -get_filename_component(name "${src}" NAME) - -if(EXISTS "${dest}/${name}") - message(STATUS "Destination ${dest}/${name} exists, overwriting") - file(REMOVE_RECURSE "${dest}/${name}") -endif() - -file(INSTALL ${src} DESTINATION ${dest} USE_SOURCE_PERMISSIONS) +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +if(NOT EXISTS "${src}") + message(STATUS "Unable to copy ${src} as it does not exist") + return() +endif() + +get_filename_component(name "${src}" NAME) + +if(EXISTS "${dest}/${name}") + message(STATUS "Destination ${dest}/${name} exists, overwriting") + file(REMOVE_RECURSE "${dest}/${name}") +endif() + +file(INSTALL ${src} DESTINATION ${dest} USE_SOURCE_PERMISSIONS) diff --git a/extras/Build/CMakeLists.txt b/extras/Build/CMakeLists.txt index 3df8ff3738..d7f5a2c26e 100644 --- a/extras/Build/CMakeLists.txt +++ b/extras/Build/CMakeLists.txt @@ -1,36 +1,35 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -juce_add_module(juce_build_tools ALIAS_NAMESPACE juce) - -add_subdirectory(juceaide) - +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +juce_add_module(juce_build_tools ALIAS_NAMESPACE juce) + +add_subdirectory(juceaide) diff --git a/extras/Build/juceaide/CMakeLists.txt b/extras/Build/juceaide/CMakeLists.txt index 651aa53c80..7ef20eddf1 100644 --- a/extras/Build/juceaide/CMakeLists.txt +++ b/extras/Build/juceaide/CMakeLists.txt @@ -1,176 +1,176 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -# The juceaide program generates intermediate build files including BinaryData sources, icons, and -# plists. To ensure that we always build it for the host system, and not for, say, a device or -# simulator if we're targeting iOS or Android, we reinvoke cmake here and build juceaide during the -# configuration stage of the outer project. - -if(JUCE_BUILD_HELPER_TOOLS) - # Build the tool for the current system - juce_add_console_app(juceaide _NO_RESOURCERC) - - target_sources(juceaide PRIVATE Main.cpp) - - target_compile_definitions(juceaide PRIVATE - JUCE_DISABLE_JUCE_VERSION_PRINTING=1 - JUCE_USE_CURL=0 - # This is a temporary workaround to allow builds to complete on Xcode 15. - # Add -Wl,-ld_classic to the OTHER_LDFLAGS build setting if you need to - # deploy to older versions of macOS. - JUCE_SILENCE_XCODE_15_LINKER_WARNING=1) - - target_link_libraries(juceaide PRIVATE - juce::juce_build_tools - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags) - - set_target_properties(juceaide PROPERTIES - MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - - export(TARGETS juceaide - NAMESPACE juce_tools:: - FILE "${JUCE_BINARY_DIR}/JUCEToolsExport.cmake") -else() - message(STATUS "Configuring juceaide") - - if(CMAKE_CROSSCOMPILING) - unset(ENV{ADDR2LINE}) - unset(ENV{AR}) - unset(ENV{ASM}) - unset(ENV{AS}) - unset(ENV{CC}) - unset(ENV{CPP}) - unset(ENV{CXXFILT}) - unset(ENV{CXX}) - unset(ENV{DLLTOOL}) - unset(ENV{DLLWRAP}) - unset(ENV{ELFEDIT}) - unset(ENV{GCC}) - unset(ENV{GCOV_DUMP}) - unset(ENV{GCOV_TOOL}) - unset(ENV{GCOV}) - unset(ENV{GPROF}) - unset(ENV{GXX}) - unset(ENV{LDFLAGS}) - unset(ENV{LD_BFD}) - unset(ENV{LD}) - unset(ENV{LTO_DUMP}) - unset(ENV{NM}) - unset(ENV{OBJCOPY}) - unset(ENV{OBJDUMP}) - unset(ENV{PKG_CONFIG_LIBDIR}) - unset(ENV{PKG_CONFIG}) - unset(ENV{RANLIB}) - unset(ENV{RC}) - unset(ENV{READELF}) - unset(ENV{SIZE}) - unset(ENV{STRINGS}) - unset(ENV{STRIP}) - unset(ENV{WIDL}) - unset(ENV{WINDMC}) - unset(ENV{WINDRES}) - - if(DEFINED ENV{PATH_ORIG}) - set(ENV{PATH} "$ENV{PATH_ORIG}") - endif() - endif() - - # Generator platform is only supported on specific generators - if(CMAKE_GENERATOR MATCHES "^Visual Studio.*$") - set(ENV{CMAKE_GENERATOR_PLATFORM} "${CMAKE_HOST_SYSTEM_PROCESSOR}") - endif() - - # Looks like we're bootstrapping, reinvoke CMake - execute_process(COMMAND "${CMAKE_COMMAND}" - "." - "-B${JUCE_BINARY_DIR}/tools" - "-G${CMAKE_GENERATOR}" - "-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}" - "-DCMAKE_BUILD_TYPE=Debug" - "-DJUCE_BUILD_HELPER_TOOLS=ON" - "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" - WORKING_DIRECTORY "${JUCE_SOURCE_DIR}" - OUTPUT_VARIABLE command_output - ERROR_VARIABLE command_output - RESULT_VARIABLE result_variable) - - if(result_variable) - message(FATAL_ERROR "Failed to configure juceaide\n${command_output}") - endif() - - message(STATUS "Building juceaide") - - execute_process(COMMAND "${CMAKE_COMMAND}" - --build "${JUCE_BINARY_DIR}/tools" - --config Debug - OUTPUT_VARIABLE command_output - ERROR_VARIABLE command_output - RESULT_VARIABLE result_variable) - - if(result_variable) - message(FATAL_ERROR "Failed to build juceaide\n${command_output}") - endif() - - message(STATUS "Exporting juceaide") - - # This will be generated by the recursive invocation of CMake (above) - include("${JUCE_BINARY_DIR}/tools/JUCEToolsExport.cmake") - - add_executable(juceaide IMPORTED GLOBAL) - get_target_property(imported_location juce_tools::juceaide IMPORTED_LOCATION_DEBUG) - set_target_properties(juceaide PROPERTIES IMPORTED_LOCATION "${imported_location}") - - add_executable(juce::juceaide ALIAS juceaide) - - set(JUCE_TOOL_INSTALL_DIR "bin/JUCE-${JUCE_VERSION}" CACHE STRING - "The location, relative to the install prefix, where juceaide will be installed") - - install(PROGRAMS "${imported_location}" DESTINATION "${JUCE_TOOL_INSTALL_DIR}") - - get_filename_component(binary_name "${imported_location}" NAME) - set(JUCE_JUCEAIDE_NAME "${binary_name}" CACHE INTERNAL "The name of the juceaide program") - - message(STATUS "Testing juceaide") - - execute_process(COMMAND "${imported_location}" version - RESULT_VARIABLE result_variable - OUTPUT_VARIABLE output - ERROR_VARIABLE output) - - if(result_variable) - message(FATAL_ERROR "Testing juceaide failed:\noutput: ${output}") - endif() - - message(STATUS "Finished setting up juceaide") -endif() +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +# The juceaide program generates intermediate build files including BinaryData sources, icons, and +# plists. To ensure that we always build it for the host system, and not for, say, a device or +# simulator if we're targeting iOS or Android, we reinvoke cmake here and build juceaide during the +# configuration stage of the outer project. + +if(JUCE_BUILD_HELPER_TOOLS) + # Build the tool for the current system + juce_add_console_app(juceaide _NO_RESOURCERC) + + target_sources(juceaide PRIVATE Main.cpp) + + target_compile_definitions(juceaide PRIVATE + JUCE_DISABLE_JUCE_VERSION_PRINTING=1 + JUCE_USE_CURL=0 + # This is a temporary workaround to allow builds to complete on Xcode 15. + # Add -Wl,-ld_classic to the OTHER_LDFLAGS build setting if you need to + # deploy to older versions of macOS. + JUCE_SILENCE_XCODE_15_LINKER_WARNING=1) + + target_link_libraries(juceaide PRIVATE + juce::juce_build_tools + juce::juce_recommended_config_flags + juce::juce_recommended_lto_flags + juce::juce_recommended_warning_flags) + + set_target_properties(juceaide PROPERTIES + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + + export(TARGETS juceaide + NAMESPACE juce_tools:: + FILE "${JUCE_BINARY_DIR}/JUCEToolsExport.cmake") +else() + message(STATUS "Configuring juceaide") + + if(CMAKE_CROSSCOMPILING) + unset(ENV{ADDR2LINE}) + unset(ENV{AR}) + unset(ENV{ASM}) + unset(ENV{AS}) + unset(ENV{CC}) + unset(ENV{CPP}) + unset(ENV{CXXFILT}) + unset(ENV{CXX}) + unset(ENV{DLLTOOL}) + unset(ENV{DLLWRAP}) + unset(ENV{ELFEDIT}) + unset(ENV{GCC}) + unset(ENV{GCOV_DUMP}) + unset(ENV{GCOV_TOOL}) + unset(ENV{GCOV}) + unset(ENV{GPROF}) + unset(ENV{GXX}) + unset(ENV{LDFLAGS}) + unset(ENV{LD_BFD}) + unset(ENV{LD}) + unset(ENV{LTO_DUMP}) + unset(ENV{NM}) + unset(ENV{OBJCOPY}) + unset(ENV{OBJDUMP}) + unset(ENV{PKG_CONFIG_LIBDIR}) + unset(ENV{PKG_CONFIG}) + unset(ENV{RANLIB}) + unset(ENV{RC}) + unset(ENV{READELF}) + unset(ENV{SIZE}) + unset(ENV{STRINGS}) + unset(ENV{STRIP}) + unset(ENV{WIDL}) + unset(ENV{WINDMC}) + unset(ENV{WINDRES}) + + if(DEFINED ENV{PATH_ORIG}) + set(ENV{PATH} "$ENV{PATH_ORIG}") + endif() + endif() + + # Generator platform is only supported on specific generators + if(CMAKE_GENERATOR MATCHES "^Visual Studio.*$") + set(ENV{CMAKE_GENERATOR_PLATFORM} "${CMAKE_HOST_SYSTEM_PROCESSOR}") + endif() + + # Looks like we're bootstrapping, reinvoke CMake + execute_process(COMMAND "${CMAKE_COMMAND}" + "." + "-B${JUCE_BINARY_DIR}/tools" + "-G${CMAKE_GENERATOR}" + "-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}" + "-DCMAKE_BUILD_TYPE=Debug" + "-DJUCE_BUILD_HELPER_TOOLS=ON" + "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" + WORKING_DIRECTORY "${JUCE_SOURCE_DIR}" + OUTPUT_VARIABLE command_output + ERROR_VARIABLE command_output + RESULT_VARIABLE result_variable) + + if(result_variable) + message(FATAL_ERROR "Failed to configure juceaide\n${command_output}") + endif() + + message(STATUS "Building juceaide") + + execute_process(COMMAND "${CMAKE_COMMAND}" + --build "${JUCE_BINARY_DIR}/tools" + --config Debug + OUTPUT_VARIABLE command_output + ERROR_VARIABLE command_output + RESULT_VARIABLE result_variable) + + if(result_variable) + message(FATAL_ERROR "Failed to build juceaide\n${command_output}") + endif() + + message(STATUS "Exporting juceaide") + + # This will be generated by the recursive invocation of CMake (above) + include("${JUCE_BINARY_DIR}/tools/JUCEToolsExport.cmake") + + add_executable(juceaide IMPORTED GLOBAL) + get_target_property(imported_location juce_tools::juceaide IMPORTED_LOCATION_DEBUG) + set_target_properties(juceaide PROPERTIES IMPORTED_LOCATION "${imported_location}") + + add_executable(juce::juceaide ALIAS juceaide) + + set(JUCE_TOOL_INSTALL_DIR "bin/JUCE-${JUCE_VERSION}" CACHE STRING + "The location, relative to the install prefix, where juceaide will be installed") + + install(PROGRAMS "${imported_location}" DESTINATION "${JUCE_TOOL_INSTALL_DIR}") + + get_filename_component(binary_name "${imported_location}" NAME) + set(JUCE_JUCEAIDE_NAME "${binary_name}" CACHE INTERNAL "The name of the juceaide program") + + message(STATUS "Testing juceaide") + + execute_process(COMMAND "${imported_location}" version + RESULT_VARIABLE result_variable + OUTPUT_VARIABLE output + ERROR_VARIABLE output) + + if(result_variable) + message(FATAL_ERROR "Testing juceaide failed:\noutput: ${output}") + endif() + + message(STATUS "Finished setting up juceaide") +endif() diff --git a/extras/CMakeLists.txt b/extras/CMakeLists.txt index 7f5555efce..21f61d0d18 100644 --- a/extras/CMakeLists.txt +++ b/extras/CMakeLists.txt @@ -1,39 +1,39 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -set(CMAKE_FOLDER extras) -add_subdirectory(AudioPerformanceTest) -add_subdirectory(AudioPluginHost) -add_subdirectory(BinaryBuilder) -add_subdirectory(NetworkGraphicsDemo) -add_subdirectory(Projucer) -add_subdirectory(UnitTestRunner) +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +set(CMAKE_FOLDER extras) +add_subdirectory(AudioPerformanceTest) +add_subdirectory(AudioPluginHost) +add_subdirectory(BinaryBuilder) +add_subdirectory(NetworkGraphicsDemo) +add_subdirectory(Projucer) +add_subdirectory(UnitTestRunner) diff --git a/extras/NetworkGraphicsDemo/CMakeLists.txt b/extras/NetworkGraphicsDemo/CMakeLists.txt index dc74461a31..e71c9d9147 100644 --- a/extras/NetworkGraphicsDemo/CMakeLists.txt +++ b/extras/NetworkGraphicsDemo/CMakeLists.txt @@ -1,49 +1,49 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -juce_add_gui_app(NetworkGraphicsDemo) - -juce_generate_juce_header(NetworkGraphicsDemo) - -target_sources(NetworkGraphicsDemo PRIVATE Source/Main.cpp) - -target_compile_definitions(NetworkGraphicsDemo PRIVATE - JUCE_USE_CURL=0 JUCE_WEB_BROWSER=0) - -target_link_libraries(NetworkGraphicsDemo PRIVATE - juce::juce_audio_utils - juce::juce_cryptography - juce::juce_opengl - juce::juce_osc - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags) +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +juce_add_gui_app(NetworkGraphicsDemo) + +juce_generate_juce_header(NetworkGraphicsDemo) + +target_sources(NetworkGraphicsDemo PRIVATE Source/Main.cpp) + +target_compile_definitions(NetworkGraphicsDemo PRIVATE + JUCE_USE_CURL=0 JUCE_WEB_BROWSER=0) + +target_link_libraries(NetworkGraphicsDemo PRIVATE + juce::juce_audio_utils + juce::juce_cryptography + juce::juce_opengl + juce::juce_osc + juce::juce_recommended_config_flags + juce::juce_recommended_lto_flags + juce::juce_recommended_warning_flags) diff --git a/extras/Projucer/CMakeLists.txt b/extras/Projucer/CMakeLists.txt index 502b8427cf..abef0e2308 100644 --- a/extras/Projucer/CMakeLists.txt +++ b/extras/Projucer/CMakeLists.txt @@ -1,162 +1,162 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -juce_add_gui_app(Projucer - BUNDLE_ID com.juce.theprojucer - ICON_BIG ${CMAKE_CURRENT_SOURCE_DIR}/Source/BinaryData/Icons/juce_icon.png - DOCUMENT_EXTENSIONS jucer - NEEDS_CURL TRUE - NEEDS_WEB_BROWSER TRUE) - -juce_generate_juce_header(Projucer) - -target_sources(Projucer PRIVATE - Source/Application/jucer_AutoUpdater.cpp - Source/Application/jucer_CommandLine.cpp - Source/Application/jucer_Main.cpp - Source/Application/jucer_MainWindow.cpp - Source/Application/StartPage/jucer_StartPageComponent.cpp - Source/Application/StartPage/jucer_NewProjectWizard.cpp - Source/CodeEditor/jucer_DocumentEditorComponent.cpp - Source/CodeEditor/jucer_OpenDocumentManager.cpp - Source/CodeEditor/jucer_SourceCodeEditor.cpp - Source/Project/Modules/jucer_Modules.cpp - Source/Project/UI/jucer_HeaderComponent.cpp - Source/Project/jucer_Project.cpp - Source/ProjectSaving/jucer_ProjectExporter.cpp - Source/ProjectSaving/jucer_ProjectSaver.cpp - Source/ProjectSaving/jucer_ResourceFile.cpp - Source/Settings/jucer_AppearanceSettings.cpp - Source/Settings/jucer_StoredSettings.cpp - Source/Utility/Helpers/jucer_CodeHelpers.cpp - Source/Utility/Helpers/jucer_FileHelpers.cpp - Source/Utility/Helpers/jucer_MiscUtilities.cpp - Source/Utility/Helpers/jucer_NewFileWizard.cpp - Source/Utility/Helpers/jucer_VersionInfo.cpp - Source/Utility/PIPs/jucer_PIPGenerator.cpp - Source/Utility/UI/jucer_Icons.cpp - Source/Utility/UI/jucer_JucerTreeViewBase.cpp - Source/Utility/UI/jucer_ProjucerLookAndFeel.cpp - Source/Utility/UI/jucer_SlidingPanelComponent.cpp) - -target_compile_definitions(Projucer PRIVATE - JUCE_ALLOW_STATIC_NULL_VARIABLES=0 - JUCE_LOAD_CURL_SYMBOLS_LAZILY=1 - JUCE_LOG_ASSERTIONS=1 - JUCE_STRICT_REFCOUNTEDPOINTER=1 - JUCE_USE_CURL=1 - JUCE_WEB_BROWSER=0 - # This is a temporary workaround to allow builds to complete on Xcode 15. - # Add -Wl,-ld_classic to the OTHER_LDFLAGS build setting if you need to - # deploy to older versions of macOS. - JUCE_SILENCE_XCODE_15_LINKER_WARNING=1) - -juce_add_binary_data(ProjucerData SOURCES - Source/BinaryData/Icons/background_logo.svg - Source/BinaryData/Icons/export_android.svg - Source/BinaryData/Icons/export_linux.svg - Source/BinaryData/Icons/export_visualStudio.svg - Source/BinaryData/Icons/export_xcode.svg - Source/BinaryData/Icons/juce_icon.png - Source/BinaryData/Icons/wizard_AnimatedApp.svg - Source/BinaryData/Icons/wizard_AudioApp.svg - Source/BinaryData/Icons/wizard_AudioPlugin.svg - Source/BinaryData/Icons/wizard_ConsoleApp.svg - Source/BinaryData/Icons/wizard_DLL.svg - Source/BinaryData/Icons/wizard_GUI.svg - Source/BinaryData/Icons/wizard_Highlight.svg - Source/BinaryData/Icons/wizard_OpenGL.svg - Source/BinaryData/Icons/wizard_Openfile.svg - Source/BinaryData/Icons/wizard_StaticLibrary.svg - Source/BinaryData/Templates/jucer_AnimatedComponentSimpleTemplate.h - Source/BinaryData/Templates/jucer_AnimatedComponentTemplate.cpp - Source/BinaryData/Templates/jucer_AnimatedComponentTemplate.h - Source/BinaryData/Templates/jucer_AudioComponentSimpleTemplate.h - Source/BinaryData/Templates/jucer_AudioComponentTemplate.cpp - Source/BinaryData/Templates/jucer_AudioComponentTemplate.h - Source/BinaryData/Templates/jucer_AudioPluginARADocumentControllerTemplate.cpp - Source/BinaryData/Templates/jucer_AudioPluginARADocumentControllerTemplate.h - Source/BinaryData/Templates/jucer_AudioPluginARAPlaybackRendererTemplate.cpp - Source/BinaryData/Templates/jucer_AudioPluginARAPlaybackRendererTemplate.h - Source/BinaryData/Templates/jucer_AudioPluginEditorTemplate.cpp - Source/BinaryData/Templates/jucer_AudioPluginEditorTemplate.h - Source/BinaryData/Templates/jucer_AudioPluginARAEditorTemplate.cpp - Source/BinaryData/Templates/jucer_AudioPluginARAEditorTemplate.h - Source/BinaryData/Templates/jucer_AudioPluginFilterTemplate.cpp - Source/BinaryData/Templates/jucer_AudioPluginFilterTemplate.h - Source/BinaryData/Templates/jucer_AudioPluginARAFilterTemplate.h - Source/BinaryData/Templates/jucer_ComponentTemplate.cpp - Source/BinaryData/Templates/jucer_ComponentTemplate.h - Source/BinaryData/Templates/jucer_ContentCompSimpleTemplate.h - Source/BinaryData/Templates/jucer_ContentCompTemplate.cpp - Source/BinaryData/Templates/jucer_ContentCompTemplate.h - Source/BinaryData/Templates/jucer_InlineComponentTemplate.h - Source/BinaryData/Templates/jucer_MainConsoleAppTemplate.cpp - Source/BinaryData/Templates/jucer_MainTemplate_NoWindow.cpp - Source/BinaryData/Templates/jucer_MainTemplate_Window.cpp - Source/BinaryData/Templates/jucer_NewComponentTemplate.cpp - Source/BinaryData/Templates/jucer_NewComponentTemplate.h - Source/BinaryData/Templates/jucer_NewCppFileTemplate.cpp - Source/BinaryData/Templates/jucer_NewCppFileTemplate.h - Source/BinaryData/Templates/jucer_NewInlineComponentTemplate.h - Source/BinaryData/Templates/jucer_OpenGLComponentSimpleTemplate.h - Source/BinaryData/Templates/jucer_OpenGLComponentTemplate.cpp - Source/BinaryData/Templates/jucer_OpenGLComponentTemplate.h - Source/BinaryData/Templates/jucer_PIPAudioProcessorTemplate.h - Source/BinaryData/Templates/jucer_PIPTemplate.h - Source/BinaryData/colourscheme_dark.xml - Source/BinaryData/colourscheme_light.xml - Source/BinaryData/gradle/LICENSE - Source/BinaryData/gradle/gradle-wrapper.jar - Source/BinaryData/gradle/gradlew - Source/BinaryData/gradle/gradlew.bat - Source/BinaryData/juce_SimpleBinaryBuilder.cpp - - ../Build/CMake/JuceLV2Defines.h.in - ../Build/CMake/LaunchScreen.storyboard - ../Build/CMake/PIPAudioProcessor.cpp.in - ../Build/CMake/PIPAudioProcessorWithARA.cpp.in - ../Build/CMake/PIPComponent.cpp.in - ../Build/CMake/PIPConsole.cpp.in - ../Build/CMake/RecentFilesMenuTemplate.nib - ../Build/CMake/UnityPluginGUIScript.cs.in - ../Build/CMake/juce_runtime_arch_detection.cpp - ../Build/CMake/juce_LinuxSubprocessHelper.cpp) - -target_link_libraries(Projucer PRIVATE - ProjucerData - juce::juce_build_tools - juce::juce_cryptography - juce::juce_gui_extra - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags) +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +juce_add_gui_app(Projucer + BUNDLE_ID com.juce.theprojucer + ICON_BIG ${CMAKE_CURRENT_SOURCE_DIR}/Source/BinaryData/Icons/juce_icon.png + DOCUMENT_EXTENSIONS jucer + NEEDS_CURL TRUE + NEEDS_WEB_BROWSER TRUE) + +juce_generate_juce_header(Projucer) + +target_sources(Projucer PRIVATE + Source/Application/jucer_AutoUpdater.cpp + Source/Application/jucer_CommandLine.cpp + Source/Application/jucer_Main.cpp + Source/Application/jucer_MainWindow.cpp + Source/Application/StartPage/jucer_StartPageComponent.cpp + Source/Application/StartPage/jucer_NewProjectWizard.cpp + Source/CodeEditor/jucer_DocumentEditorComponent.cpp + Source/CodeEditor/jucer_OpenDocumentManager.cpp + Source/CodeEditor/jucer_SourceCodeEditor.cpp + Source/Project/Modules/jucer_Modules.cpp + Source/Project/UI/jucer_HeaderComponent.cpp + Source/Project/jucer_Project.cpp + Source/ProjectSaving/jucer_ProjectExporter.cpp + Source/ProjectSaving/jucer_ProjectSaver.cpp + Source/ProjectSaving/jucer_ResourceFile.cpp + Source/Settings/jucer_AppearanceSettings.cpp + Source/Settings/jucer_StoredSettings.cpp + Source/Utility/Helpers/jucer_CodeHelpers.cpp + Source/Utility/Helpers/jucer_FileHelpers.cpp + Source/Utility/Helpers/jucer_MiscUtilities.cpp + Source/Utility/Helpers/jucer_NewFileWizard.cpp + Source/Utility/Helpers/jucer_VersionInfo.cpp + Source/Utility/PIPs/jucer_PIPGenerator.cpp + Source/Utility/UI/jucer_Icons.cpp + Source/Utility/UI/jucer_JucerTreeViewBase.cpp + Source/Utility/UI/jucer_ProjucerLookAndFeel.cpp + Source/Utility/UI/jucer_SlidingPanelComponent.cpp) + +target_compile_definitions(Projucer PRIVATE + JUCE_ALLOW_STATIC_NULL_VARIABLES=0 + JUCE_LOAD_CURL_SYMBOLS_LAZILY=1 + JUCE_LOG_ASSERTIONS=1 + JUCE_STRICT_REFCOUNTEDPOINTER=1 + JUCE_USE_CURL=1 + JUCE_WEB_BROWSER=0 + # This is a temporary workaround to allow builds to complete on Xcode 15. + # Add -Wl,-ld_classic to the OTHER_LDFLAGS build setting if you need to + # deploy to older versions of macOS. + JUCE_SILENCE_XCODE_15_LINKER_WARNING=1) + +juce_add_binary_data(ProjucerData SOURCES + Source/BinaryData/Icons/background_logo.svg + Source/BinaryData/Icons/export_android.svg + Source/BinaryData/Icons/export_linux.svg + Source/BinaryData/Icons/export_visualStudio.svg + Source/BinaryData/Icons/export_xcode.svg + Source/BinaryData/Icons/juce_icon.png + Source/BinaryData/Icons/wizard_AnimatedApp.svg + Source/BinaryData/Icons/wizard_AudioApp.svg + Source/BinaryData/Icons/wizard_AudioPlugin.svg + Source/BinaryData/Icons/wizard_ConsoleApp.svg + Source/BinaryData/Icons/wizard_DLL.svg + Source/BinaryData/Icons/wizard_GUI.svg + Source/BinaryData/Icons/wizard_Highlight.svg + Source/BinaryData/Icons/wizard_OpenGL.svg + Source/BinaryData/Icons/wizard_Openfile.svg + Source/BinaryData/Icons/wizard_StaticLibrary.svg + Source/BinaryData/Templates/jucer_AnimatedComponentSimpleTemplate.h + Source/BinaryData/Templates/jucer_AnimatedComponentTemplate.cpp + Source/BinaryData/Templates/jucer_AnimatedComponentTemplate.h + Source/BinaryData/Templates/jucer_AudioComponentSimpleTemplate.h + Source/BinaryData/Templates/jucer_AudioComponentTemplate.cpp + Source/BinaryData/Templates/jucer_AudioComponentTemplate.h + Source/BinaryData/Templates/jucer_AudioPluginARADocumentControllerTemplate.cpp + Source/BinaryData/Templates/jucer_AudioPluginARADocumentControllerTemplate.h + Source/BinaryData/Templates/jucer_AudioPluginARAPlaybackRendererTemplate.cpp + Source/BinaryData/Templates/jucer_AudioPluginARAPlaybackRendererTemplate.h + Source/BinaryData/Templates/jucer_AudioPluginEditorTemplate.cpp + Source/BinaryData/Templates/jucer_AudioPluginEditorTemplate.h + Source/BinaryData/Templates/jucer_AudioPluginARAEditorTemplate.cpp + Source/BinaryData/Templates/jucer_AudioPluginARAEditorTemplate.h + Source/BinaryData/Templates/jucer_AudioPluginFilterTemplate.cpp + Source/BinaryData/Templates/jucer_AudioPluginFilterTemplate.h + Source/BinaryData/Templates/jucer_AudioPluginARAFilterTemplate.h + Source/BinaryData/Templates/jucer_ComponentTemplate.cpp + Source/BinaryData/Templates/jucer_ComponentTemplate.h + Source/BinaryData/Templates/jucer_ContentCompSimpleTemplate.h + Source/BinaryData/Templates/jucer_ContentCompTemplate.cpp + Source/BinaryData/Templates/jucer_ContentCompTemplate.h + Source/BinaryData/Templates/jucer_InlineComponentTemplate.h + Source/BinaryData/Templates/jucer_MainConsoleAppTemplate.cpp + Source/BinaryData/Templates/jucer_MainTemplate_NoWindow.cpp + Source/BinaryData/Templates/jucer_MainTemplate_Window.cpp + Source/BinaryData/Templates/jucer_NewComponentTemplate.cpp + Source/BinaryData/Templates/jucer_NewComponentTemplate.h + Source/BinaryData/Templates/jucer_NewCppFileTemplate.cpp + Source/BinaryData/Templates/jucer_NewCppFileTemplate.h + Source/BinaryData/Templates/jucer_NewInlineComponentTemplate.h + Source/BinaryData/Templates/jucer_OpenGLComponentSimpleTemplate.h + Source/BinaryData/Templates/jucer_OpenGLComponentTemplate.cpp + Source/BinaryData/Templates/jucer_OpenGLComponentTemplate.h + Source/BinaryData/Templates/jucer_PIPAudioProcessorTemplate.h + Source/BinaryData/Templates/jucer_PIPTemplate.h + Source/BinaryData/colourscheme_dark.xml + Source/BinaryData/colourscheme_light.xml + Source/BinaryData/gradle/LICENSE + Source/BinaryData/gradle/gradle-wrapper.jar + Source/BinaryData/gradle/gradlew + Source/BinaryData/gradle/gradlew.bat + Source/BinaryData/juce_SimpleBinaryBuilder.cpp + + ../Build/CMake/JuceLV2Defines.h.in + ../Build/CMake/LaunchScreen.storyboard + ../Build/CMake/PIPAudioProcessor.cpp.in + ../Build/CMake/PIPAudioProcessorWithARA.cpp.in + ../Build/CMake/PIPComponent.cpp.in + ../Build/CMake/PIPConsole.cpp.in + ../Build/CMake/RecentFilesMenuTemplate.nib + ../Build/CMake/UnityPluginGUIScript.cs.in + ../Build/CMake/juce_runtime_arch_detection.cpp + ../Build/CMake/juce_LinuxSubprocessHelper.cpp) + +target_link_libraries(Projucer PRIVATE + ProjucerData + juce::juce_build_tools + juce::juce_cryptography + juce::juce_gui_extra + juce::juce_recommended_config_flags + juce::juce_recommended_lto_flags + juce::juce_recommended_warning_flags) diff --git a/extras/UnitTestRunner/CMakeLists.txt b/extras/UnitTestRunner/CMakeLists.txt index 8e3a91aa3d..00b6e24163 100644 --- a/extras/UnitTestRunner/CMakeLists.txt +++ b/extras/UnitTestRunner/CMakeLists.txt @@ -1,60 +1,60 @@ -# ============================================================================== -# -# This file is part of the JUCE framework. -# Copyright (c) Raw Material Software Limited -# -# JUCE is an open source framework subject to commercial or open source -# licensing. -# -# By downloading, installing, or using the JUCE framework, or combining the -# JUCE framework with any other source code, object code, content or any other -# copyrightable work, you agree to the terms of the JUCE End User Licence -# Agreement, and all incorporated terms including the JUCE Privacy Policy and -# the JUCE Website Terms of Service, as applicable, which will bind you. If you -# do not agree to the terms of these agreements, we will not license the JUCE -# framework to you, and you must discontinue the installation or download -# process and cease use of the JUCE framework. -# -# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ -# JUCE Privacy Policy: https://juce.com/juce-privacy-policy -# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ -# -# Or: -# -# You may also use this code under the terms of the AGPLv3: -# https://www.gnu.org/licenses/agpl-3.0.en.html -# -# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL -# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. -# -# ============================================================================== - -juce_add_console_app(UnitTestRunner) - -juce_generate_juce_header(UnitTestRunner) - -target_sources(UnitTestRunner PRIVATE Source/Main.cpp) - -target_compile_definitions(UnitTestRunner PRIVATE - JUCE_PLUGINHOST_LV2=1 - JUCE_PLUGINHOST_VST3=1 - JUCE_UNIT_TESTS=1 - JUCE_USE_CURL=0 - JUCE_WEB_BROWSER=0 - # This is a temporary workaround to allow builds to complete on Xcode 15. - # Add -Wl,-ld_classic to the OTHER_LDFLAGS build setting if you need to - # deploy to older versions of macOS. - JUCE_SILENCE_XCODE_15_LINKER_WARNING=1) - -target_link_libraries(UnitTestRunner PRIVATE - juce::juce_analytics - juce::juce_audio_utils - juce::juce_dsp - juce::juce_midi_ci - juce::juce_opengl - juce::juce_osc - juce::juce_product_unlocking - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags) +# ============================================================================== +# +# This file is part of the JUCE framework. +# Copyright (c) Raw Material Software Limited +# +# JUCE is an open source framework subject to commercial or open source +# licensing. +# +# By downloading, installing, or using the JUCE framework, or combining the +# JUCE framework with any other source code, object code, content or any other +# copyrightable work, you agree to the terms of the JUCE End User Licence +# Agreement, and all incorporated terms including the JUCE Privacy Policy and +# the JUCE Website Terms of Service, as applicable, which will bind you. If you +# do not agree to the terms of these agreements, we will not license the JUCE +# framework to you, and you must discontinue the installation or download +# process and cease use of the JUCE framework. +# +# JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ +# JUCE Privacy Policy: https://juce.com/juce-privacy-policy +# JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ +# +# Or: +# +# You may also use this code under the terms of the AGPLv3: +# https://www.gnu.org/licenses/agpl-3.0.en.html +# +# THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL +# WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. +# +# ============================================================================== + +juce_add_console_app(UnitTestRunner) + +juce_generate_juce_header(UnitTestRunner) + +target_sources(UnitTestRunner PRIVATE Source/Main.cpp) + +target_compile_definitions(UnitTestRunner PRIVATE + JUCE_PLUGINHOST_LV2=1 + JUCE_PLUGINHOST_VST3=1 + JUCE_UNIT_TESTS=1 + JUCE_USE_CURL=0 + JUCE_WEB_BROWSER=0 + # This is a temporary workaround to allow builds to complete on Xcode 15. + # Add -Wl,-ld_classic to the OTHER_LDFLAGS build setting if you need to + # deploy to older versions of macOS. + JUCE_SILENCE_XCODE_15_LINKER_WARNING=1) + +target_link_libraries(UnitTestRunner PRIVATE + juce::juce_analytics + juce::juce_audio_utils + juce::juce_dsp + juce::juce_midi_ci + juce::juce_opengl + juce::juce_osc + juce::juce_product_unlocking + juce::juce_recommended_config_flags + juce::juce_recommended_lto_flags + juce::juce_recommended_warning_flags)