Skip to content

Commit

Permalink
Add Carla as a submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
tresf committed Jan 11, 2020
1 parent 23046f6 commit 9f3d3d2
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ IF(WANT_CARLA)
SET(LMMS_HAVE_CARLA TRUE)
SET(STATUS_CARLA "OK")
ELSE(CARLA_FOUND)
SET(STATUS_CARLA "not found, please install the latest carla")
SET(LMMS_HAVE_WEAKCARLA TRUE)
SET(STATUS_CARLA "OK (weak linking enabled)")
ENDIF(CARLA_FOUND)
ENDIF(WANT_CARLA)

Expand Down
7 changes: 3 additions & 4 deletions cmake/linux/launch_lmms.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/env bash
alias standard_which="command -v"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export PATH="$PATH:/sbin"
if standard_which carla > /dev/null 2>&1; then
CARLAPATH="$(standard_which carla)"
if command -v carla > /dev/null 2>&1; then
CARLAPATH="$(command -v carla)"
CARLAPREFIX="${CARLAPATH%/bin*}"
echo "Carla appears to be installed on this system at $CARLAPREFIX/lib[64]/carla so we'll use it."
export LD_LIBRARY_PATH=$CARLAPREFIX/lib/carla:$CARLAPREFIX/lib64/carla:$LD_LIBRARY_PATH
Expand All @@ -22,4 +21,4 @@ else
echo "Jack does not appear to be installed. That's OK, we'll use a dummy version instead."
export LD_LIBRARY_PATH=$DIR/usr/lib/lmms/optional:$LD_LIBRARY_PATH
fi
QT_X11_NO_NATIVE_MENUBAR=1 "$DIR"/usr/bin/lmms.real "$@"
QT_X11_NO_NATIVE_MENUBAR=1 "$DIR"/usr/bin/lmms.real "$@"
7 changes: 4 additions & 3 deletions cmake/linux/package_linux.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ chmod +x "${APPDIR}usr/bin/lmms"
unset LD_LIBRARY_PATH

# Ensure linuxdeployqt can find shared objects
export LD_LIBRARY_PATH="${APPDIR}usr/lib/lmms/":$LD_LIBRARY_PATH
export LD_LIBRARY_PATH="${APPDIR}usr/lib/lmms/":"${APPDIR}usr/lib/lmms/optional":$LD_LIBRARY_PATH

# Handle wine linking
if [ -d "@WINE_LIBRARY_FIX@" ]; then
Expand All @@ -120,7 +120,7 @@ ZYNBIN="${APPDIR}usr/bin/RemoteZynAddSubFx"
VSTBIN="${APPDIR}usr/bin/RemoteVstPlugin.exe.so"

mv "$ZYNLIB" "$ZYNBIN"
mv "$VSTLIB" "$VSTBIN"
mv "$VSTLIB" "$VSTBIN" || true

# Patch the desktop file
sed -i 's/.*Exec=.*/Exec=lmms.real/' "$DESKTOPFILE"
Expand All @@ -146,13 +146,14 @@ success "Bundled and relinked dependencies"

# Link to original location so lmms can find them
ln -sr "$ZYNBIN" "$ZYNLIB"
ln -sr "$VSTBIN" "$VSTLIB"
ln -sr "$VSTBIN" "$VSTLIB" || true

# Remove wine library conflict
rm -f "${APPDIR}/usr/lib/libwine.so.1"

# Use system-provided carla
rm -f "${APPDIR}usr/lib/"libcarla*.so
rm -f "${APPDIR}usr/lib/lmms/optional/"libcarla*.so

# Remove bundled jack in LD_LIBRARY_PATH if exists
if [ -e "${APPDIR}/usr/lib/libjack.so.0" ]; then
Expand Down
6 changes: 5 additions & 1 deletion cmake/modules/BuildPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME)
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} lmms)
ENDIF(LMMS_BUILD_WIN32)

INSTALL(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION "${PLUGIN_DIR}")
IF(LMMS_BUILD_WIN32 AND "${PLUGIN_LINK}" STREQUAL "SHARED")
INSTALL(TARGETS ${PLUGIN_NAME} RUNTIME DESTINATION "${PLUGIN_DIR}")
ELSE()
INSTALL(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION "${PLUGIN_DIR}")
ENDIF()

IF(LMMS_BUILD_APPLE)
IF ("${PLUGIN_LINK}" STREQUAL "SHARED")
Expand Down
26 changes: 24 additions & 2 deletions plugins/carlabase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,29 @@ IF(NOT CMAKE_VERSION VERSION_LESS 3.9)
CMAKE_POLICY(SET CMP0068 OLD)
ENDIF()

if(LMMS_HAVE_CARLA)
# If Carla was not provided by the system, make a dummy library instead
if(LMMS_HAVE_WEAKCARLA)
# Mimic the Makefile header
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/config.h "")
SET(CARLA_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/carla/source
${CMAKE_CURRENT_SOURCE_DIR}/carla/source/includes
${CMAKE_CURRENT_SOURCE_DIR}/carla/source/utils
${CMAKE_CURRENT_SOURCE_DIR}/carla/source/backend
${CMAKE_CURRENT_BINARY_DIR}
)
INCLUDE_DIRECTORIES(${CARLA_INCLUDE_DIRS})
ADD_LIBRARY(carla_native-plugin MODULE DummyCarla.cpp)
INSTALL(TARGETS carla_native-plugin LIBRARY DESTINATION "${PLUGIN_DIR}/optional")
SET(CARLA_LIBRARIES $<TARGET_FILE:carla_native-plugin>)
SET(CARLA_LIBRARY_DIRS $<TARGET_FILE_DIR:carla_native-plugin>)
# Set parent scope variables so carlarack and carlapatchbay can see them
SET(CARLA_LIBRARIES ${CARLA_LIBRARIES} PARENT_SCOPE)
SET(CARLA_INCLUDE_DIRS ${CARLA_INCLUDE_DIRS} PARENT_SCOPE)
SET(CARLA_LIBRARY_DIRS ${CARLA_LIBRARY_DIRS} PARENT_SCOPE)
endif()

if(LMMS_HAVE_CARLA OR LMMS_HAVE_WEAKCARLA)
INCLUDE(BuildPlugin)
INCLUDE_DIRECTORIES(${CARLA_INCLUDE_DIRS})
LINK_DIRECTORIES(${CARLA_LIBRARY_DIRS})
Expand All @@ -17,4 +39,4 @@ if(LMMS_HAVE_CARLA)
BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_RPATH_USE_LINK_PATH TRUE
INSTALL_RPATH "${CARLA_RPATH}")
endif(LMMS_HAVE_CARLA)
endif()
12 changes: 12 additions & 0 deletions plugins/carlabase/DummyCarla.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// A dummy Carla interface
#include "CarlaNativePlugin.h"

const char* carla_get_library_filename() { return nullptr; }
const char* carla_get_library_folder() { return nullptr; }
const NativePluginDescriptor* carla_get_native_rack_plugin() { return nullptr; }
const NativePluginDescriptor* carla_get_native_patchbay_plugin() { return nullptr; }
const NativePluginDescriptor* carla_get_native_patchbay16_plugin() { return nullptr; }
const NativePluginDescriptor* carla_get_native_patchbay32_plugin() { return nullptr; }
const NativePluginDescriptor* carla_get_native_patchbay64_plugin() { return nullptr; }
const NativePluginDescriptor* carla_get_native_patchbay_cv_plugin() { return nullptr; }
CarlaBackend::CarlaEngine* carla_get_native_plugin_engine(const NativePluginDescriptor* desc, NativePluginHandle handle) { return nullptr; }
1 change: 1 addition & 0 deletions plugins/carlabase/carla
Submodule carla added at 4ac8ff
3 changes: 2 additions & 1 deletion plugins/carlabase/carla.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ PluginView* CarlaInstrument::instantiateView(QWidget* parent)
// Disable plugin focus per https://bugreports.qt.io/browse/QTBUG-30181
#ifndef CARLA_OS_MAC
if (QWidget* const window = parent->window())
fHost.uiParentId = window->winId();
// TODO: Remove cast; Only needed for Qt4
fHost.uiParentId = (uintptr_t)window->winId();
else
#endif
fHost.uiParentId = 0;
Expand Down
Binary file added plugins/carlabase/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions plugins/carlapatchbay/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
if(LMMS_HAVE_CARLA)
if(LMMS_HAVE_CARLA OR LMMS_HAVE_WEAKCARLA)
ADD_DEFINITIONS(-DCARLA_PLUGIN_PATCHBAY -DCARLA_PLUGIN_SYNTH)
INCLUDE(BuildPlugin)
INCLUDE_DIRECTORIES(${CARLA_INCLUDE_DIRS} "${CMAKE_CURRENT_SOURCE_DIR}/../carlabase")
LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/../carlabase"
${CARLA_LIBRARY_DIRS})
LINK_LIBRARIES(carlabase)
BUILD_PLUGIN(carlapatchbay carlapatchbay.cpp EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
endif(LMMS_HAVE_CARLA)
endif()
4 changes: 2 additions & 2 deletions plugins/carlarack/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
if(LMMS_HAVE_CARLA)
if(LMMS_HAVE_CARLA OR LMMS_HAVE_WEAKCARLA)
ADD_DEFINITIONS(-DCARLA_PLUGIN_RACK -DCARLA_PLUGIN_SYNTH)
INCLUDE(BuildPlugin)
INCLUDE_DIRECTORIES(${CARLA_INCLUDE_DIRS} "${CMAKE_CURRENT_SOURCE_DIR}/../carlabase")
LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/../carlabase"
${CARLA_LIBRARY_DIRS})
LINK_LIBRARIES(carlabase)
BUILD_PLUGIN(carlarack carlarack.cpp EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
endif(LMMS_HAVE_CARLA)
endif()

0 comments on commit 9f3d3d2

Please sign in to comment.