+# Copyright (C) 2013-2014 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
# 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()
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 <xyz>/sip/QtCore, for a custom install
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)
# 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()