diff --git a/ports/juce/0002-build-linux-find_packages.patch b/ports/juce/0002-build-linux-find_packages.patch deleted file mode 100644 index 5f168e5406..0000000000 --- a/ports/juce/0002-build-linux-find_packages.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/extras/Build/CMake/JUCEModuleSupport.cmake b/extras/Build/CMake/JUCEModuleSupport.cmake -index e18dd5e08..45cc9245f 100644 ---- a/extras/Build/CMake/JUCEModuleSupport.cmake -+++ b/extras/Build/CMake/JUCEModuleSupport.cmake -@@ -389,6 +389,30 @@ - if(TARGET juce::pkgconfig_${name}) - return() - endif() -+ -+ # The package that can be found via find_package instead of pkg-config -+ if("${name}" STREQUAL "freetype2") -+ find_package(Freetype REQUIRED) -+ add_library(juce::pkgconfig_${name} INTERFACE) -+ target_link_libraries(juce::pkgconfig_${name} INTERFACE Freetype::Freetype) -+ return() -+ elseif("${name}" STREQUAL "libcurl") -+ find_package(CURL REQUIRED) -+ add_library(juce::pkgconfig_${name} INTERFACE) -+ target_link_libraries(juce::pkgconfig_${name} INTERFACE CURL::libcurl) -+ return() -+ elseif("${name}" STREQUAL "alsa") -+ find_package(ALSA REQUIRED) -+ add_library(juce::pkgconfig_${name} INTERFACE) -+ target_link_libraries(juce::pkgconfig_${name} INTERFACE ALSA::ALSA) -+ return() -+ elseif("${name}" STREQUAL "gl") -+ find_package(OpenGL REQUIRED) -+ add_library(juce::pkgconfig_${name} INTERFACE) -+ target_link_libraries(juce::pkgconfig_${name} INTERFACE OpenGL::GL) -+ return() -+ endif() -+ - - find_package(PkgConfig REQUIRED) - pkg_check_modules(${name} ${JUCE_ARG_UNPARSED_ARGUMENTS}) --- -2.34.1 diff --git a/ports/juce/0003-build-forward-vcpkg-toolchain.patch b/ports/juce/0003-build-forward-vcpkg-toolchain.patch deleted file mode 100644 index 095a919340..0000000000 --- a/ports/juce/0003-build-forward-vcpkg-toolchain.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff --git a/extras/Build/juceaide/CMakeLists.txt b/extras/Build/juceaide/CMakeLists.txt -index 163f203cc..f4cdba7f7 100644 ---- a/extras/Build/juceaide/CMakeLists.txt -+++ b/extras/Build/juceaide/CMakeLists.txt -@@ -120,6 +120,25 @@ - "-DCMAKE_BUILD_TYPE=Debug" - "-DJUCE_BUILD_HELPER_TOOLS=ON" - "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" -+ # forward vcpkg flags -+ "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" -+ "-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}" -+ "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=${CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION}" -+ "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=${CMAKE_EXPORT_NO_PACKAGE_REGISTRY}" -+ "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=${CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY}" -+ "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=${CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY}" -+ "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP}" -+ "-DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE}" -+ "-DVCPKG_APPLOCAL_DEPS=${VCPKG_APPLOCAL_DEPS}" -+ "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" -+ "-DVCPKG_CRT_LINKAGE=${VCPKG_CRT_LINKAGE}" -+ "-DVCPKG_MANIFEST_INSTALL=${VCPKG_MANIFEST_INSTALL}" -+ "-DVCPKG_PLATFORM_TOOLSET=${VCPKG_PLATFORM_TOOLSET}" -+ "-DVCPKG_SET_CHARSET_FLAG=${VCPKG_SET_CHARSET_FLAG}" -+ "-DVCPKG_TARGET_ARCHITECTURE=${VCPKG_TARGET_ARCHITECTURE}" -+ "-DVCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}" -+ "-D_VCPKG_INSTALLED_DIR=${_VCPKG_INSTALLED_DIR}" -+ "-D_VCPKG_ROOT_DIR=${_VCPKG_ROOT_DIR}" - WORKING_DIRECTORY "${JUCE_SOURCE_DIR}" - OUTPUT_VARIABLE command_output - ERROR_VARIABLE command_output --- -2.34.1 diff --git a/ports/juce/0004-install-paths.patch b/ports/juce/0004-install-paths.patch index d9d2d8b293..c66511853a 100644 --- a/ports/juce/0004-install-paths.patch +++ b/ports/juce/0004-install-paths.patch @@ -19,31 +19,5 @@ index 4262a9852..a46b51f1a 100644 install(EXPORT VST3_HELPER NAMESPACE juce:: DESTINATION "${JUCE_INSTALL_DESTINATION}") endif() endif() -diff --git a/extras/Build/juceaide/CMakeLists.txt b/extras/Build/juceaide/CMakeLists.txt -index f4cdba7f7..fab57fdb4 100644 ---- a/extras/Build/juceaide/CMakeLists.txt -+++ b/extras/Build/juceaide/CMakeLists.txt -@@ -164,7 +164,7 @@ else() - - add_executable(juce::juceaide ALIAS juceaide) - -- set(JUCE_TOOL_INSTALL_DIR "bin/JUCE-${JUCE_VERSION}" CACHE STRING -+ set(JUCE_TOOL_INSTALL_DIR "tools/juce" CACHE STRING - "The location, relative to the install prefix, where juceaide will be installed") - - install(PROGRAMS "${imported_location}" DESTINATION "${JUCE_TOOL_INSTALL_DIR}") -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a46b51f1a..38f863a3e 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -137,7 +137,7 @@ - VERSION ${JUCE_VERSION} - COMPATIBILITY ExactVersion) - --set(JUCE_INSTALL_DESTINATION "lib/cmake/JUCE-${JUCE_VERSION}" CACHE STRING -+set(JUCE_INSTALL_DESTINATION "share/juce" 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") -- 2.34.1 diff --git a/ports/juce/devendor-oboe.diff b/ports/juce/devendor-oboe.diff new file mode 100644 index 0000000000..c45949a28f --- /dev/null +++ b/ports/juce/devendor-oboe.diff @@ -0,0 +1,17 @@ +diff --git a/extras/Build/CMake/JUCEModuleSupport.cmake b/extras/Build/CMake/JUCEModuleSupport.cmake +index afefe2d..2dd2ecf 100644 +--- a/extras/Build/CMake/JUCEModuleSupport.cmake ++++ b/extras/Build/CMake/JUCEModuleSupport.cmake +@@ -603,8 +603,10 @@ function(juce_add_module module_path) + 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) ++ find_path(JUCE_OBOE_INCLUDE_DIR NAMES oboe/Oboe.h REQUIRED) ++ target_include_directories(${module_name} INTERFACE "${JUCE_OBOE_INCLUDE_DIR}") ++ find_library(JUCE_OBOE_LIBRARY NAMES oboe REQUIRED) ++ target_link_libraries(${module_name} INTERFACE "${JUCE_OBOE_LIBRARY}" log OpenSLES) + endif() + + if((${module_name} STREQUAL "juce_opengl") AND (CMAKE_SYSTEM_NAME STREQUAL "Android")) diff --git a/ports/juce/gcc-has-builtin.diff b/ports/juce/gcc-has-builtin.diff new file mode 100644 index 0000000000..b403964cd9 --- /dev/null +++ b/ports/juce/gcc-has-builtin.diff @@ -0,0 +1,12 @@ +diff --git a/modules/juce_graphics/juce_graphics_Harfbuzz.cpp b/modules/juce_graphics/juce_graphics_Harfbuzz.cpp +index a491af9..44e934a 100644 +--- a/modules/juce_graphics/juce_graphics_Harfbuzz.cpp ++++ b/modules/juce_graphics/juce_graphics_Harfbuzz.cpp +@@ -84,7 +84,6 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations", + // -Wexpansion-to-defined on gcc 7. There's no way to turn that warning off + // locally, so we sidestep it. + #if ! defined(__has_builtin) && defined(__GNUC__) && __GNUC__ >= 5 +- #define __has_builtin(x) 1 + #endif + + #include diff --git a/ports/juce/install-extras.diff b/ports/juce/install-extras.diff new file mode 100644 index 0000000000..ae80aef526 --- /dev/null +++ b/ports/juce/install-extras.diff @@ -0,0 +1,19 @@ +diff --git a/extras/CMakeLists.txt b/extras/CMakeLists.txt +index 7f5555e..539f1cb 100644 +--- a/extras/CMakeLists.txt ++++ b/extras/CMakeLists.txt +@@ -35,5 +35,14 @@ add_subdirectory(AudioPerformanceTest) + add_subdirectory(AudioPluginHost) + add_subdirectory(BinaryBuilder) + add_subdirectory(NetworkGraphicsDemo) ++if(NOT ANDROID AND NOT IOS) + add_subdirectory(Projucer) ++endif() + add_subdirectory(UnitTestRunner) ++ ++file(GLOB tools RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*") ++foreach(tool IN LISTS tools) ++ if(TARGET "${tool}") ++ install(TARGETS "${tool}" DESTINATION "${JUCE_TOOL_INSTALL_DIR}") ++ endif() ++endforeach() diff --git a/ports/juce/juceaide.diff b/ports/juce/juceaide.diff new file mode 100644 index 0000000000..de39cd4d09 --- /dev/null +++ b/ports/juce/juceaide.diff @@ -0,0 +1,83 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 49d85c6..76209f5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,3 +1,5 @@ ++# Save cmake input for nested juceaide build ++get_cmake_property(vcpkg_input_vars CACHE_VARIABLES) + # ============================================================================== + # + # This file is part of the JUCE framework. +@@ -142,7 +144,10 @@ set(JUCE_INSTALL_DESTINATION "lib/cmake/JUCE-${JUCE_VERSION}" CACHE STRING + + 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}") ++set(JUCEAIDE_PATH "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/juce/${JUCE_JUCEAIDE_NAME}") ++if(WITH_JUCEAIDE) ++ set(JUCEAIDE_PATH "${WITH_JUCEAIDE}") ++endif() + 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 +diff --git a/extras/Build/juceaide/CMakeLists.txt b/extras/Build/juceaide/CMakeLists.txt +index 651aa53..9ff0fba 100644 +--- a/extras/Build/juceaide/CMakeLists.txt ++++ b/extras/Build/juceaide/CMakeLists.txt +@@ -55,12 +55,16 @@ if(JUCE_BUILD_HELPER_TOOLS) + 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") ++ ++elseif(WITH_JUCEAIDE) ++ add_executable(juceaide IMPORTED GLOBAL) ++ set_target_properties(juceaide PROPERTIES IMPORTED_LOCATION "${WITH_JUCEAIDE}") ++ add_executable(juce::juceaide ALIAS juceaide) ++ + else() + message(STATUS "Configuring juceaide") + +@@ -111,13 +115,18 @@ else() + set(ENV{CMAKE_GENERATOR_PLATFORM} "${CMAKE_HOST_SYSTEM_PROCESSOR}") + endif() + ++ set(options "") ++ list(REMOVE_ITEM vcpkg_input_vars "JUCE_BUILD_EXTRAS") ++ foreach(var IN LISTS vcpkg_input_vars) ++ list(APPEND options "-D${var}=$CACHE{${var}}") ++ endforeach() + # 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" ++ ${options} + "-DJUCE_BUILD_HELPER_TOOLS=ON" + "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" + WORKING_DIRECTORY "${JUCE_SOURCE_DIR}" +@@ -133,7 +142,7 @@ else() + + execute_process(COMMAND "${CMAKE_COMMAND}" + --build "${JUCE_BINARY_DIR}/tools" +- --config Debug ++ --target juceaide + OUTPUT_VARIABLE command_output + ERROR_VARIABLE command_output + RESULT_VARIABLE result_variable) +@@ -148,7 +157,7 @@ else() + include("${JUCE_BINARY_DIR}/tools/JUCEToolsExport.cmake") + + add_executable(juceaide IMPORTED GLOBAL) +- get_target_property(imported_location juce_tools::juceaide IMPORTED_LOCATION_DEBUG) ++ get_target_property(imported_location juce_tools::juceaide IMPORTED_LOCATION_RELEASE) + set_target_properties(juceaide PROPERTIES IMPORTED_LOCATION "${imported_location}") + + add_executable(juce::juceaide ALIAS juceaide) diff --git a/ports/juce/missing-modules.diff b/ports/juce/missing-modules.diff new file mode 100644 index 0000000000..8e2ea05fdf --- /dev/null +++ b/ports/juce/missing-modules.diff @@ -0,0 +1,20 @@ +diff --git a/extras/Build/CMake/JUCEConfig.cmake.in b/extras/Build/CMake/JUCEConfig.cmake.in +index c0c1eef..03a09ef 100644 +--- a/extras/Build/CMake/JUCEConfig.cmake.in ++++ b/extras/Build/CMake/JUCEConfig.cmake.in +@@ -39,6 +39,7 @@ include("@PACKAGE_UTILS_INSTALL_DIR@/JUCEUtils.cmake") + + set(_juce_modules + juce_analytics ++ juce_animation + juce_audio_basics + juce_audio_devices + juce_audio_formats +@@ -55,6 +56,7 @@ set(_juce_modules + juce_gui_basics + juce_gui_extra + juce_javascript ++ juce_midi_ci + juce_opengl + juce_osc + juce_product_unlocking diff --git a/ports/juce/portfile.cmake b/ports/juce/portfile.cmake index 77544ad6cf..dd7f250f5b 100644 --- a/ports/juce/portfile.cmake +++ b/ports/juce/portfile.cmake @@ -1,3 +1,5 @@ +set(VCPKG_BUILD_TYPE release) # no libraries + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO juce-framework/JUCE @@ -5,28 +7,54 @@ vcpkg_from_github( SHA512 c1cb2f315c2b3b9c534d21b16d31e641661fbb9ad55b29a0949c038cb69cce65d35c8c669a400e33fdcedd7fc5ef578a1eba787826d525402330551c4d240fe6 HEAD_REF master PATCHES - "0001-build-allow-setting-JUCE_PLUGINHOST_LADSPA.patch" - "0002-build-linux-find_packages.patch" - "0003-build-forward-vcpkg-toolchain.patch" - "0004-install-paths.patch" + 0001-build-allow-setting-JUCE_PLUGINHOST_LADSPA.patch + 0004-install-paths.patch + gcc-has-builtin.diff + devendor-oboe.diff + install-extras.diff + juceaide.diff + missing-modules.diff + prefer-cmake.diff + vcpkg-compile-definitions.diff ) +file(REMOVE_RECURSE "${SOURCE_PATH}/modules/juce_audio_devices/native/oboe") + +set(feature_compile_definitions + "curl" JUCE_USE_CURL + "fontconfig" JUCE_USE_FONTCONFIG + "freetype" JUCE_USE_FREETYPE + "jack" JUCE_JACK + "ladspa" JUCE_PLUGINHOST_LADSPA + "web-browser" JUCE_WEB_BROWSER + "xcursor" JUCE_USE_XCURSOR + "xinerama" JUCE_USE_XINERAMA + "xrandr" JUCE_USE_XRANDR + "xrender" JUCE_USE_XRENDER +) +set(enforced_definitions "") +while(feature_compile_definitions) + list(POP_FRONT feature_compile_definitions feature compile_definition) + if(NOT feature IN_LIST FEATURES) + # Enforce controlled absence of dependency + list(APPEND enforced_definitions "${compile_definition}=0") + endif() +endwhile() +list(JOIN enforced_definitions "\n " enforced_definitions) +file(WRITE "${SOURCE_PATH}/extras/Build/CMake/vcpkg-compile-definitions.cmake" " +function(vcpkg_juce_add_compile_definitions target) + target_compile_definitions(\${target} INTERFACE + ${enforced_definitions} + ) +endfunction() +") vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES "extras" JUCE_BUILD_EXTRAS "ladspa" JUCE_PLUGINHOST_LADSPA - "jack" JUCE_JACK - "curl" JUCE_USE_CURL - "freetype" JUCE_USE_FREETYPE - "xcursor" JUCE_USE_XCURSOR - "xinerama" JUCE_USE_XINERAMA - "xrandr" JUCE_USE_XRANDR - "xrender" JUCE_USE_XRENDER - "web-browser" JUCE_WEB_BROWSER - "opengl" JUCE_OPENGL ) # Based on https://github.com/juce-framework/JUCE/blob/master/docs/Linux%20Dependencies.md -if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") +if(VCPKG_TARGET_IS_LINUX) message("juce currently requires the following programs from the system package manager: libx11-dev libxcomposite-dev libxext-dev On Ubuntu derivatives: @@ -89,22 +117,21 @@ On Ubuntu derivatives: endif() endif() +if(VCPKG_CROSSCOMPILING) + # Constructed with CURRENT_INSTALLED_DIR, for vcpkg_cmake_config_fixup. + list(APPEND FEATURE_OPTIONS "-DWITH_JUCEAIDE=${CURRENT_INSTALLED_DIR}/../${HOST_TRIPLET}/tools/${PORT}/juceaide${VCPKG_HOST_EXECUTABLE_SUFFIX}") +endif() + vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - -DJUCE_ENABLE_MODULE_SOURCE_GROUPS=ON - ${FEATURE_OPTIONS} + -DJUCE_ENABLE_MODULE_SOURCE_GROUPS=ON + -DJUCE_INSTALL_DESTINATION=share/juce + -DJUCE_TOOL_INSTALL_DIR=bin + ${FEATURE_OPTIONS} MAYBE_UNUSED_VARIABLES + JUCE_TOOL_INSTALL_DIR JUCE_PLUGINHOST_LADSPA - JUCE_JACK - JUCE_OPENGL - JUCE_USE_CURL - JUCE_USE_FREETYPE - JUCE_USE_XCURSOR - JUCE_USE_XINERAMA - JUCE_USE_XRANDR - JUCE_USE_XRENDER - JUCE_WEB_BROWSER ) vcpkg_cmake_install() @@ -112,44 +139,36 @@ vcpkg_cmake_config_fixup() vcpkg_fixup_pkgconfig() vcpkg_copy_pdbs() -# Copy tools -file(GLOB JUCE_TOOLS "${CURRENT_PACKAGES_DIR}/bin/JUCE-${VERSION}/*") -foreach(JUCE_TOOL_PATH IN LISTS JUCE_TOOLS) - get_filename_component(JUCE_TOOL "${JUCE_TOOL_PATH}" NAME_WLE) - get_filename_component(JUCE_TOOL_DIR "${JUCE_TOOL_PATH}" DIRECTORY) - vcpkg_copy_tools(TOOL_NAMES ${JUCE_TOOL} SEARCH_DIR "${JUCE_TOOL_DIR}") -endforeach() - -# Copy extras tools -if(JUCE_BUILD_EXTRAS) - file(GLOB JUCE_EXTRA_TOOLS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/extras/*/*_artefacts/Release/*") - foreach(JUCE_EXTRA_TOOL_PATH IN LISTS JUCE_EXTRA_TOOLS) - get_filename_component(JUCE_EXTRA_TOOL "${JUCE_EXTRA_TOOL_PATH}" NAME_WLE) - get_filename_component(JUCE_EXTRA_TOOL_DIR "${JUCE_EXTRA_TOOL_PATH}" DIRECTORY) - vcpkg_copy_tools(TOOL_NAMES ${JUCE_EXTRA_TOOL} SEARCH_DIR "${JUCE_EXTRA_TOOL_DIR}") - endforeach() +file(GLOB icons "${CURRENT_PACKAGES_DIR}/bin/*.ico") +if(icons) + file(REMOVE_RECURSE ${icons}) endif() -# Copy JUCE modules including the cpp/cmake files -file(GLOB JUCE_MODULES_FOLDERS "${CURRENT_PACKAGES_DIR}/include/JUCE-${VERSION}/modules/*") -foreach(JUCE_MODULE_FOLDER IN LISTS JUCE_MODULES_FOLDERS) - file(COPY "${JUCE_MODULE_FOLDER}" DESTINATION "${CURRENT_PACKAGES_DIR}/include") +set(tool_names "") +file(GLOB tools "${CURRENT_PACKAGES_DIR}/bin/*") +set(name_component NAME_WE) +if(VCPKG_TARGET_EXECUTABLE_SUFFIX STREQUAL "") + set(name_component NAME) +endif() +foreach(tool IN LISTS tools) + get_filename_component(name "${tool}" ${name_component}) + list(APPEND tool_names "${name}") endforeach() +if(tool_names) + vcpkg_copy_tools(TOOL_NAMES ${tool_names} AUTO_CLEAN) +endif() -# Remove duplicate tools directories -file(REMOVE_RECURSE -"${CURRENT_PACKAGES_DIR}/bin" -"${CURRENT_PACKAGES_DIR}/debug/bin" -) +# Files not generated for Android or iOS +file(TOUCH "${CURRENT_PACKAGES_DIR}/share/juce/LV2_HELPER.cmake") +file(TOUCH "${CURRENT_PACKAGES_DIR}/share/juce/VST3_HELPER.cmake") -# Remove duplicate debug files -file(REMOVE_RECURSE -"${CURRENT_PACKAGES_DIR}/debug/" -) +# Catch libs which must be de-vendored, e.g. oboe. +# This is to avoid ownership conflicts. +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib" "${CURRENT_PACKAGES_DIR}/include/oboe") +if(EXISTS "${CURRENT_PACKAGES_DIR}/lib") + message(${Z_VCPKG_BACKCOMPAT_MESSAGE_LEVEL} "juce must not install files to ${CURRENT_PACKAGES_DIR}/lib.") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib") +endif() -# Copy license +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md") - -# Copy usage examples -file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" - DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/juce/prefer-cmake.diff b/ports/juce/prefer-cmake.diff new file mode 100644 index 0000000000..4395748427 --- /dev/null +++ b/ports/juce/prefer-cmake.diff @@ -0,0 +1,45 @@ +diff --git a/extras/Build/CMake/JUCEModuleSupport.cmake b/extras/Build/CMake/JUCEModuleSupport.cmake +index e89cc5d..afefe2d 100644 +--- a/extras/Build/CMake/JUCEModuleSupport.cmake ++++ b/extras/Build/CMake/JUCEModuleSupport.cmake +@@ -390,10 +390,40 @@ function(_juce_create_pkgconfig_target name) + return() + endif() + ++ # Prefer CMake over pkg-config ++ set(link_libs "") ++ if("alsa" IN_LIST JUCE_ARG_UNPARSED_ARGUMENTS) ++ list(REMOVE_ITEM JUCE_ARG_UNPARSED_ARGUMENTS "alsa") ++ find_package(ALSA REQUIRED) ++ list(APPEND link_libs ALSA::ALSA) ++ endif() ++ if("fontconfig" IN_LIST JUCE_ARG_UNPARSED_ARGUMENTS) ++ list(REMOVE_ITEM JUCE_ARG_UNPARSED_ARGUMENTS "fontconfig") ++ find_package(Fontconfig REQUIRED) ++ list(APPEND link_libs Fontconfig::Fontconfig) ++ endif() ++ if("freetype2" IN_LIST JUCE_ARG_UNPARSED_ARGUMENTS) ++ list(REMOVE_ITEM JUCE_ARG_UNPARSED_ARGUMENTS "freetype2") ++ find_package(Freetype REQUIRED) ++ list(APPEND link_libs Freetype::Freetype) ++ endif() ++ if("gl" IN_LIST JUCE_ARG_UNPARSED_ARGUMENTS) ++ list(REMOVE_ITEM JUCE_ARG_UNPARSED_ARGUMENTS "gl") ++ find_package(OpenGL REQUIRED) ++ list(APPEND link_libs OpenGL::GL) ++ endif() ++ if("libcurl" IN_LIST JUCE_ARG_UNPARSED_ARGUMENTS) ++ list(REMOVE_ITEM JUCE_ARG_UNPARSED_ARGUMENTS "libcurl") ++ find_package(CURL REQUIRED) ++ list(APPEND link_libs CURL::libcurl) ++ endif() ++ if(JUCE_ARG_UNPARSED_ARGUMENTS) + find_package(PkgConfig REQUIRED) + pkg_check_modules(${name} ${JUCE_ARG_UNPARSED_ARGUMENTS}) ++ endif() + + add_library(pkgconfig_${name} INTERFACE) ++ set_target_properties(pkgconfig_${name} PROPERTIES INTERFACE_LINK_LIBRARIES "${link_libs}") + add_library(juce::pkgconfig_${name} ALIAS pkgconfig_${name}) + install(TARGETS pkgconfig_${name} EXPORT JUCE) + diff --git a/ports/juce/vcpkg-compile-definitions.diff b/ports/juce/vcpkg-compile-definitions.diff new file mode 100644 index 0000000000..6ba0278568 --- /dev/null +++ b/ports/juce/vcpkg-compile-definitions.diff @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 76209f5..69dc639 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -167,6 +167,7 @@ install(FILES "${JUCE_BINARY_DIR}/JUCEConfigVersion.cmake" + "${JUCE_CMAKE_UTILS_DIR}/JUCECheckAtomic.cmake" + "${JUCE_CMAKE_UTILS_DIR}/JUCEHelperTargets.cmake" + "${JUCE_CMAKE_UTILS_DIR}/JUCEModuleSupport.cmake" ++ "${JUCE_CMAKE_UTILS_DIR}/vcpkg-compile-definitions.cmake" + "${JUCE_CMAKE_UTILS_DIR}/JUCEUtils.cmake" + "${JUCE_CMAKE_UTILS_DIR}/JuceLV2Defines.h.in" + "${JUCE_CMAKE_UTILS_DIR}/LaunchScreen.storyboard" +diff --git a/extras/Build/CMake/JUCEModuleSupport.cmake b/extras/Build/CMake/JUCEModuleSupport.cmake +index 2dd2ecf..635c50e 100644 +--- a/extras/Build/CMake/JUCEModuleSupport.cmake ++++ b/extras/Build/CMake/JUCEModuleSupport.cmake +@@ -96,8 +96,10 @@ endif() + + # ================================================================================================== + ++include("${CMAKE_CURRENT_LIST_DIR}/vcpkg-compile-definitions.cmake") + function(_juce_add_interface_library target) + add_library(${target} INTERFACE) ++ vcpkg_juce_add_compile_definitions(${target}) + target_sources(${target} INTERFACE ${ARGN}) + endfunction() + diff --git a/ports/juce/vcpkg.json b/ports/juce/vcpkg.json index 075715da89..14beb51c94 100644 --- a/ports/juce/vcpkg.json +++ b/ports/juce/vcpkg.json @@ -2,19 +2,25 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "juce", "version": "8.0.4", + "port-version": 1, "description": "Open-source cross-platform C++ application framework for desktop and mobile applications, including VST, VST3, AU, AUv3, AAX and LV2 audio plug-ins and plug-in hosts", "homepage": "https://juce.com", "license": null, - "supports": "!android & !uwp & !(windows & arm)", + "supports": "!uwp", "dependencies": [ { - "name": "alsa", - "platform": "linux" + "name": "juce", + "host": true, + "default-features": false, + "features": [ + "juceaide" + ] }, { - "name": "juce", - "host": true + "name": "oboe", + "platform": "android" }, + "opengl", { "name": "vcpkg-cmake", "host": true @@ -25,55 +31,129 @@ } ], "default-features": [ - "curl", - "freetype", - "jack", - "opengl", - "xcursor", - "xinerama", - "xrandr", - "xrender" + { + "name": "alsa", + "platform": "linux" + }, + { + "name": "curl", + "platform": "freebsd | linux | openbsd" + }, + { + "name": "fontconfig", + "platform": "freebsd | linux | openbsd" + }, + { + "name": "xcursor", + "platform": "linux" + }, + { + "name": "xinerama", + "platform": "linux" + }, + { + "name": "xrandr", + "platform": "linux" + }, + { + "name": "xrender", + "platform": "linux" + } ], "features": { - "curl": { - "description": "Enable CURL support", + "alsa": { + "description": "Enable ALSA support", "dependencies": [ - "curl" + "alsa" + ] + }, + "curl": { + "description": "Use CURL for network support", + "supports": "freebsd | linux | openbsd", + "dependencies": [ + { + "name": "curl", + "default-features": false + } ] }, "extras": { - "description": "Enable JUCE Extras such as Projucer, AudioPluginHost, BinaryBuilder." + "description": "Enable JUCE extras such as Projucer, AudioPluginHost, BinaryBuilder.", + "dependencies": [ + { + "name": "juce", + "default-features": false, + "features": [ + "freetype" + ] + }, + { + "name": "juce", + "default-features": false, + "features": [ + "alsa" + ], + "platform": "linux" + }, + { + "name": "juce", + "default-features": false, + "features": [ + "curl" + ], + "platform": "freebsd | linux | openbsd" + } + ] + }, + "fontconfig": { + "description": "Enable Fontconfig support", + "dependencies": [ + "fontconfig", + { + "name": "juce", + "default-features": false, + "features": [ + "freetype" + ] + } + ] }, "freetype": { "description": "Enable FreeType support", "dependencies": [ - { - "name": "fontconfig", - "platform": "linux" - }, "freetype" ] }, "jack": { "description": "Enable JACK audio support", + "dependencies": [ + "jack2" + ] + }, + "juceaide": { + "description": "Build the juceaide tool", + "supports": "native", "dependencies": [ { - "name": "jack2", - "platform": "linux" + "name": "juce", + "default-features": false, + "features": [ + "freetype" + ] } ] }, "ladspa": { "description": "Enable LADSPA plugin host support." }, - "opengl": { - "description": "Enable OpenGL support", - "dependencies": [ - "opengl" - ] - }, "web-browser": { - "description": "Enable WebBrowser support" + "description": "Enable WebBrowser support", + "dependencies": [ + { + "name": "webview2", + "platform": "windows" + } + ] }, "xcursor": { "description": "Enable XCursor support" @@ -81,28 +161,19 @@ "xinerama": { "description": "Enable Xinerama support", "dependencies": [ - { - "name": "libxinerama", - "platform": "linux" - } + "libxinerama" ] }, "xrandr": { "description": "Enable XRandR support", "dependencies": [ - { - "name": "libxrandr", - "platform": "linux" - } + "libxrandr" ] }, "xrender": { "description": "Enable XRender support", "dependencies": [ - { - "name": "libxrender", - "platform": "linux" - } + "libxrender" ] } } diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 1667291353..5a02df8825 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -496,6 +496,10 @@ jemalloc:x64-uwp=fail jinja2cpplight:arm-neon-android=fail jinja2cpplight:arm64-android=fail jinja2cpplight:x64-android=fail +# needs android-29 +juce:arm-neon-android=fail +juce:arm64-android=fail +juce:x64-android=fail kfr:x64-android=fail kfr:x64-uwp=fail # needs android-24 diff --git a/scripts/test_ports/vcpkg-ci-juce/portfile.cmake b/scripts/test_ports/vcpkg-ci-juce/portfile.cmake new file mode 100644 index 0000000000..c735c7aed7 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-juce/portfile.cmake @@ -0,0 +1,8 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DWITH_CURL=${VCPKG_TARGET_IS_LINUX}" +) +vcpkg_cmake_build() diff --git a/scripts/test_ports/vcpkg-ci-juce/project/CMakeLists.txt b/scripts/test_ports/vcpkg-ci-juce/project/CMakeLists.txt new file mode 100644 index 0000000000..259a88baf2 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-juce/project/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.29) +project(juce-test VERSION 1 LANGUAGES C CXX) + +set(CMAKE_CXX_STANDARD 11) + +option(WITH_CURL "Link curl") + +find_package(JUCE CONFIG REQUIRED) + +juce_add_console_app(core + PRODUCT_NAME "vcpkg-ci-juce" + NEEDS_CURL "${WITH_CURL}" +) +target_sources(core PRIVATE main.cpp) +target_link_libraries(core PRIVATE juce::juce_core) + +juce_add_console_app(everything + PRODUCT_NAME "vcpkg-ci-juce" + NEEDS_CURL "${WITH_CURL}" +) +target_sources(everything PRIVATE main.cpp) +file(GLOB all_modules RELATIVE "${JUCE_MODULES_DIR}" "${JUCE_MODULES_DIR}/*") +list(TRANSFORM all_modules PREPEND juce::) +target_link_libraries(everything PRIVATE ${all_modules}) +target_compile_definitions(everything PRIVATE JUCE_WEB_BROWSER=0) diff --git a/scripts/test_ports/vcpkg-ci-juce/project/main.cpp b/scripts/test_ports/vcpkg-ci-juce/project/main.cpp new file mode 100644 index 0000000000..d7f625de19 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-juce/project/main.cpp @@ -0,0 +1,7 @@ +#include + +int main() +{ + juce::Logger::writeToLog("vcpkg"); + return 0; +} diff --git a/scripts/test_ports/vcpkg-ci-juce/vcpkg.json b/scripts/test_ports/vcpkg-ci-juce/vcpkg.json new file mode 100644 index 0000000000..8033bb2962 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-juce/vcpkg.json @@ -0,0 +1,28 @@ +{ + "name": "vcpkg-ci-juce", + "version-string": "ci", + "description": "Validates juce", + "dependencies": [ + "juce", + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "extras" + ], + "features": { + "extras": { + "description": "Install juce[extras]", + "dependencies": [ + { + "name": "juce", + "features": [ + "extras" + ] + } + ] + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index 4cd2a31cf9..b1b562e2b8 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3910,7 +3910,7 @@ }, "juce": { "baseline": "8.0.4", - "port-version": 0 + "port-version": 1 }, "jwt-cpp": { "baseline": "0.7.0", diff --git a/versions/j-/juce.json b/versions/j-/juce.json index 54b3ac1cf0..1f164870d8 100644 --- a/versions/j-/juce.json +++ b/versions/j-/juce.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e35480f559031fb4b98bfa887ebf88291183a6ea", + "version": "8.0.4", + "port-version": 1 + }, { "git-tree": "4b39be2dc5a74f2fc8c2b5943eb0d8afd63f062e", "version": "8.0.4",