Add Carla support for Windows (#5713)

This commit is contained in:
Tres Finocchiaro
2020-10-29 01:06:34 -04:00
committed by GitHub
parent 090b5a7752
commit c23c1b79d5
2 changed files with 31 additions and 16 deletions

View File

@@ -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()

View File

@@ -142,20 +142,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;
@@ -444,8 +438,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()