Skip to content

Commit

Permalink
Support LV2 with MSVC (LMMS#5730)
Browse files Browse the repository at this point in the history
  • Loading branch information
DomClark authored Oct 31, 2020
1 parent f99bf8c commit 7847c30
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 11 deletions.
6 changes: 5 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ environment:
matrix:
- compiler: msvc
install:
- vcpkg install --triplet %PLATFORM%-windows --recurse fftw3 libsamplerate libsndfile sdl2
- 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:
- cd %APPVEYOR_BUILD_FOLDER%
Expand Down
17 changes: 11 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,19 @@ IF(WANT_LV2)
IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(LV2 lv2)
PKG_CHECK_MODULES(LILV lilv-0)
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")
ENDIF()
IF(NOT LV2_FOUND AND NOT LILV_FOUND)
FIND_PACKAGE(LV2 CONFIG)
FIND_PACKAGE(LILV CONFIG)
IF(LILV_FOUND)
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")
Expand Down
7 changes: 6 additions & 1 deletion include/Lv2ControlBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "DataFile.h"
#include "LinkedModelGroups.h"
#include "lmms_export.h"
#include "Plugin.h"

class Lv2Proc;
Expand Down Expand Up @@ -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,
Expand All @@ -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; }

Expand Down
3 changes: 2 additions & 1 deletion include/Lv2SubPluginFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@

#include <lilv/lilv.h>

#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);
Expand Down
3 changes: 2 additions & 1 deletion include/Lv2ViewBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <QVector>

#include "LinkedModelGroupViews.h"
#include "lmms_export.h"
#include "Lv2Basics.h"

class Lv2Proc;
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions plugins/Lv2Effect/Lv2Effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@



extern "C"
{

Plugin::Descriptor PLUGIN_EXPORT lv2effect_plugin_descriptor =
{
STRINGIFY(PLUGIN_NAME),
Expand All @@ -49,6 +52,8 @@ Plugin::Descriptor PLUGIN_EXPORT lv2effect_plugin_descriptor =
new Lv2SubPluginFeatures(Plugin::Effect)
};

}




Expand Down
7 changes: 6 additions & 1 deletion plugins/Lv2Instrument/Lv2Instrument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@



extern "C"
{

Plugin::Descriptor PLUGIN_EXPORT lv2instrument_plugin_descriptor =
{
STRINGIFY(PLUGIN_NAME),
Expand All @@ -55,6 +58,8 @@ Plugin::Descriptor PLUGIN_EXPORT lv2instrument_plugin_descriptor =
new Lv2SubPluginFeatures(Plugin::Instrument)
};

}




Expand Down Expand Up @@ -221,7 +226,7 @@ Lv2InsView::Lv2InsView(Lv2Instrument *_instrument, QWidget *_parent) :
setAutoFillBackground(true);
if (m_reloadPluginButton) {
connect(m_reloadPluginButton, &QPushButton::clicked,
this, [this](){ castModel<Lv2Instrument>()->reloadPlugin();} );
this, [this](){ this->castModel<Lv2Instrument>()->reloadPlugin();} );
}
if (m_toggleUIButton) {
connect(m_toggleUIButton, &QPushButton::toggled,
Expand Down

0 comments on commit 7847c30

Please sign in to comment.