From: <ai...@us...> - 2009-06-23 01:19:06
|
Revision: 10064 http://plplot.svn.sourceforge.net/plplot/?rev=10064&view=rev Author: airwin Date: 2009-06-23 00:48:12 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Configure some sip-related variables so that can use sip directly (rather than indirectly via python) to generate source code for plplot_pyqt4 extension module. Modified Paths: -------------- trunk/cmake/modules/qt.cmake Modified: trunk/cmake/modules/qt.cmake =================================================================== --- trunk/cmake/modules/qt.cmake 2009-06-23 00:46:38 UTC (rev 10063) +++ trunk/cmake/modules/qt.cmake 2009-06-23 00:48:12 UTC (rev 10064) @@ -41,6 +41,9 @@ # ENABLE_qt - ON means the plplot_qt library is enabled. # ENABLE_pyqt4 - ON means the plplot_pyqt4 Python extension module # is enabled. +# SIP_EXECUTABLE - full path for sip +# PYQT_SIP_DIR - sip system directory +# PYQT_SIP_FLAGS - sip command flags find_package(Qt4) if(PLD_bmpqt OR PLD_jpgqt OR PLD_pngqt OR PLD_ppmqt OR PLD_tiffqt OR PLD_epsqt OR PLD_pdfqt OR PLD_qtwidget OR PLD_svgqt OR PLD_extqt) @@ -88,17 +91,17 @@ if(ENABLE_qt AND NOT PLD_extqt) message(STATUS - "WARNING: PLD_extqt is OFF so " - "setting ENABLE_qt to OFF." - ) + "WARNING: PLD_extqt is OFF so " + "setting ENABLE_qt to OFF." + ) set(ENABLE_qt OFF CACHE BOOL "Enable Qt bindings" FORCE) endif(ENABLE_qt AND NOT PLD_extqt) if(ENABLE_pyqt4 AND NOT ENABLE_python AND NOT ENABLE_qt) message(STATUS - "WARNING: ENABLE_python OR ENABLE_qt is OFF so " - "setting ENABLE_pyqt4 to OFF." - ) + "WARNING: ENABLE_python OR ENABLE_qt is OFF so " + "setting ENABLE_pyqt4 to OFF." + ) set(ENABLE_pyqt4 OFF CACHE BOOL "Enable pyqt4 Python extension module " FORCE) endif(ENABLE_pyqt4 AND NOT ENABLE_python AND NOT ENABLE_qt) @@ -107,3 +110,47 @@ else(ENABLE_qt) set(qt_gui_true "#") endif(ENABLE_qt) + +if(ENABLE_pyqt4) + find_program(SIP_EXECUTABLE sip) + if(NOT SIP_EXECUTABLE) + message(STATUS + "WARNING: sip not found so setting ENABLE_pyqt4 to OFF." + ) + set(ENABLE_pyqt4 OFF CACHE BOOL "Enable pyqt4 Python extension module " FORCE) + endif(NOT SIP_EXECUTABLE) +endif(ENABLE_pyqt4) + +if(ENABLE_pyqt4) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "from PyQt4 import pyqtconfig; print pyqtconfig.Configuration().pyqt_sip_dir" + OUTPUT_VARIABLE PYQT_SIP_DIR + RESULT_VARIABLE PYQT_SIP_DIR_ERR + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(PYQT_SIP_DIR_ERR) + message(STATUS + "WARNING: could not find sip directory so setting ENABLE_pyqt4 to OFF." + ) + set(ENABLE_pyqt4 OFF CACHE BOOL "Enable pyqt4 Python extension module " FORCE) + endif(PYQT_SIP_DIR_ERR) +endif(ENABLE_pyqt4) + +if(ENABLE_pyqt4) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "from PyQt4 import pyqtconfig; print pyqtconfig.Configuration().pyqt_sip_flags" + OUTPUT_VARIABLE PYQT_SIP_FLAGS + RESULT_VARIABLE PYQT_SIP_FLAGS_ERR + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(PYQT_SIP_FLAGS_ERR) + message(STATUS + "WARNING: could not find sip flags so setting ENABLE_pyqt4 to OFF." + ) + set(ENABLE_pyqt4 OFF CACHE BOOL "Enable pyqt4 Python extension module " FORCE) + endif(PYQT_SIP_DIR_ERR) + # Must change from blank-delimited string to CMake list so that sip + # COMMAND will work properly with these flags later on. + string(REGEX REPLACE " " ";"PYQT_SIP_FLAGS "${PYQT_SIP_FLAGS}") +endif(ENABLE_pyqt4) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |