Skip to content

Commit

Permalink
[CMake][CI] Add support to Qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarod42 committed Jun 8, 2024
1 parent 4957728 commit 5e17c7d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/windows_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,27 @@ jobs:
windows:
runs-on: windows-latest

strategy:
fail-fast: true
matrix:
qt-version: ['5.15.0', '6.0.4', '6.7.0']

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}}'

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
Expand All @@ -35,7 +43,7 @@ jobs:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: qt-json-editor
name: qt-json-editor-qt${{matrix.qt-version}}
path: |
cmake-build/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 @@ -27,15 +27,19 @@ GroupSources(src)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)

find_package(Qt5 COMPONENTS Widgets Core Gui REQUIRED)
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
endif()

#find_package(Qt5 COMPONENTS Widgets Core Gui LinguistTools REQUIRED)

add_library(qt_json_plugin SHARED ${QtJsonEditor_Plugin_SRCS})
target_link_libraries(qt_json_plugin PUBLIC qt_json_widget)
target_include_directories(qt_json_plugin PUBLIC "src")

add_library(qt_json_widget STATIC ${QtJsonEditor_Widget_SRCS})
target_link_libraries(qt_json_widget PUBLIC Qt5::Widgets Qt5::Core Qt5::Gui)
target_link_libraries(qt_json_widget PUBLIC Qt::Widgets Qt::Core Qt::Gui)
target_include_directories(qt_json_widget PUBLIC "src" "submodules/valijson/include")

add_library(qt_json_dialog STATIC ${QtJsonEditor_Dialog_SRCS})
Expand Down

0 comments on commit 5e17c7d

Please sign in to comment.