Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Carla support for MacOS #4558

Merged
merged 20 commits into from
Sep 15, 2018
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/build
/target
.*.sw?
.DS_Store
*~
/CMakeLists.txt.user
/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Controller/Makefile
Expand Down
1 change: 1 addition & 0 deletions .travis/osx..install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
27 changes: 26 additions & 1 deletion cmake/apple/install_apple.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,16 @@ 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
install_name_tool -change @rpath/libcarlabase.dylib \
@loader_path/libcarlabase.dylib \
"$APP/Contents/lib/lmms/libcarlapatchbay.so"

install_name_tool -change @rpath/libcarlabase.dylib \
@loader_path/libcarlabase.dylib \
"$APP/Contents/lib/lmms/libcarlarack.so"

# Link lmms binary
_executables="${_executables} -executable=$APP/Contents/$zynbin"
_executables="${_executables} -executable=$APP/Contents/$zynfmk"
Expand All @@ -90,6 +99,22 @@ done
# Finalize .app
macdeployqt "$APP" $_executables

# Carla should be installed separately
libcarla="Carla.app/Contents/MacOS/libcarla_standalone2.dylib"
PhysSong marked this conversation as resolved.
Show resolved Hide resolved
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"
11 changes: 7 additions & 4 deletions cmake/modules/BuildPlugin.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# BuildPlugin.cmake - Copyright (c) 2008 Tobias Doerffel
#
# description: build LMMS-plugin
# usage: BUILD_PLUGIN(<PLUGIN_NAME> <PLUGIN_SOURCES> MOCFILES <HEADERS_FOR_MOC> EMBEDDED_RESOURCES <LIST_OF_FILES_TO_EMBED> UICFILES <UI_FILES_TO_COMPILE> LINK <SHARED|MODULE>)
# usage: BUILD_PLUGIN(<PLUGIN_NAME> <PLUGIN_SOURCES> MOCFILES <HEADERS_FOR_MOC> EMBEDDED_RESOURCES <LIST_OF_FILES_TO_EMBED> UICFILES <UI_FILES_TO_COMPILE> LINK <SHARED|MODULE|DYNAMIC>)

MACRO(BUILD_PLUGIN PLUGIN_NAME)
CMAKE_PARSE_ARGUMENTS(PLUGIN "" "" "MOCFILES;EMBEDDED_RESOURCES;UICFILES;LINK" ${ARGN})
Expand Down Expand Up @@ -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})
Expand All @@ -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")
tresf marked this conversation as resolved.
Show resolved Hide resolved
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)
Expand All @@ -83,4 +87,3 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME)

SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ER_H} ${plugin_MOC_out}")
ENDMACRO(BUILD_PLUGIN)

12 changes: 11 additions & 1 deletion plugins/carlabase/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# For MacOS, use old RPATH install_name behavior
IF (CMAKE_MAJOR_VERSION GREATER 2 AND CMAKE_MINOR_VERSION GREATER 8)
tresf marked this conversation as resolved.
Show resolved Hide resolved
CMAKE_POLICY(SET CMP0068 OLD)
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 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
Expand Down