Skip to content

Commit

Permalink
Support VSTs on Linux even if Wine is unavailable (LMMS#7205)
Browse files Browse the repository at this point in the history
  • Loading branch information
DomClark authored Apr 14, 2024
1 parent 815f88d commit d3ab315
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 59 deletions.
68 changes: 44 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ OPTION(WANT_STK "Include Stk (Synthesis Toolkit) support" ON)
OPTION(WANT_SWH "Include Steve Harris's LADSPA plugins" ON)
OPTION(WANT_TAP "Include Tom's Audio Processing LADSPA plugins" ON)
OPTION(WANT_VST "Include VST support" ON)
OPTION(WANT_VST_32 "Include 32-bit VST support" ON)
OPTION(WANT_VST_64 "Include 64-bit VST support" ON)
OPTION(WANT_VST_32 "Include 32-bit Windows VST support" ON)
OPTION(WANT_VST_64 "Include 64-bit Windows VST support" ON)
OPTION(WANT_WINMM "Include WinMM MIDI support" OFF)
OPTION(WANT_DEBUG_FPE "Debug floating point exceptions" OFF)
option(WANT_DEBUG_ASAN "Enable AddressSanitizer" OFF)
Expand Down Expand Up @@ -131,6 +131,9 @@ IF(LMMS_BUILD_WIN32)
SET(WANT_WINMM ON)
SET(BUNDLE_QT_TRANSLATIONS ON)
SET(LMMS_HAVE_WINMM TRUE)
if(NOT LMMS_BUILD_WIN64)
set(WANT_VST_64 OFF)
endif()
SET(STATUS_ALSA "<not supported on this platform>")
SET(STATUS_OSS "<not supported on this platform>")
SET(STATUS_PULSEAUDIO "<not supported on this platform>")
Expand Down Expand Up @@ -587,26 +590,42 @@ IF(WANT_SNDIO)
ENDIF(WANT_SNDIO)

# check for WINE
IF(WANT_VST)
FIND_PACKAGE(Wine)
IF(WINE_FOUND)
SET(LMMS_SUPPORT_VST TRUE)
IF(WINE_LIBRARY_FIX)
SET(STATUS_VST "OK, with workaround linking ${WINE_LIBRARY_FIX}")
ELSE()
SET(STATUS_VST "OK")
ENDIF()
ELSEIF(WANT_VST_NOWINE)
SET(LMMS_SUPPORT_VST TRUE)
SET(STATUS_VST "OK")
ELSE(WINE_FOUND)
SET(STATUS_VST "not found, please install (lib)wine-dev (or similar) - 64 bit systems additionally need gcc-multilib and g++-multilib")
ENDIF(WINE_FOUND)
ENDIF(WANT_VST)
IF(LMMS_BUILD_WIN32)
SET(LMMS_SUPPORT_VST TRUE)
SET(STATUS_VST "OK")
ENDIF(LMMS_BUILD_WIN32)
if(WANT_VST)
if((WANT_VST_32 OR WANT_VST_64) AND NOT LMMS_BUILD_WIN32)
find_package(Wine)
include(CheckWineGcc)
endif()
macro(check_vst bits)
if(NOT WANT_VST_${bits})
set(STATUS_VST_${bits} "Not built, as requested")
elseif(LMMS_BUILD_WIN32)
set(STATUS_VST_${bits} "OK")
set(LMMS_HAVE_VST_${bits} TRUE)
elseif(NOT WINE_FOUND)
set(STATUS_VST_${bits} "not found, please install (lib)wine-dev (or similar) - 64 bit systems additionally need gcc-multilib and g++-multilib")
else()
CheckWineGcc("${bits}" "${WINEGCC}" WINEGCC_WORKING)
if(WINEGCC_WORKING)
set(LMMS_HAVE_VST_${bits} TRUE)
if(WINE_LIBRARY_FIX)
set(STATUS_VST_${bits} "OK, with workaround linking ${WINE_LIBRARY_FIX}")
else()
set(STATUS_VST_${bits} "OK")
endif()
else()
set(STATUS_VST_${bits} "winegcc fails to compile ${bits}-bit binaries, please make sure you have ${bits}-bit GCC libraries")
endif()
endif()
endmacro()
check_vst(32)
check_vst(64)
if(LMMS_HAVE_VST_32 OR LMMS_HAVE_VST_64 OR LMMS_BUILD_LINUX)
set(LMMS_HAVE_VST TRUE)
set(STATUS_VST "OK")
else()
set(STATUS_VST "No hosts selected and available")
endif()
endif()

IF(WANT_DEBUG_FPE)
IF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE)
Expand Down Expand Up @@ -852,8 +871,9 @@ MESSAGE(
"* SoundFont2 player : ${STATUS_FLUIDSYNTH}\n"
"* Sid instrument : ${STATUS_SID}\n"
"* Stk Mallets : ${STATUS_STK}\n"
"* VST-instrument hoster : ${STATUS_VST}\n"
"* VST-effect hoster : ${STATUS_VST}\n"
"* VST plugin host : ${STATUS_VST}\n"
" * 32-bit Windows host : ${STATUS_VST_32}\n"
" * 64-bit Windows host : ${STATUS_VST_64}\n"
"* CALF LADSPA plugins : ${STATUS_CALF}\n"
"* CAPS LADSPA plugins : ${STATUS_CAPS}\n"
"* CMT LADSPA plugins : ${STATUS_CMT}\n"
Expand Down
27 changes: 14 additions & 13 deletions plugins/Vestige/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
IF(LMMS_SUPPORT_VST)
INCLUDE(BuildPlugin)
LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/..")
IF(LMMS_BUILD_LINUX)
LINK_LIBRARIES(-Wl,--enable-new-dtags)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH "$ORIGIN")
ELSE()
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${PLUGIN_DIR}")
ENDIF()
BUILD_PLUGIN(vestige Vestige.cpp Vestige.h MOCFILES Vestige.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
TARGET_LINK_LIBRARIES(vestige vstbase)
ENDIF(LMMS_SUPPORT_VST)
if(NOT LMMS_HAVE_VST)
return()
endif()

include(BuildPlugin)
link_directories("${CMAKE_CURRENT_BINARY_DIR}/..")
if(LMMS_BUILD_LINUX)
link_libraries(-Wl,--enable-new-dtags)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH "$ORIGIN")
else()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${PLUGIN_DIR}")
endif()
build_plugin(vestige Vestige.cpp Vestige.h MOCFILES Vestige.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
target_link_libraries(vestige vstbase)
6 changes: 3 additions & 3 deletions plugins/VstBase/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
IF(NOT LMMS_SUPPORT_VST)
if(NOT LMMS_HAVE_VST)
RETURN()
ENDIF()

Expand Down Expand Up @@ -47,11 +47,11 @@ foreach(var ${export_variables})
endforeach()

# build 32 bit version of RemoteVstPlugin
IF(WANT_VST_32)
if(LMMS_HAVE_VST_32)
INCLUDE("${CMAKE_CURRENT_LIST_DIR}/RemoteVstPlugin32.cmake")
ENDIF()
# build 64 bit version of RemoteVstPlugin
IF(WANT_VST_64)
if(LMMS_HAVE_VST_64)
INCLUDE("${CMAKE_CURRENT_LIST_DIR}/RemoteVstPlugin64.cmake")
ENDIF()

Expand Down
8 changes: 0 additions & 8 deletions plugins/VstBase/RemoteVstPlugin32.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ ELSEIF(LMMS_BUILD_WIN64 AND MSVC)

INSTALL_EXTERNAL_PROJECT(RemoteVstPlugin32)
ELSEIF(LMMS_BUILD_LINUX)
# Use winegcc
INCLUDE(CheckWineGcc)
CheckWineGcc(32 "${WINEGCC}" WINEGCC_WORKING)
IF(NOT WINEGCC_WORKING)
MESSAGE(WARNING "winegcc fails to compile 32-bit binaries, please make sure you have 32-bit GCC libraries")
RETURN()
ENDIF()
ExternalProject_Add(RemoteVstPlugin32
"${EXTERNALPROJECT_ARGS}"
CMAKE_ARGS
Expand All @@ -63,7 +56,6 @@ ELSEIF(LMMS_BUILD_LINUX)
)

INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../32/RemoteVstPlugin32" "${CMAKE_CURRENT_BINARY_DIR}/../32/RemoteVstPlugin32.exe.so" DESTINATION "${PLUGIN_DIR}/32")

ELSEIF(CMAKE_TOOLCHAIN_FILE_32)
ExternalProject_Add(RemoteVstPlugin32
"${EXTERNALPROJECT_ARGS}"
Expand Down
6 changes: 0 additions & 6 deletions plugins/VstBase/RemoteVstPlugin64.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
IF(LMMS_BUILD_WIN64)
ADD_SUBDIRECTORY(RemoteVstPlugin)
ELSEIF(LMMS_BUILD_LINUX)
INCLUDE(CheckWineGcc)
CheckWineGcc(64 "${WINEGCC}" WINEGCC_WORKING)
IF(NOT WINEGCC_WORKING)
MESSAGE(WARNING "winegcc fails to compile 64-bit binaries, please make sure you have 64-bit GCC libraries")
RETURN()
ENDIF()
ExternalProject_Add(RemoteVstPlugin64
"${EXTERNALPROJECT_ARGS}"
CMAKE_ARGS
Expand Down
8 changes: 4 additions & 4 deletions plugins/VstEffect/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
IF(LMMS_SUPPORT_VST)
if(NOT LMMS_HAVE_VST)
return()
endif()

INCLUDE(BuildPlugin)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../vst_base")
LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/..")
Expand All @@ -12,6 +15,3 @@ ENDIF()

BUILD_PLUGIN(vsteffect VstEffect.cpp VstEffectControls.cpp VstEffectControlDialog.cpp VstSubPluginFeatures.cpp VstEffect.h VstEffectControls.h VstEffectControlDialog.h VstSubPluginFeatures.h MOCFILES VstEffectControlDialog.h VstEffectControls.h EMBEDDED_RESOURCES *.png)
TARGET_LINK_LIBRARIES(vsteffect vstbase)

ENDIF(LMMS_SUPPORT_VST)

2 changes: 1 addition & 1 deletion src/3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
IF(LMMS_BUILD_LINUX AND WANT_VST)
if(LMMS_BUILD_LINUX AND LMMS_HAVE_VST)
set(BUILD_SHARED_LIBS OFF)
add_subdirectory(qt5-x11embed)
ENDIF()
Expand Down

0 comments on commit d3ab315

Please sign in to comment.