Skip to content
Permalink
Browse files

auto-detect name of sip module used by PyQt5

  • Loading branch information
jef-n committed Oct 24, 2018
1 parent 0e5627c commit 4464089487ae6d3f6f30e1a732ca8db5aa67ac1f
@@ -55,7 +55,6 @@ cmake \
-DWITH_DESKTOP=ON \
-DWITH_BINDINGS=ON \
-DWITH_SERVER=ON \
-DSIP_IMPORT=sip \
-DDISABLE_DEPRECATED=ON \
-DPYTHON_TEST_WRAPPER="timeout -sSIGSEGV 55s"\
-DCXX_EXTRA_FLAGS="${CLANG_WARNINGS}" \
@@ -42,7 +42,7 @@ ELSE(EXISTS PYQT5_VERSION)
ENDIF(EXISTS ${PYQT5_SIP_DIR}/Qt5)
STRING(REGEX REPLACE ".*\npyqt_sip_flags:([^\n]+).*$" "\\1" PYQT5_SIP_FLAGS ${pyqt_config})
STRING(REGEX REPLACE ".*\npyqt_bin_dir:([^\n]+).*$" "\\1" PYQT5_BIN_DIR ${pyqt_config})

STRING(REGEX REPLACE ".*\npyqt_sip_module:([^\n]+).*$" "\\1" PYQT5_SIP_IMPORT ${pyqt_config})
SET(PYQT5_FOUND TRUE)
ENDIF(pyqt_config)

@@ -79,3 +79,9 @@
print("pyqt_sip_dir:%s" % pyqtcfg.pyqt_sip_dir)
print("pyqt_sip_flags:%s" % pyqtcfg.pyqt_sip_flags)
print("pyqt_bin_dir:%s" % pyqtcfg.pyqt_bin_dir)

try:
import PyQt5.sip
print("pyqt_sip_module:PyQt5.sip")
except:
print("pyqt_sip_module:sip")
@@ -66,7 +66,6 @@ CMAKE_OPTS := \
-DSERVER_SKIP_ECW=TRUE \
-DQGIS_CGIBIN_SUBDIR=/usr/lib/cgi-bin \
-DWITH_APIDOC=TRUE \
-DSIP_IMPORT=sip \
-DGENERATE_QHP=TRUE \
-DWITH_CUSTOM_WIDGETS=TRUE \
-DWITH_GLOBE=FALSE \
@@ -155,7 +155,6 @@ cmake -G "%CMAKEGEN%" ^
-D SPATIALITE_LIBRARY=%O4W_ROOT%/lib/spatialite_i.lib ^
-D PYTHON_EXECUTABLE=%O4W_ROOT%/bin/python3.exe ^
-D SIP_BINARY_PATH=%PYTHONHOME:\=/%/sip.exe ^
-D SIP_IMPORT=sip ^
-D PYTHON_INCLUDE_PATH=%PYTHONHOME:\=/%/include ^
-D PYTHON_LIBRARY=%PYTHONHOME:\=/%/libs/%PYVER%.lib ^
-D QT_LIBRARY_DIR=%O4W_ROOT%/lib ^
@@ -161,7 +161,6 @@ cmake -G "%CMAKEGEN%" ^
-D SPATIALITE_LIBRARY=%O4W_ROOT%/lib/spatialite_i.lib ^
-D PYTHON_EXECUTABLE=%O4W_ROOT%/bin/python3.exe ^
-D SIP_BINARY_PATH=%PYTHONHOME:\=/%/sip.exe ^
-D SIP_IMPORT=sip ^
-D PYTHON_INCLUDE_PATH=%PYTHONHOME:\=/%/include ^
-D PYTHON_LIBRARY=%PYTHONHOME:\=/%/libs/%PYVER%.lib ^
-D QT_LIBRARY_DIR=%O4W_ROOT%/lib ^
@@ -174,16 +174,12 @@ ELSE(${SIP_VERSION_STR} VERSION_GREATER 4.19.0)
SET(SIP_FINAL "")
ENDIF(${SIP_VERSION_STR} VERSION_GREATER 4.19.0)

IF((${SIP_VERSION_STR} VERSION_EQUAL 4.19.11) OR (${SIP_VERSION_STR} VERSION_GREATER 4.19.11))
SET (SIP_IMPORT "PyQt5.sip" CACHE STRING "Import path for SIP library")
ENDIF((${SIP_VERSION_STR} VERSION_EQUAL 4.19.11) OR (${SIP_VERSION_STR} VERSION_GREATER 4.19.11))

# core module
FILE(GLOB_RECURSE sip_files_core core/*.sip core/*.sip.in)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core})
SET(SIP_EXTRA_OPTIONS ${PYQT_SIP_FLAGS} -g -o -a ${CMAKE_BINARY_DIR}/python/qgis.core.api)
IF((${SIP_VERSION_STR} VERSION_EQUAL 4.19.11) OR (${SIP_VERSION_STR} VERSION_GREATER 4.19.11))
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -n ${SIP_IMPORT})
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -n ${PYQT5_SIP_IMPORT})
ENDIF((${SIP_VERSION_STR} VERSION_EQUAL 4.19.11) OR (${SIP_VERSION_STR} VERSION_GREATER 4.19.11))
IF((${SIP_VERSION_STR} VERSION_EQUAL 4.18) OR (${SIP_VERSION_STR} VERSION_GREATER 4.18))
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -y ${QGIS_PYTHON_OUTPUT_DIRECTORY}/_core.pyi)
@@ -207,7 +203,7 @@ IF (WITH_GUI)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_gui})
SET(SIP_EXTRA_OPTIONS ${PYQT_SIP_FLAGS} -g -o -a ${CMAKE_BINARY_DIR}/python/qgis.gui.api)
IF((${SIP_VERSION_STR} VERSION_EQUAL 4.19.11) OR (${SIP_VERSION_STR} VERSION_GREATER 4.19.11))
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -n ${SIP_IMPORT})
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -n ${PYQT5_SIP_IMPORT})
ENDIF((${SIP_VERSION_STR} VERSION_EQUAL 4.19.11) OR (${SIP_VERSION_STR} VERSION_GREATER 4.19.11))
IF((${SIP_VERSION_STR} VERSION_EQUAL 4.18) OR (${SIP_VERSION_STR} VERSION_GREATER 4.18))
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -y ${QGIS_PYTHON_OUTPUT_DIRECTORY}/_gui.pyi)
@@ -238,7 +234,7 @@ IF (WITH_3D)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_3d})
SET(SIP_EXTRA_OPTIONS ${PYQT_SIP_FLAGS} -g -o -a ${CMAKE_BINARY_DIR}/python/qgis.qgis3d.api)
IF((${SIP_VERSION_STR} VERSION_EQUAL 4.19.11) OR (${SIP_VERSION_STR} VERSION_GREATER 4.19.11))
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -n ${SIP_IMPORT})
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -n ${PYQT5_SIP_IMPORT})
ENDIF((${SIP_VERSION_STR} VERSION_EQUAL 4.19.11) OR (${SIP_VERSION_STR} VERSION_GREATER 4.19.11))
IF((${SIP_VERSION_STR} VERSION_EQUAL 4.18) OR (${SIP_VERSION_STR} VERSION_GREATER 4.18))
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -y ${QGIS_PYTHON_OUTPUT_DIRECTORY}/_qgis3d.pyi)
@@ -261,7 +257,7 @@ IF (WITH_SERVER AND WITH_SERVER_PLUGINS)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_server})
SET(SIP_EXTRA_OPTIONS ${PYQT_SIP_FLAGS} -g -o -a ${CMAKE_BINARY_DIR}/python/qgis.server.api)
IF((${SIP_VERSION_STR} VERSION_EQUAL 4.19.11) OR (${SIP_VERSION_STR} VERSION_GREATER 4.19.11))
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -n ${SIP_IMPORT})
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -n ${PYQT5_SIP_IMPORT})
ENDIF((${SIP_VERSION_STR} VERSION_EQUAL 4.19.11) OR (${SIP_VERSION_STR} VERSION_GREATER 4.19.11))
IF((${SIP_VERSION_STR} VERSION_EQUAL 4.18) OR (${SIP_VERSION_STR} VERSION_GREATER 4.18))
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -y ${QGIS_PYTHON_OUTPUT_DIRECTORY}/_server.pyi)
@@ -294,7 +290,7 @@ FILE(GLOB_RECURSE sip_files_analysis analysis/*.sip analysis/*.sip.in)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_analysis})
SET(SIP_EXTRA_OPTIONS ${PYQT_SIP_FLAGS} -g -o -a ${CMAKE_BINARY_DIR}/python/qgis.analysis.api)
IF((${SIP_VERSION_STR} VERSION_EQUAL 4.19.11) OR (${SIP_VERSION_STR} VERSION_GREATER 4.19.11))
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -n ${SIP_IMPORT})
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -n ${PYQT5_SIP_IMPORT})
ENDIF((${SIP_VERSION_STR} VERSION_EQUAL 4.19.11) OR (${SIP_VERSION_STR} VERSION_GREATER 4.19.11))
IF((${SIP_VERSION_STR} VERSION_EQUAL 4.18) OR (${SIP_VERSION_STR} VERSION_GREATER 4.18))
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -y ${QGIS_PYTHON_OUTPUT_DIRECTORY}/_analysis.pyi)

1 comment on commit 4464089

@nirvn

This comment has been minimized.

Copy link
Contributor

@nirvn nirvn commented on 4464089 Oct 24, 2018

@jef-n , excellent, thanks.

Please sign in to comment.
You can’t perform that action at this time.