Skip to content
Permalink
Browse files
Require Qt >= 5.5
  • Loading branch information
nyalldawson committed Sep 20, 2016
1 parent 361dd2e commit 88e4410af11ecb53f616f1d98f5f9ee49827ccd5
@@ -246,47 +246,28 @@ ELSE (WITH_QTWEBKIT)
MESSAGE(STATUS "Qt WebKit support DISABLED.")
ENDIF(WITH_QTWEBKIT)
#############################################################
# search for Qt4
SET(QT_MIN_VERSION 4.8.0)
SET (ENABLE_QT5 FALSE CACHE BOOL "If enabled will try to find Qt5 before looking for Qt4")
IF (ENABLE_QT5)
FIND_PACKAGE(Qt5Core QUIET)
FIND_PACKAGE(Qt5Gui REQUIRED)
FIND_PACKAGE(Qt5Widgets REQUIRED)
FIND_PACKAGE(Qt5Network REQUIRED)
FIND_PACKAGE(Qt5Xml REQUIRED)
FIND_PACKAGE(Qt5Svg REQUIRED)
FIND_PACKAGE(Qt5Concurrent REQUIRED)
FIND_PACKAGE(Qt5PrintSupport REQUIRED)
FIND_PACKAGE(Qt5Positioning)
IF (WITH_QTWEBKIT)
FIND_PACKAGE(Qt5WebKit REQUIRED)
FIND_PACKAGE(Qt5WebKitWidgets REQUIRED)
ENDIF(WITH_QTWEBKIT)
FIND_PACKAGE(Qt5Test REQUIRED)
FIND_PACKAGE(Qt5UiTools REQUIRED)
FIND_PACKAGE(Qt5Script REQUIRED)
FIND_PACKAGE(Qt5Sql REQUIRED)
SET(QT5_BUILD TRUE)
INCLUDE("cmake/modules/ECMQt4To5Porting.cmake")
MESSAGE(STATUS "Found Qt version: ${Qt5Core_VERSION_STRING}")
ELSE()
FIND_PACKAGE(Qt4 ${QT_MIN_VERSION} REQUIRED)
SET(QT_USE_QTXML 1)
SET(QT_USE_QTNETWORK 1)
SET(QT_USE_QTSVG 1)
SET(QT_USE_QTSQL 1)
IF (WITH_QTWEBKIT)
SET(QT_USE_QTWEBKIT 1)
ENDIF(WITH_QTWEBKIT)
IF (NOT QT_QTXML_FOUND OR NOT QT_QTNETWORK_FOUND OR NOT QT_QTSVG_FOUND OR NOT QT_QTSQL_FOUND OR (WITH_QTWEBKIT AND NOT QT_QTWEBKIT_FOUND) OR (WITH_CUSTOM_WIDGETS AND NOT QT_QTDESIGNER_FOUND))
MESSAGE(SEND_ERROR "Some Qt4 modules haven't been found!")
ENDIF (NOT QT_QTXML_FOUND OR NOT QT_QTNETWORK_FOUND OR NOT QT_QTSVG_FOUND OR NOT QT_QTSQL_FOUND OR (WITH_QTWEBKIT AND NOT QT_QTWEBKIT_FOUND) OR (WITH_CUSTOM_WIDGETS AND NOT QT_QTDESIGNER_FOUND))

INCLUDE( ${QT_USE_FILE} )

MESSAGE(STATUS "Found Qt version: ${QTVERSION}")
ENDIF()
# search for Qt5
SET(QT_MIN_VERSION 5.5.0)
FIND_PACKAGE(Qt5Core QUIET)
FIND_PACKAGE(Qt5Gui REQUIRED)
FIND_PACKAGE(Qt5Widgets REQUIRED)
FIND_PACKAGE(Qt5Network REQUIRED)
FIND_PACKAGE(Qt5Xml REQUIRED)
FIND_PACKAGE(Qt5Svg REQUIRED)
FIND_PACKAGE(Qt5Concurrent REQUIRED)
FIND_PACKAGE(Qt5PrintSupport REQUIRED)
FIND_PACKAGE(Qt5Positioning)
IF (WITH_QTWEBKIT)
FIND_PACKAGE(Qt5WebKit REQUIRED)
FIND_PACKAGE(Qt5WebKitWidgets REQUIRED)
ENDIF(WITH_QTWEBKIT)
FIND_PACKAGE(Qt5Test REQUIRED)
FIND_PACKAGE(Qt5UiTools REQUIRED)
FIND_PACKAGE(Qt5Script REQUIRED)
FIND_PACKAGE(Qt5Sql REQUIRED)
SET(QT5_BUILD TRUE)
INCLUDE("cmake/modules/ECMQt4To5Porting.cmake")
MESSAGE(STATUS "Found Qt version: ${Qt5Core_VERSION_STRING}")

IF (WITH_QTMOBILITY)
FIND_PACKAGE(QtMobility 1.1.0)
@@ -690,7 +671,7 @@ IF (UNIX AND NOT APPLE)
SET (QGIS_MANUAL_DIR ${CMAKE_INSTALL_PREFIX}/${QGIS_MANUAL_SUBDIR})
ENDIF (UNIX AND NOT APPLE)

SET (DISABLE_DEPRECATED ${ENABLE_QT5} CACHE BOOL "If set to true, it will disable deprecated functionality to prepare for the next generation of QGIS")
SET (DISABLE_DEPRECATED FALSE CACHE BOOL "If set to true, it will disable deprecated functionality to prepare for the next generation of QGIS")
IF (DISABLE_DEPRECATED)
ADD_DEFINITIONS(-DQGIS_DISABLE_DEPRECATED)
ENDIF (DISABLE_DEPRECATED)
@@ -699,12 +680,7 @@ ENDIF (DISABLE_DEPRECATED)
#############################################################
# Python build dependency

SET (ENABLE_PYTHON3 ${ENABLE_QT5} CACHE BOOL "If enabled will try to find Python 3 before looking for Python 2")
IF(ENABLE_PYTHON3)
SET(PYTHON_VER 3 CACHE STRING "Python version")
ELSE(ENABLE_PYTHON3)
SET(PYTHON_VER 2.7 CACHE STRING "Python version")
ENDIF(ENABLE_PYTHON3)
SET(PYTHON_VER 3 CACHE STRING "Python version")

FIND_PACKAGE(PythonInterp ${PYTHON_VER} REQUIRED)

@@ -715,17 +691,10 @@ IF (WITH_BINDINGS)

FIND_PACKAGE(PythonLibrary REQUIRED)

# python support: check for interpreter, sip, pyqt4
IF(ENABLE_QT5)
FIND_PACKAGE(PyQt5 REQUIRED)
SET(PYQT_SIP_FLAGS ${PYQT5_SIP_FLAGS})
SET(PYQT_SIP_DIR ${PYQT5_SIP_DIR})
ELSE(ENABLE_QT5)
FIND_PACKAGE(PyQt4 REQUIRED)
# setup SIP variables
SET(PYQT_SIP_FLAGS ${PYQT4_SIP_FLAGS})
SET(PYQT_SIP_DIR ${PYQT4_SIP_DIR})
ENDIF(ENABLE_QT5)
# python support: check for interpreter, sip, pyqt5
FIND_PACKAGE(PyQt5 REQUIRED)
SET(PYQT_SIP_FLAGS ${PYQT5_SIP_FLAGS})
SET(PYQT_SIP_DIR ${PYQT5_SIP_DIR})
SEPARATE_ARGUMENTS(PYQT_SIP_FLAGS) # convert space separated values to a list

FIND_PACKAGE(SIP REQUIRED)
@@ -742,11 +711,7 @@ IF (WITH_BINDINGS)
ENDIF (NOT BINDINGS_GLOBAL_INSTALL)

IF (WITH_CUSTOM_WIDGETS)
IF(ENABLE_QT5)
SET(PYUIC_WIDGET_PLUGIN_DIRECTORY ${PYQT5_MOD_DIR}/uic/widget-plugins/)
ELSE(ENABLE_QT5)
SET(PYUIC_WIDGET_PLUGIN_DIRECTORY ${PYQT4_MOD_DIR}/uic/widget-plugins/)
ENDIF(ENABLE_QT5)
SET(PYUIC_WIDGET_PLUGIN_DIRECTORY ${PYQT5_MOD_DIR}/uic/widget-plugins/)
ENDIF (WITH_CUSTOM_WIDGETS)

ENDIF (WITH_BINDINGS)
@@ -51,8 +51,6 @@ cmake \
-DWITH_ASTYLE=ON \
-DWITH_SERVER=ON \
-DWITH_INTERNAL_YAML=OFF \
-DENABLE_QT5=ON \
-DENABLE_PYTHON3=ON \
-DDISABLE_DEPRECATED=ON \
-DPORT_PLUGINS=ON \
-DCXX_EXTRA_FLAGS="$CLANG_WARNINGS" \
@@ -44,11 +44,7 @@ else(EXISTS "${PYTHON_INCLUDE_PATH}" AND EXISTS "${PYTHON_LIBRARY}" AND EXISTS "
endif("${PYTHON_CUSTOM_FRAMEWORK}" MATCHES "Python\\.framework")
endif(APPLE AND PYTHON_CUSTOM_FRAMEWORK)

IF (ENABLE_PYTHON3)
FIND_PACKAGE(PythonInterp 3)
ELSE (ENABLE_PYTHON3)
FIND_PACKAGE(PythonInterp 2.7)
ENDIF (ENABLE_PYTHON3)
FIND_PACKAGE(PythonInterp 3)

if(PYTHONINTERP_FOUND)
FIND_FILE(_find_lib_python_py FindLibPython.py PATHS ${CMAKE_MODULE_PATH})
@@ -20,11 +20,7 @@ if(QCA_INCLUDE_DIR AND QCA_LIBRARY)

else(QCA_INCLUDE_DIR AND QCA_LIBRARY)

if(ENABLE_QT5)
set(QCA_LIBRARY_NAMES qca-qt5 qca2-qt5)
else(ENABLE_QT5)
set(QCA_LIBRARY_NAMES qca qca2)
endif(ENABLE_QT5)
set(QCA_LIBRARY_NAMES qca-qt5 qca2-qt5)

find_library(QCA_LIBRARY
NAMES ${QCA_LIBRARY_NAMES}
@@ -33,11 +33,7 @@ ELSE(EXISTS QSCINTILLA_VERSION_STR)
/usr/include
)

if(ENABLE_QT5)
set(QSCINTILLA_LIBRARY_NAMES qscintilla2-qt5 libqt5scintilla2 libqscintilla2-qt5 qt5scintilla2 libqscintilla2-qt5.dylib)
else(ENABLE_QT5)
set(QSCINTILLA_LIBRARY_NAMES qscintilla2 libqscintilla2 libqscintilla2.dylib)
endif(ENABLE_QT5)
set(QSCINTILLA_LIBRARY_NAMES qscintilla2-qt5 libqt5scintilla2 libqscintilla2-qt5 qt5scintilla2 libqscintilla2-qt5.dylib)

find_library(QSCINTILLA_LIBRARY
NAMES ${QSCINTILLA_LIBRARY_NAMES}
@@ -23,11 +23,7 @@ ELSE(EXISTS QSCI_MOD_VERSION_STR)

FIND_FILE(_find_qsci_py FindQsci.py PATHS ${CMAKE_MODULE_PATH})

IF(ENABLE_QT5)
SET(QSCI_VER 5)
ELSE(ENABLE_QT5)
SET(QSCI_VER 4)
ENDIF(ENABLE_QT5)
SET(QSCI_VER 5)

EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${_find_qsci_py} ${QSCI_VER} OUTPUT_VARIABLE qsci_ver)

@@ -37,17 +33,10 @@ ELSE(EXISTS QSCI_MOD_VERSION_STR)
ENDIF(qsci_ver)

IF(QSCI_FOUND)
IF(ENABLE_QT5)
FIND_PATH(QSCI_SIP_DIR
NAMES Qsci/qscimod5.sip
PATHS ${PYQT5_SIP_DIR}
)
ELSE(ENABLE_QT5)
FIND_PATH(QSCI_SIP_DIR
NAMES Qsci/qscimod4.sip
PATHS ${PYQT4_SIP_DIR}
)
ENDIF(ENABLE_QT5)
FIND_PATH(QSCI_SIP_DIR
NAMES Qsci/qscimod5.sip
PATHS ${PYQT5_SIP_DIR}
)

IF(NOT QSCI_FIND_QUIETLY)
MESSAGE(STATUS "Found QScintilla2 PyQt module: ${QSCI_MOD_VERSION_STR}")
@@ -20,11 +20,7 @@ FIND_PATH(QWT_INCLUDE_DIR NAMES qwt.h PATHS
PATH_SUFFIXES qwt-qt4 qwt qwt5 qwt6
)

if(ENABLE_QT5)
set(QWT_LIBRARY_NAMES qwt-qt5 qwt6-qt5)
else(ENABLE_QT5)
set(QWT_LIBRARY_NAMES qwt qwt6 qwt5 qwt-qt4 qwt6-qt4 qwt5-qt4)
endif(ENABLE_QT5)
set(QWT_LIBRARY_NAMES qwt-qt5 qwt6-qt5)

find_library(QWT_LIBRARY
NAMES ${QWT_LIBRARY_NAMES}
@@ -4,15 +4,9 @@
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

IF(ENABLE_QT5)
SET(PYUIC_PROG_NAME pyuic5)
SET(PYUIC_PROG_NAMES pyuic5)
SET(PYRCC_PROG_NAME pyrcc5)
ELSE(ENABLE_QT5)
SET(PYUIC_PROG_NAME pyuic4)
SET(PYUIC_PROG_NAMES python2-pyuic4 pyuic4)
SET(PYRCC_PROG_NAME pyrcc4)
ENDIF(ENABLE_QT5)
SET(PYUIC_PROG_NAME pyuic5)
SET(PYUIC_PROG_NAMES pyuic5)
SET(PYRCC_PROG_NAME pyrcc5)

IF(NOT PYUIC_PROGRAM)
IF (MSVC)
@@ -121,10 +121,6 @@ INCLUDE_DIRECTORIES(
${CMAKE_BINARY_DIR} # qgsconfig.h, qgsversion.h
)

IF(NOT ENABLE_QT5)
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} QT5_SUPPORT)
ENDIF(NOT ENABLE_QT5)

IF(NOT ANDROID)
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} ANDROID)
ENDIF(NOT ANDROID)
@@ -146,9 +142,6 @@ IF(PYQT4_VERSION_NUM LESS 263680) # 0x040600
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} PROXY_FACTORY)
ENDIF(PYQT4_VERSION_NUM LESS 263680)

IF(NOT PYQT4_VERSION_NUM LESS 263941 AND NOT ENABLE_QT5) # 0x040705
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} QSETINT_CONVERSION)
ENDIF(NOT PYQT4_VERSION_NUM LESS 263941 AND NOT ENABLE_QT5)
#
IF(NOT PYQT4_VERSION_NUM LESS 264194) # 0x040802
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} QSETTYPE_CONVERSION)
@@ -23,11 +23,7 @@ SET(PYQT_COMPAT_FILES
ADD_CUSTOM_TARGET(pyqtcompat ALL)
ADD_DEPENDENCIES(pyqtcompat pyutils)

IF(ENABLE_QT5)
SET(PYQT_PREFIX PyQt5)
ELSE(ENABLE_QT5)
SET(PYQT_PREFIX PyQt4)
ENDIF(ENABLE_QT5)
SET(PYQT_PREFIX PyQt5)

FOREACH(pyfile ${PYQT_COMPAT_FILES})
GET_FILENAME_COMPONENT(_dir ${pyfile} PATH)
@@ -35,43 +35,12 @@ ENDMACRO(EXT_PYLIB lib)

# Our yaml package is not compatible with python 3
# Fallback to system package by default
IF(PYTHON_VER VERSION_LESS 3)
EXT_PYLIB(yaml TRUE)
ELSEIF(PYTHON_VER VERSION_LESS 3)
EXT_PYLIB(yaml FALSE)
ENDIF(PYTHON_VER VERSION_LESS 3)
EXT_PYLIB(yaml FALSE)

FOREACH(pkg httplib2 jinja2 markupsafe owslib pygments dateutil pytz nose2 requests)
EXT_PYLIB(${pkg} TRUE)
ENDFOREACH(pkg)

IF(NOT ENABLE_PYTHON3)
SET (WITH_INTERNAL_FUTURE TRUE CACHE BOOL "Determines whether python future should be included")
IF(WITH_INTERNAL_FUTURE)
ADD_CUSTOM_TARGET(pyfuture)

FILE(GLOB items RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/future future/*)

FOREACH(item ${items})
INSTALL(DIRECTORY future/${item} DESTINATION "${QGIS_PYTHON_DIR}")
FILE(GLOB_RECURSE files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/future future/*)
ADD_CUSTOM_COMMAND(TARGET pyfuture
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${item} "${PYTHON_OUTPUT_DIRECTORY}/"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${files}
)
PY_COMPILE(pyfuture "${PYTHON_OUTPUT_DIRECTORY}/${item}")

ADD_CUSTOM_COMMAND(TARGET clean-staged-plugins
COMMAND ${CMAKE_COMMAND} -E remove_directory "${PYTHON_OUTPUT_DIRECTORY}/${item}"
)
ENDFOREACH(item ${items})

ADD_DEPENDENCIES(staged-plugins pyfuture)
ENDIF(WITH_INTERNAL_FUTURE)
ENDIF(NOT ENABLE_PYTHON3)

SET (WITH_INTERNAL_SIX TRUE CACHE BOOL "Determines whether python six should be included")
IF(WITH_INTERNAL_SIX)
INSTALL(FILES six.py DESTINATION "${QGIS_PYTHON_DIR}")
@@ -8,17 +8,16 @@

FILE(WRITE ${CMAKE_BINARY_DIR}/stagecount 0)

IF(ENABLE_QT5)
# The target port-plugins acts as a container for all port-plugin-XXX targets
# Each port-plugin-XXX target will run scripts/2to3 on a plugin and migrate
# Python 3 and Qt 5 code.
SET (PORT_PLUGINS FALSE CACHE BOOL "Determines whether python plugins in staged or installed locations should be migrated to Python 3 and Qt 5")
IF(PORT_PLUGINS)
ADD_CUSTOM_TARGET(port-plugins ALL)
ELSE(PORT_PLUGINS)
ADD_CUSTOM_TARGET(port-plugins)
ENDIF(PORT_PLUGINS)
ENDIF(ENABLE_QT5)
# The target port-plugins acts as a container for all port-plugin-XXX targets
# Each port-plugin-XXX target will run scripts/2to3 on a plugin and migrate
# Python 3 and Qt 5 code.
SET (PORT_PLUGINS FALSE CACHE BOOL "Determines whether python plugins in staged or installed locations should be migrated to Python 3 and Qt 5")
IF(PORT_PLUGINS)
ADD_CUSTOM_TARGET(port-plugins ALL)
ELSE(PORT_PLUGINS)
ADD_CUSTOM_TARGET(port-plugins)
ENDIF(PORT_PLUGINS)


MACRO (PLUGIN_INSTALL plugin subdir )
FILE(READ ${CMAKE_BINARY_DIR}/stagecount n)
@@ -47,12 +46,10 @@ MACRO (PLUGIN_INSTALL plugin subdir )
ADD_CUSTOM_TARGET(staged-${plugin} DEPENDS zzz-${plugin}-stageinstall)
FILE(WRITE ${_cmake} "")

IF(ENABLE_QT5)
ADD_CUSTOM_TARGET(port-plugin-${plugin})
PY_2TO3(port-plugin-${plugin} ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin})
ADD_DEPENDENCIES(port-plugins port-plugin-${plugin})
ADD_DEPENDENCIES(port-plugin-${plugin} staged-${plugin})
ENDIF(ENABLE_QT5)
ADD_CUSTOM_TARGET(port-plugin-${plugin})
PY_2TO3(port-plugin-${plugin} ${PYTHON_OUTPUT_DIRECTORY}/plugins/${plugin})
ADD_DEPENDENCIES(port-plugins port-plugin-${plugin})
ADD_DEPENDENCIES(port-plugin-${plugin} staged-${plugin})
ENDIF(NOT TARGET zzz-${plugin}-stageinstall)

ADD_CUSTOM_TARGET(zzz-${plugin}-${n}-depend DEPENDS ${ARGN})
Loading

0 comments on commit 88e4410

Please sign in to comment.