Bump minimum required Qt version to 5.2

This commit is contained in:
Mike Gelfand 2017-02-11 13:24:42 +03:00
parent caf3b7653c
commit 8dc6fb48b1
4 changed files with 48 additions and 89 deletions

View File

@ -25,7 +25,6 @@ tr_auto_option(ENABLE_MAC "Build Mac client" AUTO)
option(ENABLE_NLS "Enable native language support" ON)
option(INSTALL_DOC "Build/install documentation" ON)
option(INSTALL_LIB "Install the library" OFF)
option(USE_QT5 "Use Qt 5 (instead of default Qt 4)" OFF)
tr_auto_option(USE_SYSTEM_EVENT2 "Use system event2 library" AUTO)
tr_auto_option(USE_SYSTEM_DHT "Use system dht library" AUTO)
tr_auto_option(USE_SYSTEM_MINIUPNPC "Use system miniupnpc library" AUTO)
@ -108,6 +107,7 @@ set(GTK_MINIMUM 3.4.0)
set(GLIB_MINIMUM 2.32.0)
set(GIO_MINIMUM 2.26.0)
set(LIBAPPINDICATOR_MINIMUM 0.4.90)
set(QT5_MINIMUM 5.2)
if(WIN32)
foreach(L C CXX)
@ -208,67 +208,40 @@ if(ENABLE_QT)
set(ENABLE_QT_COM_INTEROP OFF)
set(ENABLE_QT_DBUS_INTEROP OFF)
if(USE_QT5)
set(QT5_REQUIRED_MODULES Core Gui Widgets Network LinguistTools)
set(QT5_OPTIONAL_MODULES DBus AxContainer AxServer)
foreach(M ${QT5_REQUIRED_MODULES})
find_package(Qt5${M} QUIET)
if(Qt5${M}_FOUND)
if(NOT M STREQUAL "LinguistTools")
list(APPEND QT_TARGETS Qt5::${M})
endif()
else()
set(QT_TARGETS)
break()
endif()
endforeach()
if(QT_TARGETS)
foreach(M ${QT5_OPTIONAL_MODULES})
find_package(Qt5${M} QUIET)
if(Qt5${M}_FOUND)
list(APPEND QT_TARGETS Qt5::${M})
endif()
endforeach()
if(Qt5AxContainer_FOUND AND Qt5AxServer_FOUND)
set(ENABLE_QT_COM_INTEROP ON)
endif()
if(Qt5DBus_FOUND)
set(ENABLE_QT_DBUS_INTEROP ON)
endif()
endif()
else()
set(QT4_REQUIRED_MODULES QtCore QtGui QtNetwork)
set(QT4_OPTIONAL_MODULES QtDBus QAxContainer QAxServer)
find_package(Qt4 4.8.0 QUIET COMPONENTS ${QT4_REQUIRED_MODULES} OPTIONAL_COMPONENTS ${QT4_OPTIONAL_MODULES})
foreach(M ${QT4_REQUIRED_MODULES})
string(TOUPPER "${M}" M_UPPER)
if(QT_${M_UPPER}_FOUND)
list(APPEND QT_TARGETS Qt4::${M})
else()
set(QT_TARGETS)
break()
endif()
endforeach()
if (QT_TARGETS)
foreach(M ${QT4_OPTIONAL_MODULES})
string(TOUPPER "${M}" M_UPPER)
if(QT_${M_UPPER}_FOUND)
list(APPEND QT_TARGETS Qt4::${M})
endif()
endforeach()
if(QT_QAXCONTAINER_FOUND AND QT_QAXSERVER_FOUND)
set(ENABLE_QT_COM_INTEROP ON)
endif()
if(QT_QTDBUS_FOUND)
set(ENABLE_QT_DBUS_INTEROP ON)
endif()
endif()
endif()
set(QT5_REQUIRED_MODULES Core Gui Widgets Network LinguistTools)
set(QT5_OPTIONAL_MODULES DBus AxContainer AxServer)
if(ENABLE_QT_COM_INTEROP)
find_program(MIDL_EXECUTABLE midl)
if(NOT MIDL_EXECUTABLE)
set(ENABLE_QT_COM_INTEROP OFF)
foreach(M ${QT5_REQUIRED_MODULES})
find_package(Qt5${M} ${QT5_MINIMUM} QUIET)
if(Qt5${M}_FOUND)
if(NOT M STREQUAL "LinguistTools")
list(APPEND QT_TARGETS Qt5::${M})
endif()
else()
set(QT_TARGETS)
break()
endif()
endforeach()
if(QT_TARGETS)
foreach(M ${QT5_OPTIONAL_MODULES})
find_package(Qt5${M} ${QT5_MINIMUM} QUIET)
if(Qt5${M}_FOUND)
list(APPEND QT_TARGETS Qt5::${M})
endif()
endforeach()
if(Qt5AxContainer_FOUND AND Qt5AxServer_FOUND)
set(ENABLE_QT_COM_INTEROP ON)
find_program(MIDL_EXECUTABLE midl)
if(NOT MIDL_EXECUTABLE)
set(ENABLE_QT_COM_INTEROP OFF)
endif()
endif()
if(Qt5DBus_FOUND)
set(ENABLE_QT_DBUS_INTEROP ON)
endif()
endif()
@ -573,7 +546,7 @@ if(INSTALL_DOC)
install(FILES AUTHORS COPYING NEWS README.md extras/rpc-spec.txt extras/send-email-when-torrent-done.sh DESTINATION ${CMAKE_INSTALL_DOCDIR})
endif()
if(MSVC AND ENABLE_DAEMON AND ENABLE_QT AND ENABLE_UTILS AND USE_QT5 AND WITH_CRYPTO STREQUAL "openssl")
if(MSVC AND ENABLE_DAEMON AND ENABLE_QT AND ENABLE_UTILS AND WITH_CRYPTO STREQUAL "openssl")
add_subdirectory(dist/msi)
endif()

View File

@ -184,3 +184,15 @@ function(tr_fixup_bundle_item BUNDLE_DIR BUNDLE_ITEMS DEP_DIRS)
endforeach()
endwhile()
endfunction()
macro(tr_qt_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()
macro(tr_qt_add_resources)
qt5_add_resources(${ARGN})
endmacro()
macro(tr_qt_add_translation)
qt5_add_translation(${ARGN})
endmacro()

View File

@ -17,11 +17,7 @@ if(NOT TR_THIRD_PARTY_DIR)
endif()
if(NOT TR_QT_DIR)
if(USE_QT5)
set(TR_QT_DIR "$<TARGET_FILE_DIR:Qt5::Core>/..")
else()
set(TR_QT_DIR "$<TARGET_FILE_DIR:Qt4::Core>/..")
endif()
set(TR_QT_DIR "$<TARGET_FILE_DIR:Qt5::Core>/..")
endif()
set(ICONS_DIR "${CMAKE_SOURCE_DIR}/qt/icons/hicolor")

View File

@ -1,27 +1,5 @@
project(trqt)
if(USE_QT5)
macro(tr_qt_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()
macro(tr_qt_add_resources)
qt5_add_resources(${ARGN})
endmacro()
macro(tr_qt_add_translation)
qt5_add_translation(${ARGN})
endmacro()
else()
macro(tr_qt_wrap_ui)
qt4_wrap_ui(${ARGN})
endmacro()
macro(tr_qt_add_resources)
qt4_add_resources(${ARGN})
endmacro()
macro(tr_qt_add_translation)
qt4_add_translation(${ARGN})
endmacro()
endif()
set(${PROJECT_NAME}_SOURCES
AboutDialog.cc
AddData.cc