The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
7.5KB

  1. # ==============================================================================
  2. #
  3. # This file is part of the JUCE library.
  4. # Copyright (c) 2022 - Raw Material Software Limited
  5. #
  6. # JUCE is an open source library subject to commercial or open-source
  7. # licensing.
  8. #
  9. # By using JUCE, you agree to the terms of both the JUCE 7 End-User License
  10. # Agreement and JUCE Privacy Policy.
  11. #
  12. # End User License Agreement: www.juce.com/juce-7-licence
  13. # Privacy Policy: www.juce.com/juce-privacy-policy
  14. #
  15. # Or: You may also use this code under the terms of the GPL v3 (see
  16. # www.gnu.org/licenses).
  17. #
  18. # JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  19. # EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  20. # DISCLAIMED.
  21. #
  22. # ==============================================================================
  23. cmake_minimum_required(VERSION 3.22)
  24. project(JUCE VERSION 7.0.9 LANGUAGES C CXX)
  25. include(CMakeDependentOption)
  26. set_property(GLOBAL PROPERTY USE_FOLDERS YES)
  27. set(JUCE_MODULES_DIR "${JUCE_SOURCE_DIR}/modules" CACHE INTERNAL
  28. "The path to JUCE modules")
  29. # This option will disable most of the JUCE helper functions and tools. This option exists to
  30. # facilitate existing CMake builds which handle things like bundle creation, icons, plists, and
  31. # binary data independently of JUCE. This option is not recommended - use at your own risk!
  32. option(JUCE_MODULES_ONLY "Only configure the JUCE modules" OFF)
  33. include(extras/Build/CMake/JUCEModuleSupport.cmake)
  34. # This option controls whether dummy targets are added to the build, where these targets contain all
  35. # of the source files for each JUCE module. If you're planning to use an IDE and want to be able to
  36. # browse all of JUCE's source files, this may be useful. However, it will increase the size of
  37. # generated IDE projects and might slow down configuration a bit. If you enable this, you should
  38. # probably also add `set_property(GLOBAL PROPERTY USE_FOLDERS YES)` to your top level CMakeLists,
  39. # otherwise the module sources will be added directly to the top level of the project, instead of in
  40. # a nice 'Modules' subfolder.
  41. cmake_dependent_option(JUCE_ENABLE_MODULE_SOURCE_GROUPS
  42. "Show all module sources in IDE projects" OFF
  43. "NOT JUCE_MODULES_ONLY" OFF)
  44. add_subdirectory(modules)
  45. if(JUCE_MODULES_ONLY)
  46. return()
  47. endif()
  48. include(extras/Build/CMake/JUCEUtils.cmake)
  49. set_directory_properties(PROPERTIES
  50. JUCE_COMPANY_NAME "JUCE"
  51. JUCE_COMPANY_WEBSITE "https://juce.com"
  52. JUCE_COMPANY_EMAIL "info@juce.com"
  53. JUCE_COMPANY_COPYRIGHT "Copyright (c) 2020 - Raw Material Software Limited")
  54. option(JUCE_COPY_PLUGIN_AFTER_BUILD
  55. "Whether or not plugins should be installed to the system after building" OFF)
  56. set_property(GLOBAL PROPERTY JUCE_COPY_PLUGIN_AFTER_BUILD ${JUCE_COPY_PLUGIN_AFTER_BUILD})
  57. set(CMAKE_CXX_EXTENSIONS FALSE)
  58. juce_disable_default_flags()
  59. add_subdirectory(extras/Build)
  60. # If you want to build the JUCE examples with VST2/AAX/ARA support, you'll need to make the
  61. # VST2/AAX/ARA headers visible to the juce_audio_processors module. You can either set the paths on
  62. # the command line, (e.g. -DJUCE_GLOBAL_AAX_SDK_PATH=/path/to/sdk) if you're just building the JUCE
  63. # examples, or you can call the `juce_set_*_sdk_path` functions in your own CMakeLists after
  64. # importing JUCE.
  65. if(JUCE_GLOBAL_AAX_SDK_PATH)
  66. juce_set_aax_sdk_path("${JUCE_GLOBAL_AAX_SDK_PATH}")
  67. endif()
  68. if(JUCE_GLOBAL_VST2_SDK_PATH)
  69. juce_set_vst2_sdk_path("${JUCE_GLOBAL_VST2_SDK_PATH}")
  70. endif()
  71. # The ARA_SDK path should point to the "Umbrella installer" ARA_SDK directory.
  72. # The directory can be obtained by recursively cloning https://github.com/Celemony/ARA_SDK and
  73. # checking out the tag releases/2.1.0.
  74. if(JUCE_GLOBAL_ARA_SDK_PATH)
  75. juce_set_ara_sdk_path("${JUCE_GLOBAL_ARA_SDK_PATH}")
  76. endif()
  77. # We don't build anything other than the juceaide by default, because we want to keep configuration
  78. # speedy and the number of targets low. If you want to add targets for the extra projects and
  79. # example PIPs (there's a lot of them!), specify -DJUCE_BUILD_EXAMPLES=ON and/or
  80. # -DJUCE_BUILD_EXTRAS=ON when initially generating your build tree.
  81. option(JUCE_BUILD_EXTRAS "Add build targets for the Projucer and other tools" OFF)
  82. if(JUCE_BUILD_EXTRAS)
  83. add_subdirectory(extras)
  84. endif()
  85. option(JUCE_BUILD_EXAMPLES "Add build targets for the DemoRunner and PIPs" OFF)
  86. if(JUCE_BUILD_EXAMPLES)
  87. add_subdirectory(examples)
  88. endif()
  89. # ==================================================================================================
  90. # Install configuration
  91. include(CMakePackageConfigHelpers)
  92. write_basic_package_version_file("${JUCE_BINARY_DIR}/JUCEConfigVersion.cmake"
  93. VERSION ${JUCE_VERSION}
  94. COMPATIBILITY ExactVersion
  95. ${extra_version_arg})
  96. set(JUCE_INSTALL_DESTINATION "lib/cmake/JUCE-${JUCE_VERSION}" CACHE STRING
  97. "The location, relative to the install prefix, where the JUCE config file will be installed")
  98. set(JUCE_MODULE_PATH "include/JUCE-${JUCE_VERSION}/modules")
  99. set(UTILS_INSTALL_DIR "${JUCE_INSTALL_DESTINATION}")
  100. set(JUCEAIDE_PATH "${JUCE_TOOL_INSTALL_DIR}/${JUCE_JUCEAIDE_NAME}")
  101. configure_package_config_file("${JUCE_CMAKE_UTILS_DIR}/JUCEConfig.cmake.in"
  102. "${JUCE_BINARY_DIR}/JUCEConfig.cmake"
  103. PATH_VARS UTILS_INSTALL_DIR JUCEAIDE_PATH JUCE_MODULE_PATH
  104. INSTALL_DESTINATION "${JUCE_INSTALL_DESTINATION}")
  105. set(JUCE_MODULE_PATH "${JUCE_MODULES_DIR}")
  106. set(UTILS_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extras/Build/CMake")
  107. get_target_property(JUCEAIDE_PATH juceaide IMPORTED_LOCATION)
  108. configure_package_config_file("${JUCE_CMAKE_UTILS_DIR}/JUCEConfig.cmake.in"
  109. "${JUCE_BINARY_DIR}/JUCEExportConfig.cmake"
  110. PATH_VARS UTILS_INSTALL_DIR JUCEAIDE_PATH JUCE_MODULE_PATH
  111. INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
  112. INSTALL_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
  113. install(FILES "${JUCE_BINARY_DIR}/JUCEConfigVersion.cmake"
  114. "${JUCE_BINARY_DIR}/JUCEConfig.cmake"
  115. "${JUCE_CMAKE_UTILS_DIR}/JUCECheckAtomic.cmake"
  116. "${JUCE_CMAKE_UTILS_DIR}/JUCEHelperTargets.cmake"
  117. "${JUCE_CMAKE_UTILS_DIR}/JUCEModuleSupport.cmake"
  118. "${JUCE_CMAKE_UTILS_DIR}/JUCEUtils.cmake"
  119. "${JUCE_CMAKE_UTILS_DIR}/JuceLV2Defines.h.in"
  120. "${JUCE_CMAKE_UTILS_DIR}/LaunchScreen.storyboard"
  121. "${JUCE_CMAKE_UTILS_DIR}/PIPAudioProcessor.cpp.in"
  122. "${JUCE_CMAKE_UTILS_DIR}/PIPAudioProcessorWithARA.cpp.in"
  123. "${JUCE_CMAKE_UTILS_DIR}/PIPComponent.cpp.in"
  124. "${JUCE_CMAKE_UTILS_DIR}/PIPConsole.cpp.in"
  125. "${JUCE_CMAKE_UTILS_DIR}/RecentFilesMenuTemplate.nib"
  126. "${JUCE_CMAKE_UTILS_DIR}/UnityPluginGUIScript.cs.in"
  127. "${JUCE_CMAKE_UTILS_DIR}/checkBundleSigning.cmake"
  128. "${JUCE_CMAKE_UTILS_DIR}/copyDir.cmake"
  129. "${JUCE_CMAKE_UTILS_DIR}/juce_runtime_arch_detection.cpp"
  130. "${JUCE_CMAKE_UTILS_DIR}/juce_LinuxSubprocessHelper.cpp"
  131. DESTINATION "${JUCE_INSTALL_DESTINATION}")
  132. if(("${CMAKE_SOURCE_DIR}" STREQUAL "${JUCE_SOURCE_DIR}") AND (NOT JUCE_BUILD_HELPER_TOOLS))
  133. _juce_add_lv2_manifest_helper_target()
  134. if(TARGET juce_lv2_helper)
  135. install(TARGETS juce_lv2_helper EXPORT LV2_HELPER DESTINATION "bin/JUCE-${JUCE_VERSION}")
  136. install(EXPORT LV2_HELPER NAMESPACE juce:: DESTINATION "${JUCE_INSTALL_DESTINATION}")
  137. endif()
  138. _juce_add_vst3_manifest_helper_target()
  139. if(TARGET juce_vst3_helper)
  140. install(TARGETS juce_vst3_helper EXPORT VST3_HELPER DESTINATION "bin/JUCE-${JUCE_VERSION}")
  141. install(EXPORT VST3_HELPER NAMESPACE juce:: DESTINATION "${JUCE_INSTALL_DESTINATION}")
  142. endif()
  143. endif()