diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2021-05-14 17:40:05 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2021-05-14 17:40:30 +0200 |
commit | a68f7141458b5384e859e4c4d61aace0bb5a6d41 (patch) | |
tree | 56719d75dca51b0ef0e1f0006559744e3a4eb9a7 | |
parent | 8f830f974f0fabb7f4ce839dcc581cd68542de9c (diff) |
cmake: update to Qt 6
-rw-r--r-- | cmake/opentrack-i18n.cmake | 4 | ||||
-rw-r--r-- | cmake/opentrack-qt.cmake | 33 | ||||
-rw-r--r-- | qxt-mini/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tracker-hatire/CMakeLists.txt | 6 |
4 files changed, 23 insertions, 22 deletions
diff --git a/cmake/opentrack-i18n.cmake b/cmake/opentrack-i18n.cmake index f3b53895..297307b9 100644 --- a/cmake/opentrack-i18n.cmake +++ b/cmake/opentrack-i18n.cmake @@ -9,7 +9,7 @@ add_custom_target(i18n ALL DEPENDS i18n-lrelease) function(otr_i18n_for_target_directory n) set(k "opentrack-${n}") - get_property(lupdate-binary TARGET "${Qt5_LUPDATE_EXECUTABLE}" PROPERTY IMPORTED_LOCATION) + get_property(lupdate-binary TARGET "Qt6::lupdate" PROPERTY IMPORTED_LOCATION) #make_directory("${CMAKE_CURRENT_BINARY_DIR}/lang") @@ -63,7 +63,7 @@ function(otr_merge_translations) foreach(i ${opentrack_all-translations}) get_property(ts-files GLOBAL PROPERTY "opentrack-ts-files-${i}") - get_property(lrelease-binary TARGET "${Qt5_LRELEASE_EXECUTABLE}" PROPERTY IMPORTED_LOCATION) + get_property(lrelease-binary TARGET "Qt6::lrelease" PROPERTY IMPORTED_LOCATION) set(qm-output "${CMAKE_BINARY_DIR}/${i}.qm") diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake index 41bd6291..ab0b751b 100644 --- a/cmake/opentrack-qt.cmake +++ b/cmake/opentrack-qt.cmake @@ -1,22 +1,21 @@ include_guard(GLOBAL) -if(WIN32) - find_package(Qt5Gui REQUIRED COMPONENTS QWindowsIntegrationPlugin) -endif() set(qt-required-components Core Network Widgets LinguistTools Gui) set(qt-optional-components SerialPort) -set(qt-imported-targets Qt5::Core Qt5::Gui Qt5::Network Qt5::SerialPort Qt5::Widgets) +set(qt-imported-targets Qt6::Core Qt6::Gui Qt6::Network Qt6::SerialPort Qt6::Widgets) if(APPLE) list(APPEND qt-required-components "DBus") list(APPEND qt-optional-components "Multimedia") - list(APPEND qt-imported-targets Qt5::DBus Qt5::Multimedia) + list(APPEND qt-imported-targets Qt6::DBus Qt6::Multimedia) +elseif(WIN32) + list(APPEND qt-required-components) endif() -find_package(Qt5 REQUIRED COMPONENTS ${qt-required-components} QUIET) -find_package(Qt5 COMPONENTS ${qt-optional-components} QUIET) +find_package(Qt6 REQUIRED COMPONENTS ${qt-required-components} QUIET) +find_package(Qt6 COMPONENTS ${qt-optional-components} QUIET) -set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES}) +set(MY_QT_LIBS ${Qt6Core_LIBRARIES} ${Qt6Gui_LIBRARIES} ${Qt6Widgets_LIBRARIES} ${Qt6Network_LIBRARIES}) if(APPLE) - list(APPEND MY_QT_LIBS ${Qt5Multimedia_LIBRARIES} ${Qt5DBus_LIBRARIES}) + list(APPEND MY_QT_LIBS ${Qt6Multimedia_LIBRARIES} ${Qt6DBus_LIBRARIES}) endif() function(otr_install_qt_libs) @@ -24,10 +23,12 @@ function(otr_install_qt_libs) if(NOT TARGET "${i}") continue() endif() - otr_install_lib(${i} ".") + otr_install_lib(${i} "platforms") endforeach() if(WIN32) - otr_install_lib(Qt5::QWindowsIntegrationPlugin "./platforms") + get_property(foo TARGET Qt6::Core PROPERTY IMPORTED_LOCATION) + get_filename_component(foo "${foo}" DIRECTORY) + otr_install_lib("${foo}/../platforms/qwindows.dll" "platforms") endif() endfunction() @@ -37,9 +38,9 @@ function(otr_qt n) if(".${${n}-cc}${${n}-cxx}${${n}-hh}" STREQUAL ".") message(FATAL_ERROR "project ${n} not globbed") endif() - qt5_wrap_cpp(${n}-moc ${${n}-hh} OPTIONS --no-notes -I "${CMAKE_CURRENT_BINARY_DIR}" -I "${CMAKE_SOURCE_DIR}") - qt5_wrap_ui(${n}-uih ${${n}-ui}) - qt5_add_resources(${n}-rcc ${${n}-rc}) + qt6_wrap_cpp(${n}-moc ${${n}-hh} OPTIONS --no-notes -I "${CMAKE_CURRENT_BINARY_DIR}" -I "${CMAKE_SOURCE_DIR}") + qt6_wrap_ui(${n}-uih ${${n}-ui}) + qt6_add_resources(${n}-rcc ${${n}-rc}) foreach(i moc uih rcc) set(${n}-${i} "${${n}-${i}}" PARENT_SCOPE) @@ -50,10 +51,10 @@ endfunction() function(otr_qt2 n) target_include_directories("${n}" PRIVATE SYSTEM - ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} + ${Qt6Core_INCLUDE_DIRS} ${Qt6Gui_INCLUDE_DIRS} ${Qt6Widgets_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS} ) target_compile_definitions("${n}" PRIVATE - ${Qt5Core_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS} + ${Qt6Core_DEFINITIONS} ${Qt6Gui_DEFINITIONS} ${Qt6Widgets_DEFINITIONS} ${Qt6Network_DEFINITIONS} -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_MESSAGELOGCONTEXT ) diff --git a/qxt-mini/CMakeLists.txt b/qxt-mini/CMakeLists.txt index 1b2496f6..c9b079ad 100644 --- a/qxt-mini/CMakeLists.txt +++ b/qxt-mini/CMakeLists.txt @@ -1,6 +1,6 @@ if(UNIX OR APPLE) set(self opentrack-qxt-mini) - include_directories(SYSTEM ${Qt5Gui_PRIVATE_INCLUDE_DIRS}) + include_directories(SYSTEM ${Qt6Gui_PRIVATE_INCLUDE_DIRS}) otr_module(qxt-mini NO-COMPAT BIN) if(APPLE) find_library(CoreFoundation CoreFoundation) diff --git a/tracker-hatire/CMakeLists.txt b/tracker-hatire/CMakeLists.txt index a73a471c..5e18eb2d 100644 --- a/tracker-hatire/CMakeLists.txt +++ b/tracker-hatire/CMakeLists.txt @@ -1,5 +1,5 @@ -if(Qt5SerialPort_FOUND) +if(Qt6SerialPort_FOUND) otr_module(tracker-hatire) - target_link_libraries(${self} ${Qt5SerialPort_LIBRARIES}) - target_include_directories(${self} SYSTEM PUBLIC ${Qt5SerialPort_INCLUDE_DIRS}) + target_link_libraries(${self} ${Qt6SerialPort_LIBRARIES}) + target_include_directories(${self} SYSTEM PUBLIC ${Qt6SerialPort_INCLUDE_DIRS}) endif() |