Skip to content

Commit

Permalink
ci: update Qt versions in CI (#107)
Browse files Browse the repository at this point in the history
* ci: update Qt versions in CI

* fixes for Qt5.12

---------

Co-authored-by: EFIBootEditor (Bot) <EFIBootEditorBot@users.noreply.github.com>
Co-authored-by: Maciej Szeptuch <neverous@neverous.info>
  • Loading branch information
3 people authored Oct 11, 2023
1 parent 1f21d12 commit 295c4aa
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 21 deletions.
1 change: 1 addition & 0 deletions .github/workflows/asset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
fail-fast: false
matrix:
qt-version:
- 5.12.12 # Supported in Ubuntu Focal Fossa until 2025-04-02
- 5.15.2 # Supported in Ubuntu Jammy Jellyfish until 2027-04-01
- 6.2.4 # Supported in Ubuntu Jammy Jellyfish until 2027-04-01
- 6.5.3 # Supported until 2024-03-31
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
fail-fast: false
matrix:
qt-version:
- 5.12.12 # Supported in Ubuntu Focal Fossa until 2025-04-02
- 5.15.2 # Supported in Ubuntu Jammy Jellyfish until 2027-04-01
- 6.2.4 # Supported in Ubuntu Jammy Jellyfish until 2027-04-01
- 6.5.3 # Supported until 2024-03-31
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Codacy code analysis

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]
schedule:
- cron: '0 8 * * 5'
- cron: 0 8 * * 5

jobs:
codacy-analysis:
Expand All @@ -23,7 +23,7 @@ jobs:
uses: actions/checkout@v4

- name: Run Codacy Code Analysis
uses: codacy/codacy-analysis-cli-action@v4.3.0
uses: codacy/codacy-analysis-cli-action@master
with:
output: codacy.sarif
format: sarif
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Debug build

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]
schedule:
- cron: '0 8 * * 5'
- cron: 0 8 * * 5

concurrency:
group: debug-${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ jobs:
- uses: actions/checkout@v4
- uses: DoozyX/clang-format-lint-action@v0.16.2
with:
source: 'src include'
source: src include
clangFormatVersion: 16
24 changes: 17 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")

if("${QT_VERSION_MAJOR}" STREQUAL "")
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
else()
find_package(QT NAMES Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
endif()

message(STATUS "Qt: ${QT_VERSION_MAJOR}")
Expand All @@ -72,10 +74,10 @@ add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/include")

target_link_libraries(${PROJECT_NAME} PRIVATE
Qt::Core
Qt::Gui
Qt::Network
Qt::Widgets
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Widgets
)

if(${QT_VERSION_MAJOR} LESS_EQUAL 5)
Expand All @@ -93,7 +95,11 @@ if(${QT_VERSION_MAJOR} LESS_EQUAL 5)
endforeach ()
file(APPEND ${QRC} "</qresource></RCC>")

qt_add_resources(RESOURCES ${QRC})
if(${QT_VERSION_MINOR} LESS 15)
qt5_add_resources(RESOURCES ${QRC})
else()
qt_add_resources(RESOURCES ${QRC})
endif()
target_sources(${PROJECT_NAME} PRIVATE ${RESOURCES})
endfunction()
endif()
Expand Down Expand Up @@ -273,7 +279,11 @@ target_sources(${PROJECT_NAME} PRIVATE
)

# Resources:
qt_add_resources(RESOURCES icons.qrc)
if(${QT_VERSION} VERSION_GREATER_EQUAL 5.15)
qt_add_resources(RESOURCES icons.qrc)
else()
qt5_add_resources(RESOURCES icons.qrc)
endif()
target_sources(${PROJECT_NAME} PRIVATE ${RESOURCES})

if(WIN32)
Expand Down Expand Up @@ -416,7 +426,7 @@ else()
endif()

if(LINUXDEPLOY_EXECUTABLE)
get_target_property(QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION)
get_target_property(QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND QMAKE=${QMAKE_EXECUTABLE} ${LINUXDEPLOY_EXECUTABLE} --plugin=qt --appdir=${CMAKE_BINARY_DIR}/appdir/ --executable="$<TARGET_FILE_DIR:${PROJECT_NAME}>/$<TARGET_FILE_NAME:${PROJECT_NAME}>"
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Required libraries[^1]:
[^1]: Remember to install **development** files as well. For example
`qt6-base-dev`, `libefivar-dev`, `libefiboot-dev` on Ubuntu.

- [Qt5](//doc.qt.io/qt-5/gettingstarted.html) (>= 5.15)
- [Qt5](//doc.qt.io/qt-5/gettingstarted.html) (>= 5.12)
or [Qt6](//doc.qt.io/qt-6/get-and-install-qt.html) (>= 6.2)
- [efivar](//github.com/rhboot/efivar) (>= 37) on Linux

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Options:
## Requirements
* [Qt](//www.qt.io/) (>=5.15.2)
* [Qt](//www.qt.io/) (>=5.12)
* [efivar](//github.com/rhboot/efivar) (>=37) on linux
## Installation
Expand Down
17 changes: 14 additions & 3 deletions include/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,21 @@ inline tstring to_tstring(const Type &value)

const int HEX_BASE = 16;

QT_BEGIN_NAMESPACE
/* Qt compatibility */
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
namespace std
{

template <>
struct hash<QString>
{
size_t operator()(const QString &s) const noexcept { return static_cast<size_t>(qHash(s)); }
};

}
#endif

/* QString helpers */
inline std::tstring QStringToStdTString(const QString &string)
{
#if defined(UNICODE) || defined(_UNICODE)
Expand Down Expand Up @@ -157,8 +170,6 @@ inline QString toHex(unsigned long long number, int min_width = 0, const QString
return prefix + QString("%1").arg(number, min_width, HEX_BASE, QChar('0')).toUpper();
}

QT_END_NAMESPACE

inline bool isxnumber(const std::tstring_view &string)
{
#if defined(UNICODE) || defined(_UNICODE)
Expand Down
8 changes: 8 additions & 0 deletions include/efibooteditorcli.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
#include "compat.h"
#include "efibootdata.h"

#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include <QtGlobal>
namespace Qt
{
static const auto endl = ::endl;
}
#endif

class EFIBootEditorCLI: public QObject
{
Q_OBJECT
Expand Down
6 changes: 5 additions & 1 deletion src/efibooteditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ EFIBootEditor::EFIBootEditor(const std::optional<std::tstring> &efi_error_messag
QObject::connect(&data, &EFIBootData::done, this, &EFIBootEditor::hideProgressBar);

QObject::connect(&data, &EFIBootData::timeoutChanged, ui->timeout_number, &QSpinBox::setValue);
QObject::connect(ui->timeout_number, &QSpinBox::valueChanged, &data, &EFIBootData::setTimeout);
QObject::connect(ui->timeout_number, QOverload<int>::of(&QSpinBox::valueChanged), &data, &EFIBootData::setTimeout);

QObject::connect(&data, &EFIBootData::secureBootChanged, ui->secure_boot, &QRadioButton::setChecked);
QObject::connect(&data, &EFIBootData::vendorKeysChanged, ui->vendor_keys, &QRadioButton::setChecked);
Expand Down Expand Up @@ -299,7 +299,11 @@ void EFIBootEditor::updateBootOptionSupport(uint32_t flags)
{
// TODO: (flags & EFIBoot::EFI_BOOT_OPTION_SUPPORT_KEY)
ui->entry_form->showCategory(flags & EFIBoot::EFI_BOOT_OPTION_SUPPORT_APP);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
ui->entries->setTabEnabled(ui->entries->indexOf(ui->sysprep_tab), flags & EFIBoot::EFI_BOOT_OPTION_SUPPORT_SYSPREP);
#else
ui->entries->setTabVisible(ui->entries->indexOf(ui->sysprep_tab), flags & EFIBoot::EFI_BOOT_OPTION_SUPPORT_SYSPREP);
#endif
}

void EFIBootEditor::undoViewChanged(const QModelIndex &)
Expand Down

0 comments on commit 295c4aa

Please sign in to comment.