aboutsummaryrefslogtreecommitdiff
path: root/visualization/renderer/qmpvisrendercore.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2020-05-02 11:08:53 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2020-05-02 11:08:53 +0800
commit3190dcfb79057cea4cdbe86a6354341b9974ee75 (patch)
treed561507432a4dad0075888acb8603db833d5ba12 /visualization/renderer/qmpvisrendercore.cpp
parent86f10fa1bcdc25bf4a91e9b07322edcaa885fe49 (diff)
downloadQMidiPlayer-3190dcfb79057cea4cdbe86a6354341b9974ee75.tar.xz
(presumably) Ported the visualization renderer to Windows.
Diffstat (limited to 'visualization/renderer/qmpvisrendercore.cpp')
-rw-r--r--visualization/renderer/qmpvisrendercore.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/visualization/renderer/qmpvisrendercore.cpp b/visualization/renderer/qmpvisrendercore.cpp
index f8044f5..c4d1079 100644
--- a/visualization/renderer/qmpvisrendercore.cpp
+++ b/visualization/renderer/qmpvisrendercore.cpp
@@ -6,7 +6,14 @@
#include <algorithm>
#include <cassert>
+#ifdef _WIN32
+#include <windows.h>
+#define dlopen(a,b) LoadLibraryW(a)
+#define dlsym GetProcAddress
+#define dlclose FreeLibrary
+#else
#include <dlfcn.h>
+#endif
#include <QProcess>
#include <QCommandLineParser>
@@ -26,7 +33,24 @@ qmpVisRenderCore::qmpVisRenderCore(QCommandLineParser *_clp):QObject(nullptr),cl
bool qmpVisRenderCore::loadVisualizationLibrary()
{
- mp=dlopen("libvisualization.so",RTLD_LAZY);
+#ifdef _WIN32
+ std::vector<std::wstring> libpath={
+ QCoreApplication::applicationDirPath().toStdWString()+L"/plugins/libvisualization.dll"
+ L"libvisualization.dll",
+ L"../libvisualization.dll"//for debugging only...?
+ };
+#else
+ std::vector<std::string> libpath={
+ QCoreApplication::applicationDirPath().toStdString()+"/plugins/libvisualization.so"
+ QT_STRINGIFY(INSTALL_PREFIX)+std::string("/lib/qmidiplayer/libvisualization.so"),
+ "../libvisualization.so"//for debugging only
+ };
+#endif
+ for(auto&l:libpath)
+ {
+ mp=dlopen(l.c_str(),RTLD_LAZY);
+ if(mp)break;
+ }
if(!mp)
{
fprintf(stderr,"failed to load the visualization module!\n");