From 4d99f7e3b02762e55644225e1a4e9bc27611a0bb Mon Sep 17 00:00:00 2001 From: tresf Date: Mon, 27 Aug 2018 00:51:32 -0400 Subject: [PATCH 01/20] Add Carla support for MacOS --- .gitignore | 1 + .gitmodules | 3 +++ CMakeLists.txt | 9 +++++++++ cmake/apple/install_apple.sh.in | 24 ++++++++++++++++++++++++ cmake/modules/BuildPlugin.cmake | 10 +++++++--- cmake/modules/CarlaPkgConfig.cmake | 22 ++++++++++++++++++++++ plugins/carlabase/CMakeLists.txt | 7 ++++++- plugins/carlabase/carla | 1 + 8 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 cmake/modules/CarlaPkgConfig.cmake create mode 160000 plugins/carlabase/carla diff --git a/.gitignore b/.gitignore index aa4f17ab84c..771eba60762 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /build /target .*.sw? +.DS_Store *~ /CMakeLists.txt.user /plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Controller/Makefile diff --git a/.gitmodules b/.gitmodules index 4abd7ae3e7c..3c0663dd62d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "src/3rdparty/rpmalloc/rpmalloc"] path = src/3rdparty/rpmalloc/rpmalloc url = https://github.com/rampantpixels/rpmalloc.git +[submodule "plugins/carlabase/carla"] + path = plugins/carlabase/carla + url = https://github.com/falktx/carla diff --git a/CMakeLists.txt b/CMakeLists.txt index da5be324a34..96fb927dfcc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,10 +229,19 @@ ENDIF(WANT_TAP) # check for CARLA IF(WANT_CARLA) + IF(LMMS_BUILD_APPLE) + # compile against submodule headers. TODO: move to homebrew + INCLUDE(CarlaPkgConfig) + ENDIF() PKG_CHECK_MODULES(CARLA carla-standalone>=1.9.5) IF(CARLA_FOUND) SET(LMMS_HAVE_CARLA TRUE) SET(STATUS_CARLA "OK") + IF(CARLA_SUBMODULE_SOURCE) + # Handle additional submodule include + MESSAGE("-- Using additional carla headers from ${CARLA_SUBMODULE_SOURCE}/source/backend") + SET(CARLA_INCLUDE_DIRS "${CARLA_INCLUDE_DIRS};${CARLA_SUBMODULE_SOURCE}/source/backend") + ENDIF() ELSE(CARLA_FOUND) SET(STATUS_CARLA "not found, please install the latest carla") ENDIF(CARLA_FOUND) diff --git a/cmake/apple/install_apple.sh.in b/cmake/apple/install_apple.sh.in index 057cf5445e3..5be64ad32fd 100644 --- a/cmake/apple/install_apple.sh.in +++ b/cmake/apple/install_apple.sh.in @@ -71,6 +71,30 @@ install_name_tool -change @rpath/libZynAddSubFxCore.dylib \ @loader_path/../../$zynfmk \ "$APP/Contents/$zynlib" +# Fix carla linking +libcarla="Carla.app/Contents/MacOS/libcarla_standalone2.dylib" + +# Assume LMMS.app and Carla.app are side-by-side +install_name_tool -change ../../bin/libcarla_standalone2.dylib \ + @executable_path/../../../$libcarla \ + "$APP/Contents/lib/lmms/libcarlabase.dylib" + +install_name_tool -change @rpath/libcarlabase.dylib \ + @loader_path/libcarlabase.dylib \ + "$APP/Contents/lib/lmms/libcarlapatchbay.so" + +install_name_tool -change ../../bin/libcarla_standalone2.dylib \ + @executable_path/../../../$libcarla \ + "$APP/Contents/lib/lmms/libcarlapatchbay.so" + +install_name_tool -change @rpath/libcarlabase.dylib \ + @loader_path/libcarlabase.dylib \ + "$APP/Contents/lib/lmms/libcarlarack.so" + +install_name_tool -change ../../bin/libcarla_standalone2.dylib \ + @executable_path/../../../$libcarla \ + "$APP/Contents/lib/lmms/libcarlarack.so" + # Link lmms binary _executables="${_executables} -executable=$APP/Contents/$zynbin" _executables="${_executables} -executable=$APP/Contents/$zynfmk" diff --git a/cmake/modules/BuildPlugin.cmake b/cmake/modules/BuildPlugin.cmake index f1dd95db6d3..bc994bbd0c0 100644 --- a/cmake/modules/BuildPlugin.cmake +++ b/cmake/modules/BuildPlugin.cmake @@ -1,7 +1,7 @@ # BuildPlugin.cmake - Copyright (c) 2008 Tobias Doerffel # # description: build LMMS-plugin -# usage: BUILD_PLUGIN( MOCFILES EMBEDDED_RESOURCES UICFILES LINK ) +# usage: BUILD_PLUGIN( MOCFILES EMBEDDED_RESOURCES UICFILES LINK ) MACRO(BUILD_PLUGIN PLUGIN_NAME) CMAKE_PARSE_ARGUMENTS(PLUGIN "" "" "MOCFILES;EMBEDDED_RESOURCES;UICFILES;LINK" ${ARGN}) @@ -57,7 +57,7 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) SET(QT_LIBRARIES "${QT_OVERRIDE_LIBRARIES}") ENDIF() - IF ("${PLUGIN_LINK}" STREQUAL "SHARED") + IF ("${PLUGIN_LINK}" STREQUAL "SHARED" OR "${PLUGIN_LINK}" STREQUAL "DYNAMIC") ADD_LIBRARY(${PLUGIN_NAME} SHARED ${PLUGIN_SOURCES} ${plugin_MOC_out}) ELSE () ADD_LIBRARY(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES} ${plugin_MOC_out}) @@ -73,7 +73,11 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) INSTALL(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION "${PLUGIN_DIR}") IF(LMMS_BUILD_APPLE) - SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-bundle_loader \"${CMAKE_BINARY_DIR}/lmms\"") + IF ("${PLUGIN_LINK}" STREQUAL "DYNAMIC") + SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + ELSE() + SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-bundle_loader \"${CMAKE_BINARY_DIR}/lmms\"") + ENDIF() ADD_DEPENDENCIES(${PLUGIN_NAME} lmms) ENDIF(LMMS_BUILD_APPLE) IF(LMMS_BUILD_WIN32) diff --git a/cmake/modules/CarlaPkgConfig.cmake b/cmake/modules/CarlaPkgConfig.cmake new file mode 100644 index 00000000000..737ae0759c3 --- /dev/null +++ b/cmake/modules/CarlaPkgConfig.cmake @@ -0,0 +1,22 @@ +# Makes carla submodule available to PKG_CHECK_MODULES +SET(CARLA_SUBMODULE_SOURCE ${CMAKE_SOURCE_DIR}/plugins/carlabase/carla) +SET(CARLA_PKGCONFIG_FILE ${CARLA_SUBMODULE_SOURCE}/data/carla-standalone.pc) + +# Look for carla-standalone pkg-config file +IF(EXISTS ${CARLA_PKGCONFIG_FILE}) + SET(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH};${CMAKE_BINARY_DIR}") + FILE(READ ${CARLA_PKGCONFIG_FILE} CARLA_PKGCONFIG_TEXT) + # add source/includes and source/backend to include location + STRING(REPLACE "X-INCLUDEDIR-X/carla" "${CARLA_SUBMODULE_SOURCE}/source/includes" CARLA_PKGCONFIG_TEXT "${CARLA_PKGCONFIG_TEXT}") + IF(LMMS_BUILD_APPLE) + # Remove linker flags + STRING(REPLACE "-Wl,rpath=\${libdir}" "" CARLA_PKGCONFIG_TEXT "${CARLA_PKGCONFIG_TEXT}") + # Add library path and prefix + STRING(REPLACE "X-PREFIX-X" "/Applications/Carla.app/Contents/MacOS" CARLA_PKGCONFIG_TEXT "${CARLA_PKGCONFIG_TEXT}") + STRING(REPLACE "X-LIBDIR-X/carla" "/Applications/Carla.app/Contents/MacOS" CARLA_PKGCONFIG_TEXT "${CARLA_PKGCONFIG_TEXT}") + ENDIF() + FILE(WRITE "${CMAKE_BINARY_DIR}/carla-standalone.pc" "${CARLA_PKGCONFIG_TEXT}") + SET(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_BINARY_DIR}") + MESSAGE("-- Using carla headers from ${CARLA_SUBMODULE_SOURCE}/source/includes") + MESSAGE("-- DEBUG:\n${CARLA_PKGCONFIG_TEXT}") +ENDIF() diff --git a/plugins/carlabase/CMakeLists.txt b/plugins/carlabase/CMakeLists.txt index 8fdde2ec51f..05990184275 100644 --- a/plugins/carlabase/CMakeLists.txt +++ b/plugins/carlabase/CMakeLists.txt @@ -1,9 +1,14 @@ if(LMMS_HAVE_CARLA) INCLUDE(BuildPlugin) INCLUDE_DIRECTORIES(${CARLA_INCLUDE_DIRS}) + IF(LMMS_BUILD_APPLE) + SET(CARLA_LINK_TYPE DYNAMIC) + ELSE() + SET(CARLA_LINK_TYPE SHARED) + ENDIF() LINK_DIRECTORIES(${CARLA_LIBRARY_DIRS}) LINK_LIBRARIES(${CARLA_LIBRARIES}) - BUILD_PLUGIN(carlabase carla.cpp carla.h MOCFILES carla.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png" LINK SHARED) + BUILD_PLUGIN(carlabase carla.cpp carla.h MOCFILES carla.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png" LINK ${CARLA_LINK_TYPE}) SET_TARGET_PROPERTIES(carlabase PROPERTIES SKIP_BUILD_RPATH TRUE BUILD_WITH_INSTALL_RPATH TRUE diff --git a/plugins/carlabase/carla b/plugins/carlabase/carla new file mode 160000 index 00000000000..265cd5d925b --- /dev/null +++ b/plugins/carlabase/carla @@ -0,0 +1 @@ +Subproject commit 265cd5d925b0cd504d1f4a5207f77a5b8f5ca800 From d4d86f10d51bdf8aa4efb6e07f5cd64eeaa23a6a Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Mon, 27 Aug 2018 01:23:27 -0400 Subject: [PATCH 02/20] Update .gitmodules --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 3c0663dd62d..bd19eae34fd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,4 +6,4 @@ url = https://github.com/rampantpixels/rpmalloc.git [submodule "plugins/carlabase/carla"] path = plugins/carlabase/carla - url = https://github.com/falktx/carla + url = https://github.com/falktx/carla.git From d2e3728ee5597a02eb848989a295c1b57c032947 Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Mon, 27 Aug 2018 01:26:55 -0400 Subject: [PATCH 03/20] Update BuildPlugin.cmake --- cmake/modules/BuildPlugin.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/modules/BuildPlugin.cmake b/cmake/modules/BuildPlugin.cmake index bc994bbd0c0..ac8297aa5ed 100644 --- a/cmake/modules/BuildPlugin.cmake +++ b/cmake/modules/BuildPlugin.cmake @@ -73,10 +73,10 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) INSTALL(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION "${PLUGIN_DIR}") IF(LMMS_BUILD_APPLE) - IF ("${PLUGIN_LINK}" STREQUAL "DYNAMIC") - SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + IF ("${PLUGIN_LINK}" STREQUAL "DYNAMIC") + SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") ELSE() - SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-bundle_loader \"${CMAKE_BINARY_DIR}/lmms\"") + SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-bundle_loader \"${CMAKE_BINARY_DIR}/lmms\"") ENDIF() ADD_DEPENDENCIES(${PLUGIN_NAME} lmms) ENDIF(LMMS_BUILD_APPLE) From 0c4ea23f42e721504d5f666711599383401cf637 Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Mon, 27 Aug 2018 01:29:20 -0400 Subject: [PATCH 04/20] Update CarlaPkgConfig.cmake --- cmake/modules/CarlaPkgConfig.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/modules/CarlaPkgConfig.cmake b/cmake/modules/CarlaPkgConfig.cmake index 737ae0759c3..4ec312a6eec 100644 --- a/cmake/modules/CarlaPkgConfig.cmake +++ b/cmake/modules/CarlaPkgConfig.cmake @@ -6,7 +6,7 @@ SET(CARLA_PKGCONFIG_FILE ${CARLA_SUBMODULE_SOURCE}/data/carla-standalone.pc) IF(EXISTS ${CARLA_PKGCONFIG_FILE}) SET(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH};${CMAKE_BINARY_DIR}") FILE(READ ${CARLA_PKGCONFIG_FILE} CARLA_PKGCONFIG_TEXT) - # add source/includes and source/backend to include location + # add source/includes to include location STRING(REPLACE "X-INCLUDEDIR-X/carla" "${CARLA_SUBMODULE_SOURCE}/source/includes" CARLA_PKGCONFIG_TEXT "${CARLA_PKGCONFIG_TEXT}") IF(LMMS_BUILD_APPLE) # Remove linker flags @@ -18,5 +18,4 @@ IF(EXISTS ${CARLA_PKGCONFIG_FILE}) FILE(WRITE "${CMAKE_BINARY_DIR}/carla-standalone.pc" "${CARLA_PKGCONFIG_TEXT}") SET(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_BINARY_DIR}") MESSAGE("-- Using carla headers from ${CARLA_SUBMODULE_SOURCE}/source/includes") - MESSAGE("-- DEBUG:\n${CARLA_PKGCONFIG_TEXT}") ENDIF() From 4720ed840612453f21d74761a92bdf9038748732 Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Mon, 27 Aug 2018 01:34:47 -0400 Subject: [PATCH 05/20] Update CarlaPkgConfig.cmake --- cmake/modules/CarlaPkgConfig.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/modules/CarlaPkgConfig.cmake b/cmake/modules/CarlaPkgConfig.cmake index 4ec312a6eec..5c1a8005ee5 100644 --- a/cmake/modules/CarlaPkgConfig.cmake +++ b/cmake/modules/CarlaPkgConfig.cmake @@ -4,7 +4,7 @@ SET(CARLA_PKGCONFIG_FILE ${CARLA_SUBMODULE_SOURCE}/data/carla-standalone.pc) # Look for carla-standalone pkg-config file IF(EXISTS ${CARLA_PKGCONFIG_FILE}) - SET(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH};${CMAKE_BINARY_DIR}") + SET(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_BINARY_DIR}") FILE(READ ${CARLA_PKGCONFIG_FILE} CARLA_PKGCONFIG_TEXT) # add source/includes to include location STRING(REPLACE "X-INCLUDEDIR-X/carla" "${CARLA_SUBMODULE_SOURCE}/source/includes" CARLA_PKGCONFIG_TEXT "${CARLA_PKGCONFIG_TEXT}") @@ -16,6 +16,5 @@ IF(EXISTS ${CARLA_PKGCONFIG_FILE}) STRING(REPLACE "X-LIBDIR-X/carla" "/Applications/Carla.app/Contents/MacOS" CARLA_PKGCONFIG_TEXT "${CARLA_PKGCONFIG_TEXT}") ENDIF() FILE(WRITE "${CMAKE_BINARY_DIR}/carla-standalone.pc" "${CARLA_PKGCONFIG_TEXT}") - SET(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_BINARY_DIR}") MESSAGE("-- Using carla headers from ${CARLA_SUBMODULE_SOURCE}/source/includes") ENDIF() From e5762293511e75efc3a7664fb813e40bf127e8cc Mon Sep 17 00:00:00 2001 From: tresf Date: Tue, 28 Aug 2018 02:28:18 -0400 Subject: [PATCH 06/20] Move carla to homebrew, remove submodule --- .gitmodules | 3 --- .travis/osx..install.sh | 1 + CMakeLists.txt | 9 --------- cmake/modules/BuildPlugin.cmake | 1 - cmake/modules/CarlaPkgConfig.cmake | 20 -------------------- plugins/carlabase/CMakeLists.txt | 5 +++++ plugins/carlabase/carla | 1 - 7 files changed, 6 insertions(+), 34 deletions(-) delete mode 100644 cmake/modules/CarlaPkgConfig.cmake delete mode 160000 plugins/carlabase/carla diff --git a/.gitmodules b/.gitmodules index bd19eae34fd..4abd7ae3e7c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,3 @@ [submodule "src/3rdparty/rpmalloc/rpmalloc"] path = src/3rdparty/rpmalloc/rpmalloc url = https://github.com/rampantpixels/rpmalloc.git -[submodule "plugins/carlabase/carla"] - path = plugins/carlabase/carla - url = https://github.com/falktx/carla.git diff --git a/.travis/osx..install.sh b/.travis/osx..install.sh index 45a6762d1f5..45053644eb9 100644 --- a/.travis/osx..install.sh +++ b/.travis/osx..install.sh @@ -9,5 +9,6 @@ else fi brew install $PACKAGES ccache +brew install https://gist.github.com/tresf/a8ffb8299227c51cf11aaf3929765264/raw/c151b761ed6ad7f37f717086188c075cc1836448/carla.rb sudo npm install -g appdmg diff --git a/CMakeLists.txt b/CMakeLists.txt index 96fb927dfcc..da5be324a34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,19 +229,10 @@ ENDIF(WANT_TAP) # check for CARLA IF(WANT_CARLA) - IF(LMMS_BUILD_APPLE) - # compile against submodule headers. TODO: move to homebrew - INCLUDE(CarlaPkgConfig) - ENDIF() PKG_CHECK_MODULES(CARLA carla-standalone>=1.9.5) IF(CARLA_FOUND) SET(LMMS_HAVE_CARLA TRUE) SET(STATUS_CARLA "OK") - IF(CARLA_SUBMODULE_SOURCE) - # Handle additional submodule include - MESSAGE("-- Using additional carla headers from ${CARLA_SUBMODULE_SOURCE}/source/backend") - SET(CARLA_INCLUDE_DIRS "${CARLA_INCLUDE_DIRS};${CARLA_SUBMODULE_SOURCE}/source/backend") - ENDIF() ELSE(CARLA_FOUND) SET(STATUS_CARLA "not found, please install the latest carla") ENDIF(CARLA_FOUND) diff --git a/cmake/modules/BuildPlugin.cmake b/cmake/modules/BuildPlugin.cmake index ac8297aa5ed..8fe73553008 100644 --- a/cmake/modules/BuildPlugin.cmake +++ b/cmake/modules/BuildPlugin.cmake @@ -87,4 +87,3 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ER_H} ${plugin_MOC_out}") ENDMACRO(BUILD_PLUGIN) - diff --git a/cmake/modules/CarlaPkgConfig.cmake b/cmake/modules/CarlaPkgConfig.cmake deleted file mode 100644 index 5c1a8005ee5..00000000000 --- a/cmake/modules/CarlaPkgConfig.cmake +++ /dev/null @@ -1,20 +0,0 @@ -# Makes carla submodule available to PKG_CHECK_MODULES -SET(CARLA_SUBMODULE_SOURCE ${CMAKE_SOURCE_DIR}/plugins/carlabase/carla) -SET(CARLA_PKGCONFIG_FILE ${CARLA_SUBMODULE_SOURCE}/data/carla-standalone.pc) - -# Look for carla-standalone pkg-config file -IF(EXISTS ${CARLA_PKGCONFIG_FILE}) - SET(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_BINARY_DIR}") - FILE(READ ${CARLA_PKGCONFIG_FILE} CARLA_PKGCONFIG_TEXT) - # add source/includes to include location - STRING(REPLACE "X-INCLUDEDIR-X/carla" "${CARLA_SUBMODULE_SOURCE}/source/includes" CARLA_PKGCONFIG_TEXT "${CARLA_PKGCONFIG_TEXT}") - IF(LMMS_BUILD_APPLE) - # Remove linker flags - STRING(REPLACE "-Wl,rpath=\${libdir}" "" CARLA_PKGCONFIG_TEXT "${CARLA_PKGCONFIG_TEXT}") - # Add library path and prefix - STRING(REPLACE "X-PREFIX-X" "/Applications/Carla.app/Contents/MacOS" CARLA_PKGCONFIG_TEXT "${CARLA_PKGCONFIG_TEXT}") - STRING(REPLACE "X-LIBDIR-X/carla" "/Applications/Carla.app/Contents/MacOS" CARLA_PKGCONFIG_TEXT "${CARLA_PKGCONFIG_TEXT}") - ENDIF() - FILE(WRITE "${CMAKE_BINARY_DIR}/carla-standalone.pc" "${CARLA_PKGCONFIG_TEXT}") - MESSAGE("-- Using carla headers from ${CARLA_SUBMODULE_SOURCE}/source/includes") -ENDIF() diff --git a/plugins/carlabase/CMakeLists.txt b/plugins/carlabase/CMakeLists.txt index 05990184275..ab506f1968b 100644 --- a/plugins/carlabase/CMakeLists.txt +++ b/plugins/carlabase/CMakeLists.txt @@ -1,3 +1,8 @@ +# For MacOS, use old RPATH install_name behavior +IF (CMAKE_MAJOR_VERSION GREATER 2 AND CMAKE_MINOR_VERSION GREATER 8) + CMAKE_POLICY(SET CMP0068 OLD) +ENDIF() + if(LMMS_HAVE_CARLA) INCLUDE(BuildPlugin) INCLUDE_DIRECTORIES(${CARLA_INCLUDE_DIRS}) diff --git a/plugins/carlabase/carla b/plugins/carlabase/carla deleted file mode 160000 index 265cd5d925b..00000000000 --- a/plugins/carlabase/carla +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 265cd5d925b0cd504d1f4a5207f77a5b8f5ca800 From 0a7740bed4887a9171129af53fb37fc9083cb361 Mon Sep 17 00:00:00 2001 From: tresf Date: Tue, 28 Aug 2018 02:39:45 -0400 Subject: [PATCH 07/20] Remove dylib from bundle --- cmake/apple/install_apple.sh.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/apple/install_apple.sh.in b/cmake/apple/install_apple.sh.in index 5be64ad32fd..03f60ad7280 100644 --- a/cmake/apple/install_apple.sh.in +++ b/cmake/apple/install_apple.sh.in @@ -114,6 +114,9 @@ done # Finalize .app macdeployqt "$APP" $_executables +# Carla should be installed separately +rm -f "$APP/Contents/Frameworks/libcarla_standalone2.dylib" + # Cleanup rm -rf "$APP/Contents/bin" echo -e "\nFinished.\n\n" From 8119462db1f67abfdc91250716fcf3018a2d49b0 Mon Sep 17 00:00:00 2001 From: tresf Date: Tue, 28 Aug 2018 02:56:54 -0400 Subject: [PATCH 08/20] Fix linking --- cmake/apple/install_apple.sh.in | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/cmake/apple/install_apple.sh.in b/cmake/apple/install_apple.sh.in index 03f60ad7280..0cb801d25ff 100644 --- a/cmake/apple/install_apple.sh.in +++ b/cmake/apple/install_apple.sh.in @@ -70,31 +70,16 @@ install_name_tool -change @rpath/libZynAddSubFxCore.dylib \ install_name_tool -change @rpath/libZynAddSubFxCore.dylib \ @loader_path/../../$zynfmk \ "$APP/Contents/$zynlib" - -# Fix carla linking -libcarla="Carla.app/Contents/MacOS/libcarla_standalone2.dylib" # Assume LMMS.app and Carla.app are side-by-side -install_name_tool -change ../../bin/libcarla_standalone2.dylib \ - @executable_path/../../../$libcarla \ - "$APP/Contents/lib/lmms/libcarlabase.dylib" - install_name_tool -change @rpath/libcarlabase.dylib \ @loader_path/libcarlabase.dylib \ "$APP/Contents/lib/lmms/libcarlapatchbay.so" -install_name_tool -change ../../bin/libcarla_standalone2.dylib \ - @executable_path/../../../$libcarla \ - "$APP/Contents/lib/lmms/libcarlapatchbay.so" - install_name_tool -change @rpath/libcarlabase.dylib \ @loader_path/libcarlabase.dylib \ "$APP/Contents/lib/lmms/libcarlarack.so" -install_name_tool -change ../../bin/libcarla_standalone2.dylib \ - @executable_path/../../../$libcarla \ - "$APP/Contents/lib/lmms/libcarlarack.so" - # Link lmms binary _executables="${_executables} -executable=$APP/Contents/$zynbin" _executables="${_executables} -executable=$APP/Contents/$zynfmk" @@ -115,8 +100,21 @@ done macdeployqt "$APP" $_executables # Carla should be installed separately +libcarla="Carla.app/Contents/MacOS/libcarla_standalone2.dylib" rm -f "$APP/Contents/Frameworks/libcarla_standalone2.dylib" +install_name_tool -change @loader_path/../../Frameworks/libcarla_standalone2.dylib \ + @executable_path/../../../$libcarla \ + "$APP/Contents/lib/lmms/libcarlabase.dylib" + +install_name_tool -change @loader_path/../../Frameworks/libcarla_standalone2.dylib \ + @executable_path/../../../$libcarla \ + "$APP/Contents/lib/lmms/libcarlarack.so" + +install_name_tool -change @loader_path/../../Frameworks/libcarla_standalone2.dylib \ + @executable_path/../../../$libcarla \ + "$APP/Contents/lib/lmms/libcarlapatchbay.so" + # Cleanup rm -rf "$APP/Contents/bin" echo -e "\nFinished.\n\n" From 5f4af04e34dba51ff66e907ec7e500088b312df7 Mon Sep 17 00:00:00 2001 From: tresf Date: Thu, 30 Aug 2018 10:34:29 -0400 Subject: [PATCH 09/20] Better commenting, fix cmake version detection --- .travis/osx..install.sh | 3 ++- cmake/apple/install_apple.sh.in | 23 ++++++++++++++++++++--- cmake/modules/BuildPlugin.cmake | 1 + plugins/carlabase/CMakeLists.txt | 7 +++++-- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/.travis/osx..install.sh b/.travis/osx..install.sh index 45053644eb9..af291f0fe6a 100644 --- a/.travis/osx..install.sh +++ b/.travis/osx..install.sh @@ -9,6 +9,7 @@ else fi brew install $PACKAGES ccache -brew install https://gist.github.com/tresf/a8ffb8299227c51cf11aaf3929765264/raw/c151b761ed6ad7f37f717086188c075cc1836448/carla.rb +# FIXME: Move "carla" to $PACKAGES once https://github.com/Homebrew/homebrew-core/pull/31560 is merged +brew install https://github.com/tresf/homebrew-core/blob/carla/Formula/carla.rb sudo npm install -g appdmg diff --git a/cmake/apple/install_apple.sh.in b/cmake/apple/install_apple.sh.in index 0cb801d25ff..3bf8fa6e6d4 100644 --- a/cmake/apple/install_apple.sh.in +++ b/cmake/apple/install_apple.sh.in @@ -70,8 +70,10 @@ install_name_tool -change @rpath/libZynAddSubFxCore.dylib \ install_name_tool -change @rpath/libZynAddSubFxCore.dylib \ @loader_path/../../$zynfmk \ "$APP/Contents/$zynlib" - -# Assume LMMS.app and Carla.app are side-by-side + +# Replace @rpath with @loader_path for Carla +# See also plugins/carlabase/CMakeLists.txt +# This MUST be done BEFORE calling macdeployqt install_name_tool -change @rpath/libcarlabase.dylib \ @loader_path/libcarlabase.dylib \ "$APP/Contents/lib/lmms/libcarlapatchbay.so" @@ -99,7 +101,22 @@ done # Finalize .app macdeployqt "$APP" $_executables -# Carla should be installed separately +# Carla is a standalone plugin. Remove library, look for it side-by-side LMMS.app +# This MUST be done AFTER calling macdeployqt +# +# For example: +# /Applications/LMMS.app +# Contents/lib/lmms/libcarlabase.dylib +# Contents/lib/lmms/libcarlarack.so +# Contents/lib/lmms/libcarlapatchbay.so +# /Applications/Carla.app +# Conents/MacOS/libcarla_standalone2.dylib +# +# Note: +# If upstream (@falktx) moves or renames this library +# pkg-config won't mind, but this section MUST be updated +# to reflect the new library path +# libcarla="Carla.app/Contents/MacOS/libcarla_standalone2.dylib" rm -f "$APP/Contents/Frameworks/libcarla_standalone2.dylib" diff --git a/cmake/modules/BuildPlugin.cmake b/cmake/modules/BuildPlugin.cmake index 8fe73553008..ac8297aa5ed 100644 --- a/cmake/modules/BuildPlugin.cmake +++ b/cmake/modules/BuildPlugin.cmake @@ -87,3 +87,4 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ER_H} ${plugin_MOC_out}") ENDMACRO(BUILD_PLUGIN) + diff --git a/plugins/carlabase/CMakeLists.txt b/plugins/carlabase/CMakeLists.txt index ab506f1968b..cfe36dae46d 100644 --- a/plugins/carlabase/CMakeLists.txt +++ b/plugins/carlabase/CMakeLists.txt @@ -1,5 +1,8 @@ -# For MacOS, use old RPATH install_name behavior -IF (CMAKE_MAJOR_VERSION GREATER 2 AND CMAKE_MINOR_VERSION GREATER 8) +# For MacOS, use "OLD" RPATH install_name behavior +# This can be changed to "NEW" safely if install_apple.sh.in +# is updated to relink libcarlabase.dylib. MacOS 10.8 uses +# cmake 3.9.6, so this can be done at any time. +IF(NOT CMAKE_VERSION VERSION_LESS 3.9) CMAKE_POLICY(SET CMP0068 OLD) ENDIF() From ece0c677859f70af790f847db7052f7b0f63326c Mon Sep 17 00:00:00 2001 From: tresf Date: Thu, 30 Aug 2018 10:35:36 -0400 Subject: [PATCH 10/20] Whitespace removal --- cmake/apple/install_apple.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/apple/install_apple.sh.in b/cmake/apple/install_apple.sh.in index 3bf8fa6e6d4..644d3b445e8 100644 --- a/cmake/apple/install_apple.sh.in +++ b/cmake/apple/install_apple.sh.in @@ -70,7 +70,7 @@ install_name_tool -change @rpath/libZynAddSubFxCore.dylib \ install_name_tool -change @rpath/libZynAddSubFxCore.dylib \ @loader_path/../../$zynfmk \ "$APP/Contents/$zynlib" - + # Replace @rpath with @loader_path for Carla # See also plugins/carlabase/CMakeLists.txt # This MUST be done BEFORE calling macdeployqt From f640b8eb53346474294158738ec18b2104442cc1 Mon Sep 17 00:00:00 2001 From: tresf Date: Thu, 30 Aug 2018 11:06:44 -0400 Subject: [PATCH 11/20] Simplify SHARED linking logic --- cmake/modules/BuildPlugin.cmake | 6 +++--- plugins/carlabase/CMakeLists.txt | 7 +------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/cmake/modules/BuildPlugin.cmake b/cmake/modules/BuildPlugin.cmake index ac8297aa5ed..25cca92afbc 100644 --- a/cmake/modules/BuildPlugin.cmake +++ b/cmake/modules/BuildPlugin.cmake @@ -1,7 +1,7 @@ # BuildPlugin.cmake - Copyright (c) 2008 Tobias Doerffel # # description: build LMMS-plugin -# usage: BUILD_PLUGIN( MOCFILES EMBEDDED_RESOURCES UICFILES LINK ) +# usage: BUILD_PLUGIN( MOCFILES EMBEDDED_RESOURCES UICFILES LINK ) MACRO(BUILD_PLUGIN PLUGIN_NAME) CMAKE_PARSE_ARGUMENTS(PLUGIN "" "" "MOCFILES;EMBEDDED_RESOURCES;UICFILES;LINK" ${ARGN}) @@ -57,7 +57,7 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) SET(QT_LIBRARIES "${QT_OVERRIDE_LIBRARIES}") ENDIF() - IF ("${PLUGIN_LINK}" STREQUAL "SHARED" OR "${PLUGIN_LINK}" STREQUAL "DYNAMIC") + IF ("${PLUGIN_LINK}" STREQUAL "SHARED") ADD_LIBRARY(${PLUGIN_NAME} SHARED ${PLUGIN_SOURCES} ${plugin_MOC_out}) ELSE () ADD_LIBRARY(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES} ${plugin_MOC_out}) @@ -73,7 +73,7 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) INSTALL(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION "${PLUGIN_DIR}") IF(LMMS_BUILD_APPLE) - IF ("${PLUGIN_LINK}" STREQUAL "DYNAMIC") + IF ("${PLUGIN_LINK}" STREQUAL "SHARED") SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") ELSE() SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-bundle_loader \"${CMAKE_BINARY_DIR}/lmms\"") diff --git a/plugins/carlabase/CMakeLists.txt b/plugins/carlabase/CMakeLists.txt index cfe36dae46d..4fa81a4916f 100644 --- a/plugins/carlabase/CMakeLists.txt +++ b/plugins/carlabase/CMakeLists.txt @@ -9,14 +9,9 @@ ENDIF() if(LMMS_HAVE_CARLA) INCLUDE(BuildPlugin) INCLUDE_DIRECTORIES(${CARLA_INCLUDE_DIRS}) - IF(LMMS_BUILD_APPLE) - SET(CARLA_LINK_TYPE DYNAMIC) - ELSE() - SET(CARLA_LINK_TYPE SHARED) - ENDIF() LINK_DIRECTORIES(${CARLA_LIBRARY_DIRS}) LINK_LIBRARIES(${CARLA_LIBRARIES}) - BUILD_PLUGIN(carlabase carla.cpp carla.h MOCFILES carla.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png" LINK ${CARLA_LINK_TYPE}) + BUILD_PLUGIN(carlabase carla.cpp carla.h MOCFILES carla.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png" LINK SHARED) SET_TARGET_PROPERTIES(carlabase PROPERTIES SKIP_BUILD_RPATH TRUE BUILD_WITH_INSTALL_RPATH TRUE From 73a2add4880a01979534c50cd58f5662042f58e4 Mon Sep 17 00:00:00 2001 From: tresf Date: Tue, 11 Sep 2018 20:54:19 -0400 Subject: [PATCH 12/20] Don't hard-code carla path --- plugins/carlabase/carla.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/carlabase/carla.cpp b/plugins/carlabase/carla.cpp index 9221ad4f28e..b8a20046366 100644 --- a/plugins/carlabase/carla.cpp +++ b/plugins/carlabase/carla.cpp @@ -161,8 +161,9 @@ CarlaInstrument::CarlaInstrument(InstrumentTrack* const instrumentTrack, const D path.cdUp(); resourcesPath = path.absolutePath() + "/share/carla/resources"; #elif defined(CARLA_OS_MAC) - // assume standard install location - resourcesPath = "/Applications/Carla.app/Contents/MacOS/resources"; + // parse prefix from dll filename + QDir path = QFileInfo(dllName).dir(); + resourcesPath = path.absolutePath() + "/resources"; #elif defined(CARLA_OS_WIN32) || defined(CARLA_OS_WIN64) // not yet supported #endif From 38e48c0d2d7aec080098bcbe94fac6b5005a347a Mon Sep 17 00:00:00 2001 From: tresf Date: Thu, 13 Sep 2018 21:22:21 -0400 Subject: [PATCH 13/20] Nudge to latest Carla --- .travis/osx..install.sh | 2 +- CMakeLists.txt | 2 +- cmake/apple/install_apple.sh.in | 9 +-------- plugins/carlabase/carla.cpp | 16 +++++++--------- plugins/carlabase/carla.h | 7 ++++--- plugins/carlapatchbay/carlapatchbay.cpp | 4 ++-- plugins/carlarack/carlarack.cpp | 4 ++-- 7 files changed, 18 insertions(+), 26 deletions(-) diff --git a/.travis/osx..install.sh b/.travis/osx..install.sh index af291f0fe6a..0fef97f864a 100644 --- a/.travis/osx..install.sh +++ b/.travis/osx..install.sh @@ -10,6 +10,6 @@ fi brew install $PACKAGES ccache # FIXME: Move "carla" to $PACKAGES once https://github.com/Homebrew/homebrew-core/pull/31560 is merged -brew install https://github.com/tresf/homebrew-core/blob/carla/Formula/carla.rb +brew install https://gist.githubusercontent.com/tresf/a8ffb8299227c51cf11aaf3929765264/raw/e94ad17aea63084c66bcb7e90009e3d5e848a467/carla.rb sudo npm install -g appdmg diff --git a/CMakeLists.txt b/CMakeLists.txt index da5be324a34..c97adf93b3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,7 +229,7 @@ ENDIF(WANT_TAP) # check for CARLA IF(WANT_CARLA) - PKG_CHECK_MODULES(CARLA carla-standalone>=1.9.5) + PKG_CHECK_MODULES(CARLA carla-native-plugin) IF(CARLA_FOUND) SET(LMMS_HAVE_CARLA TRUE) SET(STATUS_CARLA "OK") diff --git a/cmake/apple/install_apple.sh.in b/cmake/apple/install_apple.sh.in index 644d3b445e8..3f69a07eb61 100644 --- a/cmake/apple/install_apple.sh.in +++ b/cmake/apple/install_apple.sh.in @@ -21,14 +21,7 @@ echo -e "$MSG_COLOR\n\nCreating App Bundle \"$APP\"...$COLOR_RESET" # Locate macdeployqt, assume homebrew & Qt5 which macdeployqt > /dev/null 2>&1 if [ $? -ne 0 ]; then - brew --prefix qt55 > /dev/null 2>&1 - if [ $? -eq 0 ]; then - # Prefer Qt 5.5 (QTBUG-53533) - export PATH=$PATH:$(brew --prefix qt55)/bin - else - # Fallback Qt 5.6+ - export PATH=$PATH:$(brew --prefix qt5)/bin - fi + export PATH=$PATH:$(brew --prefix qt)/bin fi # Remove any old .app bundles diff --git a/plugins/carlabase/carla.cpp b/plugins/carlabase/carla.cpp index b8a20046366..68d8c337622 100644 --- a/plugins/carlabase/carla.cpp +++ b/plugins/carlabase/carla.cpp @@ -1,7 +1,7 @@ /* * carla.cpp - Carla for LMMS * - * Copyright (C) 2014 Filipe Coelho + * Copyright (C) 2014-2018 Filipe Coelho * * This file is part of LMMS - https://lmms.io * @@ -24,9 +24,6 @@ #include "carla.h" -#define REAL_BUILD // FIXME this shouldn't be needed -#include "CarlaHost.h" - #include "Engine.h" #include "Song.h" #include "gui_templates.h" @@ -255,7 +252,7 @@ void CarlaInstrument::handleUiClosed() emit uiClosed(); } -intptr_t CarlaInstrument::handleDispatcher(const NativeHostDispatcherOpcode opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt) +intptr_t CarlaInstrument::handleDispatcher(const NativeHostDispatcherOpcode opcode, const int32_t, const intptr_t, void* const, const float) { intptr_t ret = 0; @@ -272,9 +269,6 @@ intptr_t CarlaInstrument::handleDispatcher(const NativeHostDispatcherOpcode opco } return ret; - - // unused for now - (void)index; (void)value; (void)ptr; (void)opt; } // ------------------------------------------------------------------- @@ -449,10 +443,15 @@ bool CarlaInstrument::handleMidiEvent(const MidiEvent& event, const MidiTime&, f PluginView* CarlaInstrument::instantiateView(QWidget* parent) { +// Disable plugin focus per https://bugreports.qt.io/browse/QTBUG-30181 +#ifdef CARLA_OS_MAC + fHost.uiParentId = 0; +#else if (QWidget* const window = parent->window()) fHost.uiParentId = window->winId(); else fHost.uiParentId = 0; +#endif std::free((char*)fHost.uiName); @@ -532,4 +531,3 @@ void CarlaInstrumentView::timerEvent(QTimerEvent* event) } // ------------------------------------------------------------------- - diff --git a/plugins/carlabase/carla.h b/plugins/carlabase/carla.h index 6431e5300de..ea4875850a3 100644 --- a/plugins/carlabase/carla.h +++ b/plugins/carlabase/carla.h @@ -1,7 +1,7 @@ /* * carla.h - Carla for LMMS * - * Copyright (C) 2014 Filipe Coelho + * Copyright (C) 2014-2018 Filipe Coelho * * This file is part of LMMS - https://lmms.io * @@ -27,7 +27,8 @@ #include -#include "CarlaNative.h" +#define REAL_BUILD // FIXME this shouldn't be needed +#include "CarlaNativePlugin.h" #include "Instrument.h" #include "InstrumentView.h" @@ -44,7 +45,7 @@ class PLUGIN_EXPORT CarlaInstrument : public Instrument CarlaInstrument(InstrumentTrack* const instrumentTrack, const Descriptor* const descriptor, const bool isPatchbay); virtual ~CarlaInstrument(); - // CarlaNative functions + // Carla NativeHostDescriptor functions uint32_t handleGetBufferSize() const; double handleGetSampleRate() const; bool handleIsOffline() const; diff --git a/plugins/carlapatchbay/carlapatchbay.cpp b/plugins/carlapatchbay/carlapatchbay.cpp index ae6ca1906e3..42786d18a9d 100644 --- a/plugins/carlapatchbay/carlapatchbay.cpp +++ b/plugins/carlapatchbay/carlapatchbay.cpp @@ -1,7 +1,7 @@ /* * carlapatchbay.cpp - Carla for LMMS (Patchbay) * - * Copyright (C) 2014 Filipe Coelho + * Copyright (C) 2014-2018 Filipe Coelho * * This file is part of LMMS - https://lmms.io * @@ -36,7 +36,7 @@ Plugin::Descriptor PLUGIN_EXPORT carlapatchbay_plugin_descriptor = QT_TRANSLATE_NOOP( "pluginBrowser", "Carla Patchbay Instrument" ), "falkTX ", - 0x0195, + CARLA_VERSION_HEX, Plugin::Instrument, new PluginPixmapLoader( "logo" ), NULL, diff --git a/plugins/carlarack/carlarack.cpp b/plugins/carlarack/carlarack.cpp index 0a52c63c53d..2149e66040a 100644 --- a/plugins/carlarack/carlarack.cpp +++ b/plugins/carlarack/carlarack.cpp @@ -1,7 +1,7 @@ /* * carlarack.cpp - Carla for LMMS (Rack) * - * Copyright (C) 2014 Filipe Coelho + * Copyright (C) 2014-2018 Filipe Coelho * * This file is part of LMMS - https://lmms.io * @@ -36,7 +36,7 @@ Plugin::Descriptor PLUGIN_EXPORT carlarack_plugin_descriptor = QT_TRANSLATE_NOOP( "pluginBrowser", "Carla Rack Instrument" ), "falkTX ", - 0x0195, + CARLA_VERSION_HEX, Plugin::Instrument, new PluginPixmapLoader( "logo" ), NULL, From ee6d5025baf3978670bc7a90488f3299121e87c1 Mon Sep 17 00:00:00 2001 From: tresf Date: Thu, 13 Sep 2018 22:40:49 -0400 Subject: [PATCH 14/20] More scalable relinking --- cmake/apple/install_apple.sh.in | 36 ++++++++++++--------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/cmake/apple/install_apple.sh.in b/cmake/apple/install_apple.sh.in index 3f69a07eb61..2597342083a 100644 --- a/cmake/apple/install_apple.sh.in +++ b/cmake/apple/install_apple.sh.in @@ -99,31 +99,21 @@ macdeployqt "$APP" $_executables # # For example: # /Applications/LMMS.app -# Contents/lib/lmms/libcarlabase.dylib -# Contents/lib/lmms/libcarlarack.so -# Contents/lib/lmms/libcarlapatchbay.so # /Applications/Carla.app -# Conents/MacOS/libcarla_standalone2.dylib -# -# Note: -# If upstream (@falktx) moves or renames this library -# pkg-config won't mind, but this section MUST be updated -# to reflect the new library path -# -libcarla="Carla.app/Contents/MacOS/libcarla_standalone2.dylib" -rm -f "$APP/Contents/Frameworks/libcarla_standalone2.dylib" - -install_name_tool -change @loader_path/../../Frameworks/libcarla_standalone2.dylib \ - @executable_path/../../../$libcarla \ - "$APP/Contents/lib/lmms/libcarlabase.dylib" - -install_name_tool -change @loader_path/../../Frameworks/libcarla_standalone2.dylib \ - @executable_path/../../../$libcarla \ - "$APP/Contents/lib/lmms/libcarlarack.so" +carlalibs=$(echo "@CARLA_LIBRARIES@"|tr ";" "\n") -install_name_tool -change @loader_path/../../Frameworks/libcarla_standalone2.dylib \ - @executable_path/../../../$libcarla \ - "$APP/Contents/lib/lmms/libcarlapatchbay.so" +# Loop over all libcarlas, fix linking +for file in "$APP/Contents/lib/lmms/"libcarla*; do + _thisfile="$APP/Contents/lib/lmms/${file##*/}" + for lib in $carlalibs; do + _oldpath="../../Frameworks/lib${lib}.dylib" + _newpath="Carla.app/Contents/MacOS/lib${lib}.dylib" + install_name_tool -change @loader_path/$_oldpath \ + @executable_path/../../../$_newpath \ + "$_thisfile" + rm -f "$APP/Contents/Frameworks/lib${lib}.dylib" + done +done # Cleanup rm -rf "$APP/Contents/bin" From b38dd02b9849927bff5c5e2ec9401358d93ff49d Mon Sep 17 00:00:00 2001 From: tresf Date: Thu, 13 Sep 2018 23:13:15 -0400 Subject: [PATCH 15/20] Add old carla lib fallback --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c97adf93b3a..3fb0969eb89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -230,6 +230,10 @@ ENDIF(WANT_TAP) # check for CARLA IF(WANT_CARLA) PKG_CHECK_MODULES(CARLA carla-native-plugin) + # look for carla under old name + IF(NOT CARLA_FOUND) + PKG_CHECK_MODULES(CARLA carla-standalone>=1.9.5) + ENDIF() IF(CARLA_FOUND) SET(LMMS_HAVE_CARLA TRUE) SET(STATUS_CARLA "OK") From e89aee53859bb51eaba2dfbf9887d1f92ab193c9 Mon Sep 17 00:00:00 2001 From: tresf Date: Fri, 14 Sep 2018 10:21:52 -0400 Subject: [PATCH 16/20] Bump to homebrew carla; minor formatting --- .travis/osx..install.sh | 4 +--- plugins/carlabase/carla.cpp | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis/osx..install.sh b/.travis/osx..install.sh index 0fef97f864a..dfe1df4d1fb 100644 --- a/.travis/osx..install.sh +++ b/.travis/osx..install.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -PACKAGES="cmake pkgconfig fftw libogg libvorbis lame libsndfile libsamplerate jack sdl libgig libsoundio stk fluid-synth portaudio node fltk" +PACKAGES="cmake pkgconfig fftw libogg libvorbis lame libsndfile libsamplerate jack sdl libgig libsoundio stk fluid-synth portaudio node fltk carla" if [ $QT5 ]; then PACKAGES="$PACKAGES qt5" @@ -9,7 +9,5 @@ else fi brew install $PACKAGES ccache -# FIXME: Move "carla" to $PACKAGES once https://github.com/Homebrew/homebrew-core/pull/31560 is merged -brew install https://gist.githubusercontent.com/tresf/a8ffb8299227c51cf11aaf3929765264/raw/e94ad17aea63084c66bcb7e90009e3d5e848a467/carla.rb sudo npm install -g appdmg diff --git a/plugins/carlabase/carla.cpp b/plugins/carlabase/carla.cpp index 68d8c337622..935ae38cd6e 100644 --- a/plugins/carlabase/carla.cpp +++ b/plugins/carlabase/carla.cpp @@ -265,7 +265,7 @@ intptr_t CarlaInstrument::handleDispatcher(const NativeHostDispatcherOpcode opco qApp->processEvents(); break; default: - break; + break; } return ret; @@ -531,3 +531,4 @@ void CarlaInstrumentView::timerEvent(QTimerEvent* event) } // ------------------------------------------------------------------- + From a5a9a15f4bac072e08cb2c4951e799b1972d0eee Mon Sep 17 00:00:00 2001 From: tresf Date: Fri, 14 Sep 2018 11:09:21 -0400 Subject: [PATCH 17/20] Fix header on 1.9.9 and older --- plugins/carlabase/carla.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/carlabase/carla.h b/plugins/carlabase/carla.h index ea4875850a3..dc8eb048c17 100644 --- a/plugins/carlabase/carla.h +++ b/plugins/carlabase/carla.h @@ -28,7 +28,11 @@ #include #define REAL_BUILD // FIXME this shouldn't be needed -#include "CarlaNativePlugin.h" +#if CARLA_VERSION_HEX >= 0x010911 + #include "CarlaNativePlugin.h" +#else + #include "CarlaNative.h" +#endif #include "Instrument.h" #include "InstrumentView.h" From 79a5367a402357655717dcb9a0b57f6875e3079c Mon Sep 17 00:00:00 2001 From: tresf Date: Fri, 14 Sep 2018 11:17:56 -0400 Subject: [PATCH 18/20] Use header definitions if avail --- plugins/carlabase/carla.cpp | 8 -------- plugins/carlabase/carla.h | 5 +++++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/plugins/carlabase/carla.cpp b/plugins/carlabase/carla.cpp index 935ae38cd6e..45d83af2c9a 100644 --- a/plugins/carlabase/carla.cpp +++ b/plugins/carlabase/carla.cpp @@ -129,14 +129,6 @@ static const char* host_ui_save_file(NativeHostHandle, bool isDir, const char* t // ----------------------------------------------------------------------- -CARLA_EXPORT -const NativePluginDescriptor* carla_get_native_patchbay_plugin(); - -CARLA_EXPORT -const NativePluginDescriptor* carla_get_native_rack_plugin(); - -// ----------------------------------------------------------------------- - CarlaInstrument::CarlaInstrument(InstrumentTrack* const instrumentTrack, const Descriptor* const descriptor, const bool isPatchbay) : Instrument(instrumentTrack, descriptor), kIsPatchbay(isPatchbay), diff --git a/plugins/carlabase/carla.h b/plugins/carlabase/carla.h index dc8eb048c17..2314dfebaee 100644 --- a/plugins/carlabase/carla.h +++ b/plugins/carlabase/carla.h @@ -32,6 +32,11 @@ #include "CarlaNativePlugin.h" #else #include "CarlaNative.h" + CARLA_EXPORT + const NativePluginDescriptor* carla_get_native_patchbay_plugin(); + + CARLA_EXPORT + const NativePluginDescriptor* carla_get_native_rack_plugin(); #endif #include "Instrument.h" From 94c747c8c7821fd8250f02470b28bc355caf4283 Mon Sep 17 00:00:00 2001 From: tresf Date: Fri, 14 Sep 2018 12:38:03 -0400 Subject: [PATCH 19/20] Fix more missing headers --- plugins/carlabase/carla.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/carlabase/carla.h b/plugins/carlabase/carla.h index 2314dfebaee..fb54e2271da 100644 --- a/plugins/carlabase/carla.h +++ b/plugins/carlabase/carla.h @@ -31,7 +31,9 @@ #if CARLA_VERSION_HEX >= 0x010911 #include "CarlaNativePlugin.h" #else + #include "CarlaBackend.h" #include "CarlaNative.h" + #include "CarlaUtils.h" CARLA_EXPORT const NativePluginDescriptor* carla_get_native_patchbay_plugin(); From 0838c9b700b667400edf678f9e7c9073a4833325 Mon Sep 17 00:00:00 2001 From: tresf Date: Sat, 15 Sep 2018 08:52:55 -0400 Subject: [PATCH 20/20] Uglify :D --- plugins/carlabase/carla.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/carlabase/carla.cpp b/plugins/carlabase/carla.cpp index 45d83af2c9a..b25677f5c5f 100644 --- a/plugins/carlabase/carla.cpp +++ b/plugins/carlabase/carla.cpp @@ -436,14 +436,12 @@ bool CarlaInstrument::handleMidiEvent(const MidiEvent& event, const MidiTime&, f PluginView* CarlaInstrument::instantiateView(QWidget* parent) { // Disable plugin focus per https://bugreports.qt.io/browse/QTBUG-30181 -#ifdef CARLA_OS_MAC - fHost.uiParentId = 0; -#else +#ifndef CARLA_OS_MAC if (QWidget* const window = parent->window()) fHost.uiParentId = window->winId(); else - fHost.uiParentId = 0; #endif + fHost.uiParentId = 0; std::free((char*)fHost.uiName);