mirror of
https://github.com/Skycoder42/QHotkey.git
synced 2026-11-19 12:49:58 +03:00
Add CI
This commit is contained in:
@@ -0,0 +1,57 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- "releases/**"
|
||||||
|
paths-ignore:
|
||||||
|
- "**.md"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
qt_version: [5.12.11, 5.15.2, 6.2.0]
|
||||||
|
platform: [ubuntu-20.04, windows-latest, macos-latest]
|
||||||
|
include:
|
||||||
|
- qt_version: 6.2.0
|
||||||
|
additional_arguments: -D QT_MAJOR=6
|
||||||
|
- platform: ubuntu-20.04
|
||||||
|
make: make
|
||||||
|
CXXFLAGS: -Wall -Wextra -pedantic -Werror
|
||||||
|
MAKEFLAGS: -j2
|
||||||
|
- platform: macos-latest
|
||||||
|
make: make
|
||||||
|
CXXFLAGS: -Wall -Wextra -pedantic -Werror -Wno-gnu-zero-variadic-macro-arguments # Ignore false-positive warning for qCWarning
|
||||||
|
MAKEFLAGS: -j3
|
||||||
|
- platform: windows-latest
|
||||||
|
make: nmake
|
||||||
|
CXXFLAGS: /W4 /WX /MP
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
env:
|
||||||
|
CXXFLAGS: ${{ matrix.CXXFLAGS }}
|
||||||
|
MAKEFLAGS: ${{ matrix.MAKEFLAGS }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Clone repo
|
||||||
|
uses: actions/checkout@v2.3.4
|
||||||
|
|
||||||
|
- name: Install Qt
|
||||||
|
uses: jurplel/install-qt-action@v2.14.0
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.qt_version }}
|
||||||
|
|
||||||
|
- name: Build with CMake
|
||||||
|
run: |
|
||||||
|
cmake . -D QHOTKEY_EXAMPLES=ON ${{ matrix.additional_arguments }}
|
||||||
|
cmake --build .
|
||||||
|
|
||||||
|
- name: Setup MSVC environment for QMake
|
||||||
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
|
||||||
|
- name: Build with QMake
|
||||||
|
working-directory: HotkeyTest
|
||||||
|
run: |
|
||||||
|
qmake
|
||||||
|
${{ matrix.make }}
|
||||||
+3
-12
@@ -6,6 +6,7 @@ option(QHOTKEY_EXAMPLES "Build examples" OFF)
|
|||||||
option(QHOTKEY_INSTALL "Enable install rule" ON)
|
option(QHOTKEY_INSTALL "Enable install rule" ON)
|
||||||
|
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
|
||||||
set(QT_MAJOR 5 CACHE STRING "Qt major version to use")
|
set(QT_MAJOR 5 CACHE STRING "Qt major version to use")
|
||||||
|
|
||||||
@@ -15,17 +16,7 @@ else()
|
|||||||
find_package(Qt${QT_MAJOR} COMPONENTS Core Gui REQUIRED)
|
find_package(Qt${QT_MAJOR} COMPONENTS Core Gui REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(QT_MAJOR GREATER_EQUAL 6)
|
add_library(qhotkey QHotkey/qhotkey.cpp)
|
||||||
qt_wrap_cpp(MOC_HEADERS
|
|
||||||
QHotkey/qhotkey.h
|
|
||||||
QHotkey/qhotkey_p.h)
|
|
||||||
else()
|
|
||||||
qt5_wrap_cpp(MOC_HEADERS
|
|
||||||
QHotkey/qhotkey.h
|
|
||||||
QHotkey/qhotkey_p.h)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(qhotkey QHotkey/qhotkey.cpp ${MOC_HEADERS})
|
|
||||||
add_library(QHotkey::QHotkey ALIAS qhotkey)
|
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)
|
||||||
@@ -43,7 +34,7 @@ else()
|
|||||||
if(QT_MAJOR GREATER_EQUAL 6)
|
if(QT_MAJOR GREATER_EQUAL 6)
|
||||||
target_link_libraries(qhotkey PRIVATE ${X11_LIBRARIES})
|
target_link_libraries(qhotkey PRIVATE ${X11_LIBRARIES})
|
||||||
else()
|
else()
|
||||||
find_package(Qt${QT_MAJOR}X11Extras REQUIRED)
|
find_package(Qt${QT_MAJOR} COMPONENTS X11Extras REQUIRED)
|
||||||
target_link_libraries(qhotkey
|
target_link_libraries(qhotkey
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${X11_LIBRARIES}
|
${X11_LIBRARIES}
|
||||||
|
|||||||
@@ -1,17 +1,11 @@
|
|||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
if(QT_MAJOR GREATER_EQUAL 6)
|
set(CMAKE_AUTOUIC ON)
|
||||||
qt_wrap_ui(test_UI_HEADERS hottestwidget.ui)
|
|
||||||
qt_wrap_cpp(test_MOC_HEADERS hottestwidget.h)
|
|
||||||
else()
|
|
||||||
qt5_wrap_ui(test_UI_HEADERS hottestwidget.ui)
|
|
||||||
qt5_wrap_cpp(test_MOC_HEADERS hottestwidget.h)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_executable(HotkeyTest
|
add_executable(HotkeyTest
|
||||||
main.cpp
|
main.cpp
|
||||||
hottestwidget.cpp
|
hottestwidget.cpp
|
||||||
${test_UI_HEADERS}
|
hottestwidget.ui)
|
||||||
${test_MOC_HEADERS})
|
|
||||||
target_link_libraries(HotkeyTest Qt${QT_MAJOR}::Widgets qhotkey)
|
find_package(Qt${QT_MAJOR} COMPONENTS Widgets REQUIRED)
|
||||||
target_include_directories(HotkeyTest PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
target_link_libraries(HotkeyTest Qt${QT_MAJOR}::Widgets QHotkey::QHotkey)
|
||||||
|
|||||||
@@ -59,7 +59,4 @@ private:
|
|||||||
return hotkeyPrivate;\
|
return hotkeyPrivate;\
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Qt::Key)
|
|
||||||
Q_DECLARE_METATYPE(Qt::KeyboardModifiers)
|
|
||||||
|
|
||||||
#endif // QHOTKEY_P_H
|
#endif // QHOTKEY_P_H
|
||||||
|
|||||||
Reference in New Issue
Block a user