mirror of
https://github.com/Skycoder42/QHotkey.git
synced 2026-11-19 12:49:58 +03:00
Fix shared library build
This commit is contained in:
@@ -45,16 +45,27 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: ${{ matrix.qt_version }}
|
version: ${{ matrix.qt_version }}
|
||||||
|
|
||||||
- name: Build with CMake
|
- name: Build with CMake as static
|
||||||
run: |
|
run: |
|
||||||
cmake . -D QHOTKEY_EXAMPLES=ON ${{ matrix.additional_arguments }}
|
cmake . -D QHOTKEY_EXAMPLES=ON ${{ matrix.additional_arguments }}
|
||||||
cmake --build .
|
cmake --build .
|
||||||
|
|
||||||
|
- name: Build with CMake as shared
|
||||||
|
run: |
|
||||||
|
cmake . -D BUILD_SHARED_LIBS=ON -D QHOTKEY_EXAMPLES=ON ${{ matrix.additional_arguments }}
|
||||||
|
cmake --build .
|
||||||
|
|
||||||
- name: Setup MSVC environment for QMake
|
- name: Setup MSVC environment for QMake
|
||||||
uses: ilammy/msvc-dev-cmd@v1
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
|
||||||
- name: Build with QMake
|
- name: Build with QMake as static
|
||||||
working-directory: HotkeyTest
|
working-directory: HotkeyTest
|
||||||
run: |
|
run: |
|
||||||
qmake
|
qmake
|
||||||
${{ matrix.make }}
|
${{ matrix.make }}
|
||||||
|
|
||||||
|
- name: Build with QMake as shared
|
||||||
|
working-directory: HotkeyTest
|
||||||
|
run: |
|
||||||
|
qmake "DEFINES+=QHOTKEY_SHARED QHOTKEY_LIBRARY"
|
||||||
|
${{ matrix.make }}
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ add_library(QHotkey::QHotkey ALIAS qhotkey)
|
|||||||
target_link_libraries(qhotkey PUBLIC Qt${QT_MAJOR}::Core)
|
target_link_libraries(qhotkey PUBLIC Qt${QT_MAJOR}::Core)
|
||||||
target_link_libraries(qhotkey PRIVATE Qt${QT_MAJOR}::Gui)
|
target_link_libraries(qhotkey PRIVATE Qt${QT_MAJOR}::Gui)
|
||||||
|
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
target_compile_definitions(qhotkey PRIVATE QHOTKEY_LIBRARY)
|
||||||
|
target_compile_definitions(qhotkey PUBLIC QHOTKEY_SHARED)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
find_library(CARBON_LIBRARY Carbon)
|
find_library(CARBON_LIBRARY Carbon)
|
||||||
mark_as_advanced(CARBON_LIBRARY)
|
mark_as_advanced(CARBON_LIBRARY)
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ VERSION = 1.2.1
|
|||||||
|
|
||||||
include(../qhotkey.pri)
|
include(../qhotkey.pri)
|
||||||
|
|
||||||
DEFINES += QHOTKEY_LIB QHOTKEY_LIB_BUILD
|
DEFINES += QHOTKEY_SHARED QHOTKEY_LIBRARY
|
||||||
|
|
||||||
# use INSTALL_ROOT to modify the install location
|
# use INSTALL_ROOT to modify the install location
|
||||||
headers.files = $$PUBLIC_HEADERS
|
headers.files = $$PUBLIC_HEADERS
|
||||||
|
|||||||
+10
-10
@@ -6,14 +6,14 @@
|
|||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
#ifdef QHOTKEY_LIB
|
#ifdef QHOTKEY_SHARED
|
||||||
#ifdef QHOTKEY_LIB_BUILD
|
# ifdef QHOTKEY_LIBRARY
|
||||||
#define QHOTKEY_SHARED_EXPORT Q_DECL_EXPORT
|
# define QHOTKEY_EXPORT Q_DECL_EXPORT
|
||||||
# else
|
# else
|
||||||
#define QHOTKEY_SHARED_EXPORT Q_DECL_IMPORT
|
# define QHOTKEY_EXPORT Q_DECL_IMPORT
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
#define QHOTKEY_SHARED_EXPORT
|
# define QHOTKEY_EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//! A class to define global, systemwide Hotkeys
|
//! A class to define global, systemwide Hotkeys
|
||||||
class QHOTKEY_SHARED_EXPORT QHotkey : public QObject
|
class QHOTKEY_EXPORT QHotkey : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
//! @private
|
//! @private
|
||||||
@@ -36,7 +36,7 @@ class QHOTKEY_SHARED_EXPORT QHotkey : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
//! Defines shortcut with native keycodes
|
//! Defines shortcut with native keycodes
|
||||||
class QHOTKEY_SHARED_EXPORT NativeShortcut {
|
class QHOTKEY_EXPORT NativeShortcut {
|
||||||
public:
|
public:
|
||||||
//! The native keycode
|
//! The native keycode
|
||||||
quint32 key;
|
quint32 key;
|
||||||
@@ -120,10 +120,10 @@ private:
|
|||||||
bool _registered;
|
bool _registered;
|
||||||
};
|
};
|
||||||
|
|
||||||
QHOTKEY_HASH_SEED QHOTKEY_SHARED_EXPORT qHash(QHotkey::NativeShortcut key);
|
QHOTKEY_HASH_SEED QHOTKEY_EXPORT qHash(QHotkey::NativeShortcut key);
|
||||||
QHOTKEY_HASH_SEED QHOTKEY_SHARED_EXPORT qHash(QHotkey::NativeShortcut key, QHOTKEY_HASH_SEED seed);
|
QHOTKEY_HASH_SEED QHOTKEY_EXPORT qHash(QHotkey::NativeShortcut key, QHOTKEY_HASH_SEED seed);
|
||||||
|
|
||||||
QHOTKEY_SHARED_EXPORT Q_DECLARE_LOGGING_CATEGORY(logQHotkey)
|
QHOTKEY_EXPORT Q_DECLARE_LOGGING_CATEGORY(logQHotkey)
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QHotkey::NativeShortcut)
|
Q_DECLARE_METATYPE(QHotkey::NativeShortcut)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
#define _NATIVE_EVENT_RESULT long
|
#define _NATIVE_EVENT_RESULT long
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class QHOTKEY_SHARED_EXPORT QHotkeyPrivate : public QObject, public QAbstractNativeEventFilter
|
class QHOTKEY_EXPORT QHotkeyPrivate : public QObject, public QAbstractNativeEventFilter
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user