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 Windows #5713

Merged
merged 4 commits into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
19 changes: 14 additions & 5 deletions plugins/carlabase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ if(LMMS_HAVE_WEAKCARLA)
${CMAKE_CURRENT_SOURCE_DIR}/carla/source/utils
${CMAKE_CURRENT_SOURCE_DIR}/carla/source/backend
)
ADD_LIBRARY(carla_native-plugin SHARED DummyCarla.cpp)
TARGET_INCLUDE_DIRECTORIES(carla_native-plugin PUBLIC ${CARLA_INCLUDE_DIRS})
INSTALL(TARGETS carla_native-plugin

IF(LMMS_BUILD_WIN32)
# use carla.dll
SET(CMAKE_SHARED_LIBRARY_PREFIX "")
SET(CARLA_NATIVE_LIB carla)
ELSE()
# use libcarla_native-plugin
SET(CARLA_NATIVE_LIB carla_native-plugin)
ENDIF()
ADD_LIBRARY(${CARLA_NATIVE_LIB} SHARED DummyCarla.cpp)
TARGET_INCLUDE_DIRECTORIES(${CARLA_NATIVE_LIB} PUBLIC ${CARLA_INCLUDE_DIRS})
INSTALL(TARGETS ${CARLA_NATIVE_LIB}
LIBRARY DESTINATION "${PLUGIN_DIR}/optional"
RUNTIME DESTINATION "${PLUGIN_DIR}/optional"
)
SET(CARLA_LIBRARIES carla_native-plugin)
SET(CARLA_LIBRARIES ${CARLA_NATIVE_LIB})
# Set parent scope variables so carlarack and carlapatchbay can see them
SET(CARLA_LIBRARIES ${CARLA_LIBRARIES} PARENT_SCOPE)
endif()
Expand All @@ -45,6 +54,6 @@ if(LMMS_HAVE_CARLA OR LMMS_HAVE_WEAKCARLA)
INSTALL_RPATH_USE_LINK_PATH TRUE
INSTALL_RPATH "${CARLA_RPATH}")
IF(LMMS_HAVE_WEAKCARLA)
ADD_DEPENDENCIES(carlabase carla_native-plugin)
ADD_DEPENDENCIES(carlabase ${CARLA_NATIVE_LIB})
ENDIF()
endif()
28 changes: 17 additions & 11 deletions plugins/carlabase/carla.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,14 @@ CarlaInstrument::CarlaInstrument(InstrumentTrack* const instrumentTrack, const D
fHost.uiParentId = 0;

// carla/resources contains PyQt scripts required for launch
QString dllName(carla_get_library_filename());
QString resourcesPath;
QDir path(carla_get_library_folder());
#if defined(CARLA_OS_LINUX)
// parse prefix from dll filename
QDir path = QFileInfo(dllName).dir();
path.cdUp();
path.cdUp();
resourcesPath = path.absolutePath() + "/share/carla/resources";
#elif defined(CARLA_OS_MAC)
QString resourcesPath = path.absolutePath() + "/share/carla/resources";
#else
// 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
QString resourcesPath = path.absolutePath() + "/resources";
#endif
fHost.resourceDir = strdup(resourcesPath.toUtf8().constData());
fHost.get_buffer_size = host_get_buffer_size;
Expand Down Expand Up @@ -503,8 +497,20 @@ CarlaInstrumentView::~CarlaInstrumentView()

void CarlaInstrumentView::toggleUI(bool visible)
{
if (fHandle != NULL && fDescriptor->ui_show != NULL)
if (fHandle != NULL && fDescriptor->ui_show != NULL) {
// TODO: remove when fixed upstream
// change working path to location of carla.dll to avoid conflict with lmms
#if defined(CARLA_OS_WIN32) || defined(CARLA_OS_WIN64)
if (visible) {
QString backupDir = QDir::currentPath();
QDir::setCurrent(carla_get_library_folder());
fDescriptor->ui_show(fHandle, true);
QDir::setCurrent(backupDir);
return;
}
#endif
fDescriptor->ui_show(fHandle, visible);
}
}

void CarlaInstrumentView::uiClosed()
Expand Down