Skip to content

Commit

Permalink
[CI][premake] Use Qt5.15.0 and Qt6.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarod42 committed Jun 16, 2024
1 parent c9b8c79 commit 426b7a0
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 12 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ jobs:
linux:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
qt-version: ['5.15.0', '6.0.4']
# In qt6.1+, moc/uic/rcc binaries have been move from usr/bin to usr/lib/qt6/

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Installing Qt5.15.0 ubuntu
- name: Installing Qt${{matrix.qt-version}} ubuntu
uses: jurplel/install-qt-action@v4
with:
version: '5.15.0'
version: ${{matrix.qt-version}}
cache: true
cache-key-prefix: 'qt-action@v4-Qt5.15.0_ubuntu'
cache-key-prefix: 'qt-action@v4-Qt${{matrix.qt-version}}_ubuntu'

- name: set path
run: |
Expand Down Expand Up @@ -53,7 +59,7 @@ jobs:
- name: build with premake
run: |
./premake5 gmake2 && cd solution/gmake2 && make config=release_x64
./premake5 gmake2 --qt-version=${{matrix.qt-version}} && cd solution/gmake2 && make config=release_x64
#
# - name: install libxkbcommon-x11-0 # display dependency
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/windows_premake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,26 @@ jobs:
windows:
runs-on: windows-latest

strategy:
fail-fast: true
matrix:
qt-version: ['5.15.0', '6.0.4']
include:
- qt-arch: 'win64_msvc2019_64' # No 2022 version yet

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Installing Qt - 5.15.0 win64_msvc2019_64 # No 2022 version yet
- name: Installing Qt - ${{matrix.qt-version}} ${{matrix.qt-arch}}
uses: jurplel/install-qt-action@v4
with:
version: '5.15.0'
arch: win64_msvc2019_64
version: ${{matrix.qt-version}}
arch: ${{matrix.qt-arch}}
cache: true
cache-key-prefix: 'qt-action@v4-Qt5.15.0_win64_msvc2019_64'
cache-key-prefix: 'qt-action@v4-Qt${{matrix.qt-version}}_${{matrix.qt-arch}}'

# Premake
- name: checkout premake5
Expand All @@ -40,12 +47,12 @@ jobs:

- name: build with premake
run: |
./premake5 vs2022 --qt-root=$Env:QT_ROOT_DIR && cd solution/vs2022 && msbuild.exe /property:Configuration=Release /property:Platform=x64 qt-json-editor.sln
./premake5 vs2022 --qt-root=$Env:QT_ROOT_DIR --qt-version=${{matrix.qt-version}} && cd solution/vs2022 && msbuild.exe /property:Configuration=Release /property:Platform=x64 qt-json-editor.sln
- name: Upload
uses: actions/upload-artifact@v4
with:
name: qt-json-editor
name: qt-json-editor-qt${{matrix.qt-version}}
path: |
bin/vs2022/x64/Release/*.*
${{ env.QT_ROOT_DIR }}/plugins/designer/qt-json-designer-plugin.*
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)

find_package(Qt6 COMPONENTS Core Gui Widgets) # LinguistTools
if (NOT Qt6_FOUND)
find_package(Qt5 5.15 REQUIRED COMPONENTS Core Gui Widgets) # Qt 5.15 introduced versionless targets
if (Qt6_FOUND)
if (NOT MSVC)
add_compile_options( -include "${CMAKE_SOURCE_DIR}/src/Qt6_0_workaround.h") # workaround for Qt6.0 with missing #include <limits>
endif()
else()
find_package(Qt5 5.15 REQUIRED COMPONENTS Core Gui Widgets) # Qt 5.15 introduced versionless targets
endif()

#find_package(Qt5 COMPONENTS Widgets Core Gui LinguistTools REQUIRED)
Expand Down
4 changes: 4 additions & 0 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ workspace "qt-json-editor"
end
qtversion ( _OPTIONS["qt-version"] )

if premake.checkVersion(_OPTIONS["qt-version"], '>=6.0 <6.1') or os.target() ~= premake.WINDOWS then
forceincludes "src/Qt6_0_workaround.h"
end

filter "platforms:x32"
architecture "x32"
filter "platforms:x64"
Expand Down
8 changes: 8 additions & 0 deletions src/Qt6_0_workaround.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once

#if 1 // Workaround for QT6.0.x bug
# include <QtGlobal>
# if (QT_VERSION_CHECK(6, 0, 0) <= QT_VERSION) && (QT_VERSION <= QT_VERSION_CHECK(6, 1, 0))
# include <limits>
# endif
#endif

0 comments on commit 426b7a0

Please sign in to comment.