diff options
author | John Fultz <jfultz@wolfram.com> | 2023-07-16 09:27:48 -0500 |
---|---|---|
committer | John Fultz <jfultz@wolfram.com> | 2023-07-16 09:34:44 -0500 |
commit | 00c2af7db5c330139f4482dc1d99b45c235d82ec (patch) | |
tree | 1910aee565b933b7dc3fd86f14a1c3d632556690 | |
parent | edbeff498efbcda2fe2e841137f6e038ec94329f (diff) |
Add Qt6 to cmake, build action matrix.
The cmake file now takes a QT_VERSION string setting. The first
character of the string is “6”, then cmake calls find_package
on Qt6…otherwise, it calls find_package on Qt5.
Qt 6.5.2 builds added to the GitHub Actions build matrix.
-rw-r--r-- | .github/workflows/build.yml | 20 | ||||
-rw-r--r-- | quacker/CMakeLists.txt | 16 | ||||
-rw-r--r-- | quackleio/CMakeLists.txt | 14 |
3 files changed, 44 insertions, 6 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d616e79..aca3acd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: name: [macos-clang, ubuntu-20.04-clang, ubuntu-20.04-g++, ubuntu-22.04-clang, ubuntu-22.04-g++] - qt_ver: [5.12.0, 5.15.2] + qt_ver: [5.12.0, 5.15.2, 6.5.*] include: - name: macos-clang os: macos-latest @@ -43,6 +43,14 @@ jobs: env: CXX: g++ CC: gcc + - name: windows-x64-vs19-qt-6.5.* + qt_ver: 6.5.* + os: windows-latest + msvc_arch: x64 + qt_arch: win64_msvc2019_64 + env: + CXX: cl + C: cl - name: windows-x64-vs19-qt-5.15.1 qt_ver: 5.15.1 os: windows-latest @@ -59,6 +67,14 @@ jobs: env: CXX: cl C: cl + - name: windows-x86-vs19-qt-6.5.* + qt_ver: 6.5.* + os: windows-latest + msvc_arch: x86 + qt_arch: win32_msvc2019 + env: + CXX: cl + C: cl - name: windows-x86-vs19-qt-5.15.1 qt_ver: 5.15.1 os: windows-latest @@ -99,5 +115,5 @@ jobs: run: | mkdir build cd build - cmake -G Ninja ../quacker + cmake -G Ninja -DQT_VERSION=${{ matrix.qt_ver }} ../quacker ninja -v diff --git a/quacker/CMakeLists.txt b/quacker/CMakeLists.txt index 94d1873..123ee1a 100644 --- a/quacker/CMakeLists.txt +++ b/quacker/CMakeLists.txt @@ -7,12 +7,19 @@ message("-- Configuring Quackle") include("${CMAKE_CURRENT_SOURCE_DIR}/../Settings.cmake") option(BUNDLE "Build app bundle on macOS; does not populate with resources" OFF) +set(QT_VERSION "5" CACHE STRING "Version of Qt (anything past the first digit is ignored)") + add_subdirectory(.. libquackle) add_subdirectory(../quackleio quackleio) add_subdirectory(../data data) -find_package(Qt5 REQUIRED COMPONENTS Core Widgets) +if("${QT_VERSION}" MATCHES "^6") + find_package(Qt6 REQUIRED COMPONENTS Core Widgets) +else() + find_package(Qt5 REQUIRED COMPONENTS Core Widgets) +endif() + set(CMAKE_AUTOMOC ON) set(QUACKLE_SOURCES @@ -97,7 +104,12 @@ else() endif() target_link_libraries(Quackle quackleio libquackle) -target_link_libraries(Quackle Qt5::Core Qt5::Widgets) +if("${QT_VERSION}" MATCHES "^6") + target_link_libraries(Quackle Qt6::Core Qt6::Widgets) +else() + target_link_libraries(Quackle Qt5::Core Qt5::Widgets) +endif() + if(APPLE) target_link_libraries(Quackle "-framework CoreFoundation") diff --git a/quackleio/CMakeLists.txt b/quackleio/CMakeLists.txt index 460839d..d3f1e0a 100644 --- a/quackleio/CMakeLists.txt +++ b/quackleio/CMakeLists.txt @@ -6,7 +6,13 @@ message("-- Configuring libquackleio") include("${CMAKE_CURRENT_SOURCE_DIR}/../Settings.cmake") -find_package(Qt5 REQUIRED COMPONENTS Core) +set(QT_VERSION "5" CACHE STRING "Version of Qt (anything past the first digit is ignored)") + +if("${QT_VERSION}" MATCHES "^6") + find_package(Qt6 REQUIRED COMPONENTS Core Widgets) +else() + find_package(Qt5 REQUIRED COMPONENTS Core Widgets) +endif() set(QUACKLEIO_SOURCES dawgfactory.cpp @@ -41,4 +47,8 @@ add_library(quackleio ${QUACKLEIO_SOURCES} ${QUACKLEIO_HEADERS} ) target_include_directories(quackleio PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..") -target_link_libraries(quackleio Qt5::Core) +if("${QT_VERSION}" MATCHES "^6") + target_link_libraries(quackleio Qt6::Core) +else() + target_link_libraries(quackleio Qt5::Core) +endif() |