From 0943bb04941d14349a7a3f280119325cd63cf3b8 Mon Sep 17 00:00:00 2001 From: Skycoder42 Date: Mon, 23 Oct 2017 15:36:25 +0200 Subject: [PATCH] lib fixup --- QHotkey/QHotkey.pro | 18 ++++++++++++------ QHotkey/qhotkey.h | 20 +++++++++++++++----- QHotkey/qhotkey_p.h | 2 +- qhotkey.pri | 3 ++- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/QHotkey/QHotkey.pro b/QHotkey/QHotkey.pro index 14eeb1f..44e937b 100644 --- a/QHotkey/QHotkey.pro +++ b/QHotkey/QHotkey.pro @@ -1,10 +1,16 @@ -TARGET = QHotkey -CONFIG += dll -VERSION = 1.0 TEMPLATE = lib +win32: CONFIG += dll + +TARGET = QHotkey +VERSION = 1.2.1 + include(../qhotkey.pri) -headers.files = $$HEADERS QHotkey -headers.path = /$(DESTDIR)$$[QT_INSTALL_HEADERS] -target.path = /$(DESTDIR)$$[QT_INSTALL_LIBS] + +DEFINES += QHOTKEY_LIB QHOTKEY_LIB_BUILD + +# use INSTALL_ROOT to modify the install location +headers.files = $$PUBLIC_HEADERS +headers.path = $$[QT_INSTALL_HEADERS] +target.path = $$[QT_INSTALL_LIBS] INSTALLS += target headers diff --git a/QHotkey/qhotkey.h b/QHotkey/qhotkey.h index cbf41d8..92d13c8 100644 --- a/QHotkey/qhotkey.h +++ b/QHotkey/qhotkey.h @@ -6,8 +6,18 @@ #include #include +#ifdef QHOTKEY_LIB + #ifdef QHOTKEY_LIB_BUILD + #define QHOTKEY_SHARED_EXPORT Q_DECL_EXPORT + #else + #define QHOTKEY_SHARED_EXPORT Q_DECL_IMPORT + #endif +#else + #define QHOTKEY_SHARED_EXPORT +#endif + //! A class to define global, systemwide Hotkeys -class QHotkey : public QObject +class QHOTKEY_SHARED_EXPORT QHotkey : public QObject { Q_OBJECT friend class QHotkeyPrivate; @@ -19,7 +29,7 @@ class QHotkey : public QObject public: //! Defines shortcut with native keycodes - class NativeShortcut { + class QHOTKEY_SHARED_EXPORT NativeShortcut { public: //! The native keycode quint32 key; @@ -95,9 +105,9 @@ private: bool _registered; }; -uint qHash(const QHotkey::NativeShortcut &key); -uint qHash(const QHotkey::NativeShortcut &key, uint seed); +uint QHOTKEY_SHARED_EXPORT qHash(const QHotkey::NativeShortcut &key); +uint QHOTKEY_SHARED_EXPORT qHash(const QHotkey::NativeShortcut &key, uint seed); -Q_DECLARE_LOGGING_CATEGORY(logQHotkey) +QHOTKEY_SHARED_EXPORT Q_DECLARE_LOGGING_CATEGORY(logQHotkey) #endif // QHOTKEY_H diff --git a/QHotkey/qhotkey_p.h b/QHotkey/qhotkey_p.h index 448b95e..7ba4123 100644 --- a/QHotkey/qhotkey_p.h +++ b/QHotkey/qhotkey_p.h @@ -7,7 +7,7 @@ #include #include -class QHotkeyPrivate : public QObject, public QAbstractNativeEventFilter +class QHOTKEY_SHARED_EXPORT QHotkeyPrivate : public QObject, public QAbstractNativeEventFilter { Q_OBJECT diff --git a/qhotkey.pri b/qhotkey.pri index d1a7d91..1dc2ae9 100644 --- a/qhotkey.pri +++ b/qhotkey.pri @@ -1,6 +1,7 @@ CONFIG += C++11 -PUBLIC_HEADERS += $$PWD/QHotkey/qhotkey.h +PUBLIC_HEADERS += $$PWD/QHotkey/qhotkey.h \ + $$PWD/QHotkey/QHotkey HEADERS += $$PUBLIC_HEADERS \ $$PWD/QHotkey/qhotkey_p.h