diff options
Diffstat (limited to 'opentrack')
-rw-r--r-- | opentrack/export.hpp | 28 | ||||
-rw-r--r-- | opentrack/keybinding-worker.hpp | 8 | ||||
-rw-r--r-- | opentrack/plugin-api.hpp | 8 | ||||
-rw-r--r-- | opentrack/selected-libraries.hpp | 8 | ||||
-rw-r--r-- | opentrack/shortcuts.h | 10 | ||||
-rw-r--r-- | opentrack/win32-joystick.hpp | 24 | ||||
-rw-r--r-- | opentrack/win32-shortcuts.h | 8 |
7 files changed, 49 insertions, 45 deletions
diff --git a/opentrack/export.hpp b/opentrack/export.hpp new file mode 100644 index 00000000..a9f3521e --- /dev/null +++ b/opentrack/export.hpp @@ -0,0 +1,28 @@ +#pragma once + +#ifdef BUILD_api +# ifdef _WIN32 +# define OPENTRACK_API_LINKAGE __declspec(dllexport) +# else +# define OPENTRACK_API_LINKAGE +# endif + +# ifndef _MSC_VER +# define OPENTRACK_API_EXPORT __attribute__ ((visibility ("default"))) OPENTRACK_API_LINKAGE +# else +# define OPENTRACK_API_EXPORT OPENTRACK_API_LINKAGE +# endif + +#else + #ifdef _WIN32 + # define OPENTRACK_API_LINKAGE __declspec(dllimport) + #else + # define OPENTRACK_API_LINKAGE + #endif + + #ifndef _MSC_VER + # define OPENTRACK_API_EXPORT __attribute__ ((visibility ("default"))) OPENTRACK_API_LINKAGE + #else + # define OPENTRACK_API_EXPORT OPENTRACK_API_LINKAGE + #endif +#endif diff --git a/opentrack/keybinding-worker.hpp b/opentrack/keybinding-worker.hpp index fa50a974..cb1b3184 100644 --- a/opentrack/keybinding-worker.hpp +++ b/opentrack/keybinding-worker.hpp @@ -8,11 +8,7 @@ #pragma once -#ifdef BUILD_api -# include "opentrack-compat/export.hpp" -#else -# include "opentrack-compat/import.hpp" -#endif +#include "export.hpp" #include "opentrack-compat/timer.hpp" #include "opentrack/win32-joystick.hpp" @@ -41,7 +37,7 @@ public: bool should_process(); }; -struct OPENTRACK_EXPORT KeybindingWorker : private QThread +struct OPENTRACK_API_EXPORT KeybindingWorker : private QThread { private: LPDIRECTINPUT8 din; diff --git a/opentrack/plugin-api.hpp b/opentrack/plugin-api.hpp index dba6fc82..e82f942b 100644 --- a/opentrack/plugin-api.hpp +++ b/opentrack/plugin-api.hpp @@ -13,11 +13,7 @@ #include <QFrame> #include <QIcon> -#ifdef BUILD_api -# include "opentrack-compat/export.hpp" -#else -# include "opentrack-compat/import.hpp" -#endif +#include "export.hpp" #ifndef OPENTRACK_PLUGIN_EXPORT # ifdef _WIN32 @@ -39,7 +35,7 @@ enum Axis { namespace plugin_api { namespace detail { -class OPENTRACK_EXPORT BaseDialog : public QWidget +class OPENTRACK_API_EXPORT BaseDialog : public QWidget { Q_OBJECT public: diff --git a/opentrack/selected-libraries.hpp b/opentrack/selected-libraries.hpp index 5384f9e2..a2e0ff87 100644 --- a/opentrack/selected-libraries.hpp +++ b/opentrack/selected-libraries.hpp @@ -12,13 +12,9 @@ #include <QFrame> -#ifdef BUILD_api -# include "opentrack-compat/export.hpp" -#else -# include "opentrack-compat/import.hpp" -#endif +#include "export.hpp" -struct OPENTRACK_EXPORT SelectedLibraries { +struct OPENTRACK_API_EXPORT SelectedLibraries { using dylibptr = mem<dylib>; mem<ITracker> pTracker; mem<IFilter> pFilter; diff --git a/opentrack/shortcuts.h b/opentrack/shortcuts.h index 38037923..519489df 100644 --- a/opentrack/shortcuts.h +++ b/opentrack/shortcuts.h @@ -12,11 +12,7 @@ #include <vector> #include <functional> -#ifdef BUILD_api -# include "opentrack-compat/export.hpp" -#else -# include "opentrack-compat/import.hpp" -#endif +#include "export.hpp" #include "qxt-mini/QxtGlobalShortcut" #include "opentrack-compat/options.hpp" @@ -28,7 +24,7 @@ using namespace options; -struct OPENTRACK_EXPORT Shortcuts : public QObject { +struct OPENTRACK_API_EXPORT Shortcuts : public QObject { Q_OBJECT public: @@ -39,7 +35,7 @@ public: Key #endif ; - + using fun = std::function<void(void)>; using tt = std::tuple<K, fun>; std::vector<tt> keys; diff --git a/opentrack/win32-joystick.hpp b/opentrack/win32-joystick.hpp index 9c888326..58f11919 100644 --- a/opentrack/win32-joystick.hpp +++ b/opentrack/win32-joystick.hpp @@ -31,18 +31,14 @@ struct hash<QString> }; } -#ifdef BUILD_api -# include "opentrack-compat/export.hpp" -#else -# include "opentrack-compat/import.hpp" -#endif +#include "export.hpp" -struct OPENTRACK_EXPORT win32_joy_ctx +struct OPENTRACK_API_EXPORT win32_joy_ctx { using fn = std::function<void(const QString& guid, int btn, bool held)>; - + enum { joy_axis_size = 65535 }; - + struct joy_info { QString name, guid; @@ -51,10 +47,10 @@ struct OPENTRACK_EXPORT win32_joy_ctx void poll(fn f); bool poll_axis(const QString& guid, int axes[8]); std::vector<joy_info> get_joy_info(); - + win32_joy_ctx(const win32_joy_ctx&) = delete; win32_joy_ctx& operator=(const win32_joy_ctx&) = delete; - + win32_joy_ctx(); ~win32_joy_ctx(); void refresh(); @@ -62,10 +58,10 @@ private: QMutex mtx; QMainWindow fake_main_window; LPDIRECTINPUT8 di; - + static QString guid_to_string(const GUID guid); void release(); - + struct joy { LPDIRECTINPUTDEVICE8 joy_handle; @@ -80,7 +76,7 @@ private: void release(); bool poll(fn f); }; - + std::unordered_map<QString, std::shared_ptr<joy>> joys; class enum_state @@ -88,7 +84,7 @@ private: std::unordered_map<QString, std::shared_ptr<joy>> joys; QMainWindow& fake_main_window; LPDIRECTINPUT8 di; - + std::vector<QString> all; static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE* pdidInstance, VOID* pContext); static BOOL CALLBACK EnumObjectsCallback(const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* ctx); diff --git a/opentrack/win32-shortcuts.h b/opentrack/win32-shortcuts.h index 9b2c6121..825dc03b 100644 --- a/opentrack/win32-shortcuts.h +++ b/opentrack/win32-shortcuts.h @@ -10,13 +10,9 @@ struct win_key; extern QList<win_key> windows_key_mods; extern QList<win_key> windows_key_sequences; -#ifdef BUILD_api -# include "opentrack-compat/export.hpp" -#else -# include "opentrack-compat/import.hpp" -#endif +#include "export.hpp" -struct OPENTRACK_EXPORT win_key +struct OPENTRACK_API_EXPORT win_key { win_key(int win, Qt::Key qt) : win(win), qt(qt) {} int win; |