diff --git a/plugins/carlabase/CMakeLists.txt b/plugins/carlabase/CMakeLists.txt index 28a1bc88c51..d382fceb8c5 100644 --- a/plugins/carlabase/CMakeLists.txt +++ b/plugins/carlabase/CMakeLists.txt @@ -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() @@ -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() diff --git a/plugins/carlabase/carla.cpp b/plugins/carlabase/carla.cpp index a6faa4d275d..ee94e26430b 100644 --- a/plugins/carlabase/carla.cpp +++ b/plugins/carlabase/carla.cpp @@ -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; @@ -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()