Skip to content

Commit

Permalink
support for Qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
ursfassler committed Jan 4, 2024
1 parent 20def01 commit c4f0eeb
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 4 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/qt6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: build and test with Qt6

on:
pull_request:
branches: [ main ]
workflow_dispatch:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2

- name: setup environment
run: |
sudo apt-get install --no-install-recommends \
cmake \
g++ \
git \
libasio-dev \
libboost-test-dev \
libtclap-dev \
ninja-build \
nlohmann-json3-dev \
qt6-base-dev \
ruby \
ruby-dev
- name: install ruby tools
run: |
sudo gem install bundler
sudo bundle install
- name: install gtest
run: |
git clone https://github.com/google/googletest.git
cd googletest
mkdir build
cd build
cmake ../
cmake --build . --parallel
sudo cmake --install .
- name: build
run: |
cmake -E make_directory build
cmake -E chdir build cmake \
-G Ninja \
-DCUKE_ENABLE_BOOST_TEST=on \
-DCUKE_ENABLE_GTEST=on \
-DCUKE_ENABLE_QT=on \
-DCUKE_ENABLE_EXAMPLES=on \
-DCUKE_TESTS_UNIT=on \
..
cmake --build build --parallel --verbose
- name: unit tests
run: |
cmake --build build --target test
- name: QtCalc examples
run: |
for TEST in \
build/examples/CalcQt/GTestCalculatorQtSteps \
build/examples/CalcQt/QtTestCalculatorQtSteps \
build/examples/CalcQt/BoostCalculatorQtSteps \
; do
"${TEST}" 2> /dev/null &
sleep 1
(cd examples/CalcQt; cucumber)
wait %
done
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.16)

if(NOT CMAKE_VERSION VERSION_LESS "3.3")
# Don't ignore visibility related properties for non-SHARED targets
Expand Down Expand Up @@ -149,12 +149,21 @@ endif()
#

if(CUKE_ENABLE_QT)
find_package(Qt6 COMPONENTS
Core
Gui
Widgets
Test
)

find_package(Qt5Core)
find_package(Qt5Gui)
find_package(Qt5Widgets)
find_package(Qt5Test)

if(Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Widgets_FOUND AND Qt5Test_FOUND)
if(Qt6_FOUND)
message(STATUS "Found Qt version: ${Qt6Core_VERSION}")
elseif(Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Widgets_FOUND AND Qt5Test_FOUND)
message(STATUS "Found Qt version: ${Qt5Core_VERSION_STRING}")
if(Qt5Core_VERSION_STRING VERSION_LESS 5.15.0)
add_library(Qt::Core INTERFACE IMPORTED)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ If you want to contribute code to the project, guidelines are in [CONTRIBUTING.m

It relies on a few executables:

* [cmake](https://cmake.org/download/) 3.9 or later.
* [cmake](https://cmake.org/download/) 3.16 or later.
Required to setup environment and build software

It relies on a few libraries:
Expand All @@ -27,7 +27,7 @@ It relies on a few libraries:
* [GTest](https://github.com/google/googletest) 1.11.0 or later. Optional for the GTest driver.
* [GMock](https://github.com/google/googletest) 1.11.0 or later. Optional for the internal test suite.
* [nlohmann-json](https://github.com/nlohmann/json) 3.10.5 or later.
* [Qt5](http://qt-project.org/). Optional for the CalcQt example and QtTest driver.
* [Qt5 or Qt6](http://qt-project.org/). Optional for the CalcQt example and QtTest driver.
* [TCLAP](https://tclap.sourceforge.net/) 1.2.5 or later.

It might work with earlier versions of the libraries, but it was not tested with them.
Expand Down

0 comments on commit c4f0eeb

Please sign in to comment.