From dcbb2cfd0e238f788105d7d249f8aac6ad0823e4 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 11 Jun 2021 17:46:58 +0200 Subject: CMakeLists: require at least Qt 5.12; add Qt 6 support --- CMakeLists.txt | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 39b1b03a..9b53a53a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,9 +72,21 @@ message(STATUS " Header files will be installed to ${CMAKE_INSTALL_PREFIX}/${${ # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) -find_package(Qt5 5.9 REQUIRED Core Network Gui Multimedia Test) -get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE) -message(STATUS "Using Qt ${Qt5_VERSION} at ${Qt5_Prefix}") +option(BUILD_WITH_QT6 "Build Quotient with Qt 6" OFF) + +if (NOT BUILD_WITH_QT6) + # Use Qt5 by default + find_package(Qt5 5.12 QUIET COMPONENTS Core) +endif() +if (NOT Qt5Core_FOUND OR BUILD_WITH_Qt6) + find_package(Qt6 6.2 REQUIRED Core Network Gui Test) # TODO: Multimedia + set(Qt Qt6) +else() + find_package(Qt5 5.12 REQUIRED Core Network Gui Multimedia Test) + set(Qt Qt5) +endif() +get_filename_component($Qt_Prefix "${${Qt}_DIR}/../../../.." ABSOLUTE) +message(STATUS "Using Qt ${${Qt}_VERSION} at ${Qt_Prefix}") if (${PROJECT_NAME}_ENABLE_E2EE) if ((NOT DEFINED USE_INTREE_LIBQOLM OR USE_INTREE_LIBQOLM) @@ -279,7 +291,10 @@ if (${PROJECT_NAME}_ENABLE_E2EE) target_link_libraries(${PROJECT_NAME} QtOlm) set(FIND_DEPS "find_dependency(QtOlm)") # For QuotientConfig.cmake.in endif() -target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Network Qt5::Gui Qt5::Multimedia) +target_link_libraries(${PROJECT_NAME} ${Qt}::Core ${Qt}::Network ${Qt}::Gui) +if (Qt STREQUAL Qt5) # Qt 6 hasn't got Multimedia component as yet + target_link_libraries(${PROJECT_NAME} ${Qt}::Multimedia) +endif() configure_file(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY NEWLINE_STYLE UNIX) -- cgit v1.2.3 From fad6ac5fdee53c349c69afd0ad5e57f340228c6b Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 12 Jun 2021 22:45:15 +0200 Subject: Generate a moc file for quotient_common.h Previously Q_NAMESPACE did not require its own moc, somehow blending into others; now it does. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b53a53a..dfb60ea6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,7 @@ endif() if (NOT Qt5Core_FOUND OR BUILD_WITH_Qt6) find_package(Qt6 6.2 REQUIRED Core Network Gui Test) # TODO: Multimedia set(Qt Qt6) + qt6_wrap_cpp(lib_SRCS lib/quotient_common.h) else() find_package(Qt5 5.12 REQUIRED Core Network Gui Multimedia Test) set(Qt Qt5) @@ -124,7 +125,7 @@ if (${PROJECT_NAME}_ENABLE_E2EE) endif () # Set up source files -set(lib_SRCS +list(APPEND lib_SRCS lib/networkaccessmanager.cpp lib/connectiondata.cpp lib/connection.cpp -- cgit v1.2.3 From 083f62f58bc525d761969133e12a859de9b29648 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sun, 13 Jun 2021 17:11:53 +0200 Subject: CMakeLists: require explicit BUILD_WITH_QT6 for Qt 6 It's not there, it's experimental - people should know what they are doing. --- CMakeLists.txt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index dfb60ea6..d930bbf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,13 +72,9 @@ message(STATUS " Header files will be installed to ${CMAKE_INSTALL_PREFIX}/${${ # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) -option(BUILD_WITH_QT6 "Build Quotient with Qt 6" OFF) +option(BUILD_WITH_QT6 "Build Quotient with Qt 6 (EXPERIMENTAL)" OFF) -if (NOT BUILD_WITH_QT6) - # Use Qt5 by default - find_package(Qt5 5.12 QUIET COMPONENTS Core) -endif() -if (NOT Qt5Core_FOUND OR BUILD_WITH_Qt6) +if (BUILD_WITH_QT6) find_package(Qt6 6.2 REQUIRED Core Network Gui Test) # TODO: Multimedia set(Qt Qt6) qt6_wrap_cpp(lib_SRCS lib/quotient_common.h) -- cgit v1.2.3