Salome HOME
Allow setting / getting QByteArray preference item in Python modules.
[modules/gui.git] / adm_local / cmake_files / deprecated / FindSIPPYQT.cmake
1 # Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 FIND_PROGRAM(SIP_EXECUTABLE sip)
21
22 SET(SIP_ROOT ${SIP_EXECUTABLE})
23 IF(SIP_ROOT)
24 GET_FILENAME_COMPONENT(SIP_ROOT ${SIP_ROOT} PATH)
25 GET_FILENAME_COMPONENT(SIP_ROOT ${SIP_ROOT} PATH)
26 ENDIF(SIP_ROOT)
27
28 SET(SIP_INCLUDES -I${SIP_ROOT}/include/python${PYTHON_VERSION})  # to be removed
29 SET(SIP_INCLUDE_DIRS ${SIP_ROOT}/include/python${PYTHON_VERSION})
30 IF(WINDOWS)
31   SET(SIP_INCLUDES ${SIP_INCLUDES} -I${SIP_ROOT}/include)        # to be removed
32   SET(SIP_INCLUDE_DIRS ${SIP_INCLUDE_DIRS} ${SIP_ROOT}/include)
33 ENDIF(WINDOWS)
34
35 IF(WINDOWS)
36   FIND_PROGRAM(PYUIC_EXECUTABLE NAMES pyuic4 pyuic4.bat)
37 ELSE(WINDOWS)
38   FIND_PROGRAM(PYUIC_EXECUTABLE NAMES pyuic4)
39 ENDIF(WINDOWS)
40
41 SET(PYUIC_ROOT ${PYUIC_EXECUTABLE})
42 IF(PYUIC_ROOT)
43 GET_FILENAME_COMPONENT(PYUIC_ROOT ${PYUIC_ROOT} PATH)
44 GET_FILENAME_COMPONENT(PYUIC_ROOT ${PYUIC_ROOT} PATH)
45 ENDIF(PYUIC_ROOT)
46
47 SET(PYQT_SIPS $ENV{PYQT_SIPS})
48 IF(NOT PYQT_SIPS)
49   IF(WINDOWS)
50     SET(PYQT_SIPS ${PYUIC_ROOT}/sip)
51   ELSE(WINDOWS)
52     IF(PYUIC_ROOT STREQUAL /usr)
53       SET(PYQT_SIPS ${PYUIC_ROOT}/share/sip/PyQt4)
54     ELSE(PYUIC_ROOT STREQUAL /usr)
55       SET(PYQT_SIPS ${PYUIC_ROOT}/share/sip)
56     ENDIF(PYUIC_ROOT STREQUAL /usr)
57   ENDIF(WINDOWS)
58 ENDIF(NOT PYQT_SIPS)
59
60 SET(PYQT_INCLUDES -I${PYQT_SIPS})
61 SET(PYQT_INCLUDES ${PYQT_INCLUDES} -I${PYQT_SIPS}/QtCore -I${PYQT_SIPS}/QtGui)
62 SET(PYQT_INCLUDES ${PYQT_INCLUDES} -I${PYQT_SIPS}/QtXml -I${PYQT_SIPS}/QtOpenGL)
63 SET(PYQT_INCLUDES ${PYQT_INCLUDES} -I${PYQT_SIPS}/QtAssistant -I${PYQT_SIPS}/QtDesigner)
64 SET(PYQT_INCLUDES ${PYQT_INCLUDES} -I${PYQT_SIPS}/QtNetwork -I${PYQT_SIPS}/QtSql)
65 SET(PYQT_INCLUDES ${PYQT_INCLUDES} -I${PYQT_SIPS}/QtSvg -I${PYQT_SIPS}/QtTest)
66
67 EXECUTE_PROCESS(
68   COMMAND ${PYTHON_EXECUTABLE} -c "import re, PyQt4.pyqtconfig ; s = PyQt4.pyqtconfig.Configuration().pyqt_sip_flags ; print s;"
69   OUTPUT_VARIABLE COMPILE_FLAGS
70   OUTPUT_STRIP_TRAILING_WHITESPACE
71   )
72 string(REPLACE " " ";" FLAGS_LIST ${COMPILE_FLAGS})
73 FOREACH(FLG ${FLAGS_LIST})
74 SET( PYQT_SIPFLAGS ${PYQT_SIPFLAGS} ${FLG})
75 ENDFOREACH(FLG ${FLAGS_LIST})
76
77 SET( PYQT_SIPFLAGS ${PYQT_SIPFLAGS} -s .cc -c . )
78 SET( PYQT_SIPFLAGS ${PYQT_SIPFLAGS} ${PYQT_INCLUDES} )