Skip to content

Commit

Permalink
ci: Also test Qt 6
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsergio committed Jun 4, 2024
1 parent 7aa924a commit 45a2eac
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 18 deletions.
4 changes: 4 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
cmake --preset=dev -S test/qt_test && \
cmake --build test/qt_test/build-dev && \
tsc && node out/test.js && \
rm -rf test/qt_test/build-dev && \
cmake --preset=dev6 -S test/qt_test && \
cmake --build test/qt_test/build-dev && \
tsc && node out/test.js
17 changes: 13 additions & 4 deletions test/qt_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,26 @@
cmake_minimum_required(VERSION 3.12)
project(qttest)

find_package(Qt5Test 5.15 REQUIRED)
option(USE_QT6 "Use Qt6" OFF)

if (USE_QT6)
find_package(Qt6 6.2 REQUIRED COMPONENTS Test)
set(QT_VERSION 6)
else()
find_package(Qt5 5.15 REQUIRED COMPONENTS Test)
set(QT_VERSION 5)
endif()

set(CMAKE_AUTOMOC ON)

add_executable(test1 test1.cpp)
add_executable(test2 test2.cpp)
add_executable(test3 test3.cpp)
add_executable(non_qttest non_qttest.cpp)

target_link_libraries(test1 Qt5::Test)
target_link_libraries(test2 Qt5::Test)
target_link_libraries(test3 Qt5::Test)
target_link_libraries(test1 Qt${QT_VERSION}::Test)
target_link_libraries(test2 Qt${QT_VERSION}::Test)
target_link_libraries(test3 Qt${QT_VERSION}::Test)

enable_testing()
add_test(NAME test1 COMMAND test1)
Expand Down
36 changes: 22 additions & 14 deletions test/qt_test/CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
{
"version": 2,
"configurePresets": [
{
"name": "dev",
"displayName": "dev",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-dev",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
}
]
}
"version": 2,
"configurePresets": [
{
"name": "dev",
"displayName": "dev",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-dev",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "dev6",
"displayName": "dev6",
"inherits": "dev",
"cacheVariables": {
"USE_QT6": "ON"
}
}
]
}

0 comments on commit 45a2eac

Please sign in to comment.