Skip to content

Commit

Permalink
Add Qt6 support
Browse files Browse the repository at this point in the history
Remove deprecated opengl functions
  • Loading branch information
magnesj committed Jan 3, 2024
1 parent 886436d commit b7c4f89
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 28 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,35 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
qtver: [5.12.12, 6.5.3]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache Qt
id: cache-qt
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/Qt/
key: ${{ runner.os }}-QtCache-5-12-12
uses: actions/checkout@v4

- name: Install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v3
with:
version: 5.12.12
version: ${{ matrix.qtver }}
dir: "${{ github.workspace }}/Qt/"
cached: ${{ steps.cache-qt.outputs.cache-hit }}
cache: true
cache-key-prefix: ${{ matrix.qtver }}-${{ matrix.os }}

- name: Install Linux dependencies
if: "contains( matrix.os, 'ubuntu')"
run: sudo apt-get install libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev

- name: Use MSVC (Windows)
uses: ilammy/msvc-dev-cmd@v1

- name: Build
uses: lukka/run-cmake@v1
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: "${{ github.workspace }}/CMakeLists.txt"
cmakeAppendedArgs:
buildDirectory: ${{ github.workspace }}/cmakebuild
buildWithCMakeArgs: "--config Release"
useVcpkgToolchainFile: false

- name: Configure 5.12
if: "contains( matrix.qtver, '5.12')"
run: |
cmake -S . -B build
- name: Configure 6.5
if: "contains( matrix.qtver, '6.5')"
run: |
cmake -S . -DUSE_QT6=TRUE -B build
- name: Build
run: cmake --build build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ plugins
resources
Doxygen.log
*.swp
build
14 changes: 11 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.15)

project(qwt)

Expand All @@ -15,8 +15,16 @@ add_definitions(-DQWT_NO_SVG -DQWT_MOC_INCLUDE)

include(src/CMakeLists.txt)

find_package(Qt5 COMPONENTS REQUIRED Concurrent Core Gui OpenGL PrintSupport Widgets)
set(QT_LIBRARIES Qt5::Concurrent Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::PrintSupport Qt5::Widgets)
option(USE_QT6 "Use Qt6" FALSE)

if(USE_QT6)
find_package(Qt6 COMPONENTS REQUIRED Concurrent Core Gui OpenGLWidgets PrintSupport Widgets)
set(QT_LIBRARIES Qt6::Concurrent Qt6::Core Qt6::Gui Qt6::OpenGLWidgets Qt6::PrintSupport Qt6::Widgets)
else(USE_QT6)
find_package(Qt5 COMPONENTS REQUIRED Concurrent Core Gui OpenGL PrintSupport Widgets)
set(QT_LIBRARIES Qt5::Concurrent Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::PrintSupport Qt5::Widgets)
endif(USE_QT6)


set(CMAKE_AUTOMOC ON)
add_library(${PROJECT_NAME} src/CMakeLists.txt ${HEADER_FILES} ${SOURCE_FILES} )
Expand Down
4 changes: 0 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 2.8.12)

set(HEADER_FILES ${HEADER_FILES}
src/qwt.h
src/qwt_abstract_scale_draw.h
Expand Down Expand Up @@ -207,12 +205,10 @@ src/qwt_scale_widget.cpp)

# QwtOpenGL
set(HEADER_FILES ${HEADER_FILES}
src/qwt_plot_glcanvas.h
src/qwt_plot_opengl_canvas.h
)

set(SOURCE_FILES ${SOURCE_FILES}
src/qwt_plot_glcanvas.cpp
src/qwt_plot_opengl_canvas.cpp
)

Expand Down

0 comments on commit b7c4f89

Please sign in to comment.