diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-09-22 15:20:15 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-09-22 15:20:15 +0200 |
commit | 45d89cfd526bf7fa3f7865f2e78f10cd9a85a2f6 (patch) | |
tree | aed64af7cf9f2bab419b6d4e80f0dcc9dd9eb47e /facetracknoir | |
parent | 350edf6e5c1f253a300fd0b7db6591082558d937 (diff) |
fix Linux build
Diffstat (limited to 'facetracknoir')
-rw-r--r-- | facetracknoir/export.hpp | 7 | ||||
-rw-r--r-- | facetracknoir/plugin-api.hpp | 78 | ||||
-rw-r--r-- | facetracknoir/plugin-qt-api.hpp | 65 | ||||
-rw-r--r-- | facetracknoir/plugin-support.cpp | 33 |
4 files changed, 94 insertions, 89 deletions
diff --git a/facetracknoir/export.hpp b/facetracknoir/export.hpp new file mode 100644 index 00000000..8c8bdc69 --- /dev/null +++ b/facetracknoir/export.hpp @@ -0,0 +1,7 @@ +#pragma once +#ifdef _WIN32 +# define OPENTRACK_LINKAGE __declspec(dllexport) +#else +# define OPENTRACK_LINKAGE +#endif +#define OPENTRACK_EXPORT __attribute__ ((visibility ("default"))) OPENTRACK_LINKAGE diff --git a/facetracknoir/plugin-api.hpp b/facetracknoir/plugin-api.hpp index f50b9617..d458d25c 100644 --- a/facetracknoir/plugin-api.hpp +++ b/facetracknoir/plugin-api.hpp @@ -1,7 +1,6 @@ #pragma once -#include <QtGlobal> -#include <QFrame> +#include "facetracknoir/export.hpp" #if defined(_WIN32) # define CALLING_CONVENTION __stdcall @@ -13,75 +12,6 @@ enum Axis { TX = 0, TY, TZ, Yaw, Pitch, Roll }; -struct Metadata -{ - Metadata() {} - virtual ~Metadata() {} - - virtual void getFullName(QString *strToBeFilled) = 0; - virtual void getShortName(QString *strToBeFilled) = 0; - virtual void getDescription(QString *strToBeFilled) = 0; - virtual void getIcon(QIcon *icon) = 0; -}; - -struct IFilter -{ - virtual ~IFilter() = 0; - virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) = 0; - virtual void reset() = 0; -}; - -inline IFilter::~IFilter() {} - -struct IFilterDialog -{ - virtual ~IFilterDialog() {} - virtual void registerFilter(IFilter* tracker) = 0; - virtual void unregisterFilter() = 0; -}; - -struct IProtocol -{ - virtual ~IProtocol() = 0; - virtual bool checkServerInstallationOK() = 0; - virtual void sendHeadposeToGame( const double* headpose ) = 0; - virtual QString getGameName() = 0; -}; - -inline IProtocol::~IProtocol() {} - -struct IProtocolDialog -{ - virtual ~IProtocolDialog() {} - virtual void registerProtocol(IProtocol *protocol) = 0; - virtual void unRegisterProtocol() = 0; -}; - -struct ITracker -{ - virtual ~ITracker() = 0; - virtual void StartTracker( QFrame* frame ) = 0; - virtual void GetHeadPoseData(double *data) = 0; - virtual int preferredHz() { return 200; } -}; - -inline ITracker::~ITracker() {} - -struct ITrackerDialog -{ - virtual ~ITrackerDialog() {} - virtual void registerTracker(ITracker *tracker) = 0; - virtual void unRegisterTracker() = 0; -}; - -#ifndef OPENTRACK_EXPORT -# ifdef IN_OPENTRACK -# if !defined(_MSC_VER) -# define OPENTRACK_EXPORT __attribute__ ((visibility ("default"))) Q_DECL_EXPORT -# else -# error "MSVC support removed" -# endif -# else -# error "Use only for exporting dynamic modules" -# endif -#endif +#ifndef OPENTRACK_CROSS_ONLY +# include "facetracknoir/plugin-qt-api.hpp" +#endif
\ No newline at end of file diff --git a/facetracknoir/plugin-qt-api.hpp b/facetracknoir/plugin-qt-api.hpp new file mode 100644 index 00000000..a8dd153b --- /dev/null +++ b/facetracknoir/plugin-qt-api.hpp @@ -0,0 +1,65 @@ +#pragma once + +#include <QString> +#include <QFrame> + +struct Metadata +{ + Metadata() {} + virtual ~Metadata() {} + + virtual void getFullName(QString *strToBeFilled) = 0; + virtual void getShortName(QString *strToBeFilled) = 0; + virtual void getDescription(QString *strToBeFilled) = 0; + virtual void getIcon(QIcon *icon) = 0; +}; + +struct IFilter +{ + virtual ~IFilter() = 0; + virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) = 0; + virtual void reset() = 0; +}; +inline IFilter::~IFilter() {} + +struct IFilterDialog +{ + virtual ~IFilterDialog() = 0; + virtual void registerFilter(IFilter* tracker) = 0; + virtual void unregisterFilter() = 0; +}; +inline IFilterDialog::~IFilterDialog() {} + +struct IProtocol +{ + virtual ~IProtocol() = 0; + virtual bool checkServerInstallationOK() = 0; + virtual void sendHeadposeToGame( const double* headpose ) = 0; + virtual QString getGameName() = 0; +}; +inline IProtocol::~IProtocol() {} + +struct IProtocolDialog +{ + virtual ~IProtocolDialog() = 0; + virtual void registerProtocol(IProtocol *protocol) = 0; + virtual void unRegisterProtocol() = 0; +}; +inline IProtocolDialog::~IProtocolDialog() {} + +struct ITracker +{ + virtual ~ITracker() = 0; + virtual void StartTracker( QFrame* frame ) = 0; + virtual void GetHeadPoseData(double *data) = 0; + virtual int preferredHz() { return 200; } +}; +inline ITracker::~ITracker() {} + +struct ITrackerDialog +{ + virtual ~ITrackerDialog() = 0; + virtual void registerTracker(ITracker *tracker) = 0; + virtual void unRegisterTracker() = 0; +}; +inline ITrackerDialog::~ITrackerDialog() {}
\ No newline at end of file diff --git a/facetracknoir/plugin-support.cpp b/facetracknoir/plugin-support.cpp index 71279cb9..c6622fe0 100644 --- a/facetracknoir/plugin-support.cpp +++ b/facetracknoir/plugin-support.cpp @@ -1,5 +1,6 @@ #include "plugin-support.h" #include <QCoreApplication> +#include <QFile> #if !(defined(_WIN32)) # include <dlfcn.h> @@ -109,23 +110,25 @@ DynamicLibrary::DynamicLibrary(const QString& filename) : 0 # endif ); - if (handle) - { - struct _foo { - static bool err(void*& handle) + + struct _foo { + static bool err(void*& handle) + { + const char* err = dlerror(); + if (err) { - const char* err = dlerror(); - if (err) - { - fprintf(stderr, "Error, ignoring: %s\n", err); - fflush(stderr); - dlclose(handle); - handle = nullptr; - return true; - } - false; + fprintf(stderr, "Error, ignoring: %s\n", err); + fflush(stderr); + dlclose(handle); + handle = nullptr; + return true; } - }; + false; + } + }; + + if (handle) + { if (_foo::err(handle)) return; Dialog = (DIALOG_FUNPTR) dlsym(handle, "GetDialog"); |