X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=adm_local%2Fcmake_files%2FFindPyQt4.cmake;h=0d204938b71495f2b0a46ff74eee1f255488a4b3;hb=3a0ba13afff7a465ade65e11e7b84f22a658bea4;hp=a7f0349ac12cec383932eab086b56d836c555145;hpb=9c98b99d01b55ac3cff55f0805d00da9cff44b64;p=modules%2Fgui.git diff --git a/adm_local/cmake_files/FindPyQt4.cmake b/adm_local/cmake_files/FindPyQt4.cmake index a7f0349ac..0d204938b 100644 --- a/adm_local/cmake_files/FindPyQt4.cmake +++ b/adm_local/cmake_files/FindPyQt4.cmake @@ -1,3 +1,22 @@ +# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + # - Find PyQt4 installation # Sets the following variables: # PYQT_PYUIC_EXECUTABLE - path to the pyuic executable @@ -18,29 +37,6 @@ # Headers are located by looking for the header file # qobject.sip -######################################################################### -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - IF(NOT PyQt4_FIND_QUIETLY) MESSAGE(STATUS "Looking for PyQt4 ...") ENDIF() @@ -56,6 +52,7 @@ FIND_PROGRAM(PYQT_PYRCC_EXECUTABLE NAMES pyrcc4 pyrcc4.bat) GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${PYQT_PYUIC_EXECUTABLE}" PATH) GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH) + # Typical locations of qobject.sip are: # - /usr/share/sip/PyQt4/QtCore, for a system install # - or /sip/QtCore, for a custom install @@ -69,11 +66,12 @@ ENDIF() MARK_AS_ADVANCED(PYQT_SIP_MAIN_FILE) # Get PyQt compilation flags: -SET(PYQT_PYTHONPATH "${_tmp_ROOT_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages") +SET(PYQT_PYTHONPATH ${_tmp_ROOT_DIR}/PyQt4) SET(PYQT_SIPFLAGS) + EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sys; -sys.path[:0] = ['${PYQT_PYTHONPATH}'] -sys.path[:0] = ['${SIP_PYTHONPATH}'] +sys.path[:0] = '${PYQT_PYTHONPATH}'.split(';'); +sys.path[:0] = '${SIP_PYTHONPATH}'.split(';'); from PyQt4 import pyqtconfig; sys.stdout.write(pyqtconfig.Configuration().pyqt_sip_flags)" OUTPUT_VARIABLE PYQT_SIPFLAGS) @@ -107,11 +105,12 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(PyQt4 REQUIRED_VARS PYQT_PYUIC_EXECUTABLE PYQT # PYQT_PYUIC_PATH - command to launch pyuic with the correct PYTHONPATH # PYQT_PYRCC_PATH - command to launch pyrcc with the correct PYTHONPATH # TODO: should be done like Sphinx in KERNEL (i.e. generating a shell script)? + IF(WIN32 AND NOT CYGWIN) - MESSAGE(WARNING "PyQt4 command was not tested under Win32") SET(PYQT_PYUIC_PATH set PYTHONPATH=${PYQT_PYTHONPATH};${SIP_PYTHONPATH};%PYTHONPATH% && ${PYQT_PYUIC_EXECUTABLE}) SET(PYQT_PYRCC_PATH set PYTHONPATH=${PYQT_PYTHONPATH};${SIP_PYTHONPATH};%PYTHONPATH% && ${PYQT_PYRCC_EXECUTABLE}) ELSE() + STRING(REPLACE ";" ":" PYQT_PYTHONPATH "${PYQT_PYTHONPATH}") SET(PYQT_PYUIC_PATH /usr/bin/env PYTHONPATH="${PYQT_PYTHONPATH}:${SIP_PYTHONPATH}:$$PYTHONPATH" ${PYQT_PYUIC_EXECUTABLE}) SET(PYQT_PYRCC_PATH /usr/bin/env PYTHONPATH="${PYQT_PYTHONPATH}:${SIP_PYTHONPATH}:$$PYTHONPATH" ${PYQT_PYRCC_EXECUTABLE}) ENDIF()