From 970fb7245972d2a3dc7534e3a41484d888d6b1b8 Mon Sep 17 00:00:00 2001 From: Dominic Clark Date: Sat, 24 Oct 2020 18:57:52 +0100 Subject: [PATCH 1/3] Support LV2 with MSVC --- .appveyor.yml | 2 +- CMakeLists.txt | 15 ++++++++++----- include/Lv2ControlBase.h | 7 ++++++- include/Lv2SubPluginFeatures.h | 3 ++- include/Lv2ViewBase.h | 3 ++- plugins/Lv2Effect/Lv2Effect.cpp | 5 +++++ plugins/Lv2Instrument/Lv2Instrument.cpp | 7 ++++++- 7 files changed, 32 insertions(+), 10 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 7ca7d58c4ce..cd5254d7ed0 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -8,7 +8,7 @@ environment: matrix: - compiler: msvc install: - - vcpkg install --triplet %PLATFORM%-windows --recurse fftw3 libsamplerate libsndfile sdl2 + - vcpkg install --triplet %PLATFORM%-windows --recurse fftw3 libsamplerate libsndfile lilv lv2 sdl2 - nuget install clcache -Version 4.1.0 build_script: - cd %APPVEYOR_BUILD_FOLDER% diff --git a/CMakeLists.txt b/CMakeLists.txt index a3c83c1a4b6..25d45f5646a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,14 +201,19 @@ IF(WANT_LV2) IF(PKG_CONFIG_FOUND) PKG_CHECK_MODULES(LV2 lv2) PKG_CHECK_MODULES(LILV lilv-0) + ENDIF() + IF(NOT LV2_FOUND AND NOT LILV_FOUND) + FIND_PACKAGE(LV2 CONFIG) + FIND_PACKAGE(LILV CONFIG) IF(LV2_FOUND AND LILV_FOUND) - SET(LMMS_HAVE_LV2 TRUE) - SET(STATUS_LV2 "OK") - ELSE() - SET(STATUS_LV2 "not found, install it or set PKG_CONFIG_PATH appropriately") + SET(LILV_LIBRARIES "lilv::lilv") ENDIF() + ENDIF() + IF(LV2_FOUND AND LILV_FOUND) + SET(LMMS_HAVE_LV2 TRUE) + SET(STATUS_LV2 "OK") ELSE() - SET(STATUS_LV2 "not found, requires pkg-config") + SET(STATUS_LV2 "not found, install it or set PKG_CONFIG_PATH appropriately") ENDIF() ELSE(WANT_LV2) SET(STATUS_LV2 "not built as requested") diff --git a/include/Lv2ControlBase.h b/include/Lv2ControlBase.h index d5d83f37800..acfbea25ee4 100644 --- a/include/Lv2ControlBase.h +++ b/include/Lv2ControlBase.h @@ -33,6 +33,7 @@ #include "DataFile.h" #include "LinkedModelGroups.h" +#include "lmms_export.h" #include "Plugin.h" class Lv2Proc; @@ -65,7 +66,7 @@ class PluginIssue; * this class can not override virtuals of Instrument or EffectControls, so it will offer functions that must be called by virtuals in its child class */ -class Lv2ControlBase : public LinkedModelGroups +class LMMS_EXPORT Lv2ControlBase : public LinkedModelGroups { public: static Plugin::PluginTypes check(const LilvPlugin* m_plugin, @@ -87,7 +88,11 @@ class Lv2ControlBase : public LinkedModelGroups //! this is the same pointer as this, but a different type //! @param uri the Lv2 URI telling this class what plugin to construct Lv2ControlBase(class Model *that, const QString& uri); + Lv2ControlBase(const Lv2ControlBase&) = delete; ~Lv2ControlBase() override; + + Lv2ControlBase& operator=(const Lv2ControlBase&) = delete; + //! Must be checked after ctor or reload bool isValid() const { return m_valid; } diff --git a/include/Lv2SubPluginFeatures.h b/include/Lv2SubPluginFeatures.h index 33c29c3ef26..fee3c381216 100644 --- a/include/Lv2SubPluginFeatures.h +++ b/include/Lv2SubPluginFeatures.h @@ -33,9 +33,10 @@ #include +#include "lmms_export.h" #include "Plugin.h" -class Lv2SubPluginFeatures : public Plugin::Descriptor::SubPluginFeatures +class LMMS_EXPORT Lv2SubPluginFeatures : public Plugin::Descriptor::SubPluginFeatures { private: static const LilvPlugin *getPlugin(const Key &k); diff --git a/include/Lv2ViewBase.h b/include/Lv2ViewBase.h index 980e1f7efcf..5ccbbb75be1 100644 --- a/include/Lv2ViewBase.h +++ b/include/Lv2ViewBase.h @@ -34,6 +34,7 @@ #include #include "LinkedModelGroupViews.h" +#include "lmms_export.h" #include "Lv2Basics.h" class Lv2Proc; @@ -54,7 +55,7 @@ class Lv2ViewProc : public LinkedModelGroupView //! Base class for view for one Lv2 plugin -class Lv2ViewBase : public LinkedModelGroupsView +class LMMS_EXPORT Lv2ViewBase : public LinkedModelGroupsView { protected: //! @param pluginWidget A child class which inherits QWidget diff --git a/plugins/Lv2Effect/Lv2Effect.cpp b/plugins/Lv2Effect/Lv2Effect.cpp index 4f84104bbe9..dd0c4c44ff9 100644 --- a/plugins/Lv2Effect/Lv2Effect.cpp +++ b/plugins/Lv2Effect/Lv2Effect.cpp @@ -35,6 +35,9 @@ +extern "C" +{ + Plugin::Descriptor PLUGIN_EXPORT lv2effect_plugin_descriptor = { STRINGIFY(PLUGIN_NAME), @@ -49,6 +52,8 @@ Plugin::Descriptor PLUGIN_EXPORT lv2effect_plugin_descriptor = new Lv2SubPluginFeatures(Plugin::Effect) }; +} + diff --git a/plugins/Lv2Instrument/Lv2Instrument.cpp b/plugins/Lv2Instrument/Lv2Instrument.cpp index ca918d2ed04..d67e2549290 100644 --- a/plugins/Lv2Instrument/Lv2Instrument.cpp +++ b/plugins/Lv2Instrument/Lv2Instrument.cpp @@ -41,6 +41,9 @@ +extern "C" +{ + Plugin::Descriptor PLUGIN_EXPORT lv2instrument_plugin_descriptor = { STRINGIFY(PLUGIN_NAME), @@ -55,6 +58,8 @@ Plugin::Descriptor PLUGIN_EXPORT lv2instrument_plugin_descriptor = new Lv2SubPluginFeatures(Plugin::Instrument) }; +} + @@ -221,7 +226,7 @@ Lv2InsView::Lv2InsView(Lv2Instrument *_instrument, QWidget *_parent) : setAutoFillBackground(true); if (m_reloadPluginButton) { connect(m_reloadPluginButton, &QPushButton::clicked, - this, [this](){ castModel()->reloadPlugin();} ); + this, [this](){ this->castModel()->reloadPlugin();} ); } if (m_toggleUIButton) { connect(m_toggleUIButton, &QPushButton::toggled, From 1bb588dbc40788baaf746e53aaade6cfe525dee5 Mon Sep 17 00:00:00 2001 From: Dominic Clark Date: Sat, 24 Oct 2020 19:51:18 +0100 Subject: [PATCH 2/3] Update vcpkg on AppVeyor --- .appveyor.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.appveyor.yml b/.appveyor.yml index cd5254d7ed0..9b25ff5e437 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -8,6 +8,10 @@ environment: matrix: - compiler: msvc install: + - cd C:\Tools\vcpkg + - git pull + - .\bootstrap-vcpkg.bat + - cd %APPVEYOR_BUILD_FOLDER% - vcpkg install --triplet %PLATFORM%-windows --recurse fftw3 libsamplerate libsndfile lilv lv2 sdl2 - nuget install clcache -Version 4.1.0 build_script: From 704de9501d4f196889e7500f61b38a876b8b6437 Mon Sep 17 00:00:00 2001 From: Dominic Clark Date: Thu, 29 Oct 2020 11:34:26 +0000 Subject: [PATCH 3/3] Simplify CMake condition --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25d45f5646a..580b7e527d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,7 +205,7 @@ IF(WANT_LV2) IF(NOT LV2_FOUND AND NOT LILV_FOUND) FIND_PACKAGE(LV2 CONFIG) FIND_PACKAGE(LILV CONFIG) - IF(LV2_FOUND AND LILV_FOUND) + IF(LILV_FOUND) SET(LILV_LIBRARIES "lilv::lilv") ENDIF() ENDIF()