Skip to content

Commit

Permalink
[juce] Fix cross builds, cleanup (#42615)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt authored Dec 20, 2024
1 parent 8476a6d commit 4fcf123
Show file tree
Hide file tree
Showing 19 changed files with 490 additions and 195 deletions.
37 changes: 0 additions & 37 deletions ports/juce/0002-build-linux-find_packages.patch

This file was deleted.

32 changes: 0 additions & 32 deletions ports/juce/0003-build-forward-vcpkg-toolchain.patch

This file was deleted.

26 changes: 0 additions & 26 deletions ports/juce/0004-install-paths.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions ports/juce/devendor-oboe.diff
Original file line number Diff line number Diff line change
@@ -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"))
12 changes: 12 additions & 0 deletions ports/juce/gcc-has-builtin.diff
Original file line number Diff line number Diff line change
@@ -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 <utility>
19 changes: 19 additions & 0 deletions ports/juce/install-extras.diff
Original file line number Diff line number Diff line change
@@ -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()
83 changes: 83 additions & 0 deletions ports/juce/juceaide.diff
Original file line number Diff line number Diff line change
@@ -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$<$<CONFIG:Debug>: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)
20 changes: 20 additions & 0 deletions ports/juce/missing-modules.diff
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 4fcf123

Please sign in to comment.