Salome HOME
Merge changes from V8_0_0_BR
authorvsr <vsr@opencascade.com>
Fri, 29 Jan 2016 10:40:29 +0000 (13:40 +0300)
committervsr <vsr@opencascade.com>
Fri, 29 Jan 2016 10:44:37 +0000 (13:44 +0300)
adm_local/cmake_files/CMakeLists.txt
adm_local/cmake_files/FindPyQt4.cmake
adm_local/cmake_files/UsePyQt4.cmake
adm_local/cmake_files/UseSIP.cmake [new file with mode: 0644]
src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_GUILight.sip
src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip

index 8fabf8484fd90bb0c19fff367c6f073faf058c71..55abff17fc353eeb87d98a1186607f6b228906a6 100755 (executable)
@@ -36,6 +36,7 @@ SET(_adm_data
   FindSalomeGUI.cmake
   FindSalomeOpenGL.cmake
   FindSalomeParaView.cmake
   FindSalomeGUI.cmake
   FindSalomeOpenGL.cmake
   FindSalomeParaView.cmake
+  UseSIP.cmake
   UsePyQt4.cmake
   UseQt4Ext.cmake
 )
   UsePyQt4.cmake
   UseQt4Ext.cmake
 )
index 0d204938b71495f2b0a46ff74eee1f255488a4b3..a282819ad9f32f2babcd1ddbed9dd5077b1f51d6 100644 (file)
@@ -25,7 +25,6 @@
 #    PYQT_PYRCC_PATH        - command to launch pyrcc with the correct PYTHONPATH
 #    PYQT_PYTHONPATH        - path to the PyQt Python modules
 #    PYQT_SIPS_DIR          - path to main include directory (which contains several sub folders)
 #    PYQT_PYRCC_PATH        - command to launch pyrcc with the correct PYTHONPATH
 #    PYQT_PYTHONPATH        - path to the PyQt Python modules
 #    PYQT_SIPS_DIR          - path to main include directory (which contains several sub folders)
-#    PYQT_INCLUDE_DIRS      - list of paths to include when compiling (all rooted on PYQT_SIP_DIRS)
 #    PYQT_SIPFLAGS          - compilation flags extracted from PyQt
 #
 #  The executables
 #    PYQT_SIPFLAGS          - compilation flags extracted from PyQt
 #
 #  The executables
@@ -77,25 +76,7 @@ sys.stdout.write(pyqtconfig.Configuration().pyqt_sip_flags)"
   OUTPUT_VARIABLE PYQT_SIPFLAGS)
 SEPARATE_ARGUMENTS(PYQT_SIPFLAGS)
 
   OUTPUT_VARIABLE PYQT_SIPFLAGS)
 SEPARATE_ARGUMENTS(PYQT_SIPFLAGS)
 
-SET(PYQT_INCLUDE_DIRS
-  "${PYQT_SIPS_DIR}"
-  "${PYQT_SIPS_DIR}/QtCore"
-  "${PYQT_SIPS_DIR}/QtGui"
-  "${PYQT_SIPS_DIR}/QtXml"
-  "${PYQT_SIPS_DIR}/QtOpenGL"
-  "${PYQT_SIPS_DIR}/QtAssistant"
-  "${PYQT_SIPS_DIR}/QtDesigner"
-  "${PYQT_SIPS_DIR}/QtNetwork"
-  "${PYQT_SIPS_DIR}/QtSql"
-  "${PYQT_SIPS_DIR}/QtSvg"
-  "${PYQT_SIPS_DIR}/QtTest"
-)
-
-SET(PYQT_CXX_EXT ".cc")
-SET(PYQT_SIPFLAGS ${PYQT_SIPFLAGS} -s ${PYQT_CXX_EXT} -c .)
-FOREACH(_dir ${PYQT_INCLUDE_DIRS})
-  LIST(APPEND PYQT_SIPFLAGS -I ${_dir})
-ENDFOREACH()
+SET(PYQT_SIPFLAGS ${PYQT_SIPFLAGS} -I "${PYQT_SIPS_DIR}")
 
 INCLUDE(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(PyQt4 REQUIRED_VARS PYQT_PYUIC_EXECUTABLE PYQT_PYRCC_EXECUTABLE PYQT_SIPS_DIR PYQT_SIPFLAGS )
 
 INCLUDE(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(PyQt4 REQUIRED_VARS PYQT_PYUIC_EXECUTABLE PYQT_PYRCC_EXECUTABLE PYQT_SIPS_DIR PYQT_SIPFLAGS )
index ee3ec4558d2553677cd16475f6fa36073fc563d3..391ce98fece9ac5d9c913046e7fdc2d13d5c601c 100644 (file)
@@ -18,6 +18,8 @@
 #
 # Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
 
 #
 # Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
 
+INCLUDE(UseSIP)
+
 ####################################################################
 #
 # _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME: internal function
 ####################################################################
 #
 # _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME: internal function
@@ -81,6 +83,7 @@ MACRO(PYQT4_WRAP_UIC outfiles)
   ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}})
 
  ELSE(NOT WIN32)
   ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}})
 
  ELSE(NOT WIN32)
+
 ####
 # ANA: Workaround for the Microsoft Visual Studio 2010. Seems there is a bug in 
 # the Microsoft Visual Studio 2010 or CMake 2.8.10.2: custom target doesn't work 
 ####
 # ANA: Workaround for the Microsoft Visual Studio 2010. Seems there is a bug in 
 # the Microsoft Visual Studio 2010 or CMake 2.8.10.2: custom target doesn't work 
@@ -113,71 +116,15 @@ ENDMACRO(PYQT4_WRAP_UIC)
 #
 # Generate C++ wrappings for *.sip files by processing them with sip.
 #
 #
 # Generate C++ wrappings for *.sip files by processing them with sip.
 #
-# USAGE: PYQT4_WRAP_SIP(output_files sip_files)
+# USAGE: PYQT4_WRAP_SIP(output_files sip_file [sip_file...] [OPTIONS options] [SOURCES sources])
 #
 #
-# ARGUMENTS:
-#   output_files [out] variable where output file names are listed to
-#   sip_files    [in]  list of *.sip files
-# 
-# NOTES:
-#   - Input files are considered relative to the current source directory.
-#   - Output files are generated in the current build directory.
-#   - This version of macro requires class(es) definition in the 
-#     *.sip file to be started on a new line without any preceeding characters.
-# 
-# WARNING:
-#   - The macro does not properly processes sip features which are wrapped
-#     with sip conditionals.
-#   - The macro works only if one single sip module is processed
-#     (there's only one %Module directive within all input sip files).
-#
-# TODO:
-#   - Check if dependency of static sources on generated headers works properly:
-#     if header is changed, dependant sources should be recompiled.
-#   - Think how to properly process sip conditionals.
-#   - Process several sip modules.
+# NOTES: See SIP_WRAP_SIP macro from UseSIP.cmake for the usage description.
 # 
 ####################################################################
 MACRO(PYQT4_WRAP_SIP outfiles)
 # 
 ####################################################################
 MACRO(PYQT4_WRAP_SIP outfiles)
-  SET(_output)
-  SET(_module_input)
-  FOREACH(_input ${ARGN})
-    FILE(STRINGS ${_input} _sip_modules REGEX "%Module")
-    FILE(STRINGS ${_input} _sip_classes REGEX "^class ")
-    FOREACH(_sip_module ${_sip_modules})
-      STRING(REGEX MATCH ".*%Module *\\( *name=.*\\).*" _mod_name "${_sip_module}")
-      IF (_mod_name)
-       STRING(REGEX REPLACE ".*%Module *\\( *name=(.*).*\\).*" "\\1" _mod_name ${_sip_module})
-      ELSE()
-       STRING(REGEX REPLACE ".*%Module *(.*)" "\\1" _mod_name ${_sip_module})
-      ENDIF()
-      SET(_mod_header "sipAPI${_mod_name}.h")
-      SET(_mod_source "sip${_mod_name}cmodule${PYQT_CXX_EXT}")
-      LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/${_mod_source})
-      SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/${_mod_source})
-      SET(_module_input ${_input})
-    ENDFOREACH()
-    FOREACH(_sip_class ${_sip_classes})
-      STRING(REGEX MATCH ".*class +.* *:" _class_name "${_sip_class}")
-      IF (_class_name)
-       STRING(REGEX REPLACE ".*class +(.*) *:.*" "\\1" _class_name ${_sip_class})
-      ELSE()
-       STRING(REGEX REPLACE ".*class *(.*)" "\\1" _class_name ${_sip_class})
-      ENDIF()
-      STRING(STRIP ${_class_name} _class_name)
-      SET(_class_source "sip${_mod_name}${_class_name}${PYQT_CXX_EXT}")
-      LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/${_class_source})
-      SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/${_class_source})
-    ENDFOREACH()
-  ENDFOREACH()
-  ADD_CUSTOM_COMMAND(
-    OUTPUT ${_output}
-    COMMAND ${SIP_EXECUTABLE} ${PYQT_SIPFLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${_module_input}
-    MAIN_DEPENDENCY ${_module_input}
-    )
+  SIP_WRAP_SIP(${outfiles} ${ARGN} OPTIONS ${PYQT_SIPFLAGS})
 ENDMACRO(PYQT4_WRAP_SIP)
 
 ENDMACRO(PYQT4_WRAP_SIP)
 
-
 ####################################################################
 #
 # PYQT4_WRAP_QRC macro
 ####################################################################
 #
 # PYQT4_WRAP_QRC macro
diff --git a/adm_local/cmake_files/UseSIP.cmake b/adm_local/cmake_files/UseSIP.cmake
new file mode 100644 (file)
index 0000000..cda454c
--- /dev/null
@@ -0,0 +1,117 @@
+# Copyright (C) 2012-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
+#
+# Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+####################################################################
+#
+# SIP_WRAP_SIP macro
+#
+# Generate C++ wrappings for *.sip files by processing them with sip.
+#
+# USAGE: SIP_WRAP_SIP(output_files sip_file [sip_file...] [OPTIONS options] [SOURCES sources])
+#
+# ARGUMENTS:
+#   output_files [out] variable where output file names are listed to
+#   sip_file     [in]  input sip file (a sequence can be provided)
+#   options      [in]  additional options to be specified to sip
+#   sources      [in]  additional source files to be included into output (see below)
+# 
+# NOTES:
+#   - Input files are considered relative to the current source directory.
+#   - Output files are generated in the current build directory.
+# 
+# WARNING:
+#   - Macro requires class(es) definition in the *.sip file(s) to be started
+#     on a new line without any preceeding characters.
+#   - Macro does not properly processes sip features which are wrapped
+#     with sip conditionals.
+#   - Macro works correctly only if one single sip module is processed
+#     (there's only one %Module directive within the set of input sip files).
+#   - Macro sometimes does not correctly computes full set of source files
+#     generated by sip; SOURCES option can be used to specify additional source
+#     files.
+#
+# TODO:
+#   - Check if dependency of static sources on generated headers works properly:
+#     if header is changed, dependant sources should be recompiled.
+#   - Process sip conditionals.
+#   - Process several sip modules.
+# 
+####################################################################
+MACRO(SIP_WRAP_SIP outfiles)
+  SET(_output)
+  SET(_src_ext ".cc")
+  SET(_options -s ${_src_ext} -c .)
+  SET(_sip_files)
+  SET(_get_options "0")
+  SET(_get_sources "0")
+  FOREACH(_input ${ARGN})
+    IF(${_input} STREQUAL "OPTIONS")
+      SET(_get_options "1")
+      SET(_get_sources "0")
+    ELSEIF(${_input} STREQUAL "SOURCES")
+      SET(_get_sources "1")
+      SET(_get_options "0")
+    ELSE()
+      IF(${_get_options} STREQUAL "1")
+        SET(_options ${_options} ${_input})
+      ELSEIF(${_get_sources} STREQUAL "1")
+        LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/${_input})
+        SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/${_input})
+      ELSE()
+        SET(_sip_files ${_sip_files} ${_input})
+      ENDIF()
+    ENDIF()
+  ENDFOREACH()
+  SET(_module_input)
+  FOREACH(_input ${_sip_files})
+    FILE(STRINGS ${_input} _sip_modules REGEX "%Module( |\\()")
+    FILE(STRINGS ${_input} _sip_classes REGEX "^class ")
+    FOREACH(_sip_module ${_sip_modules})
+      STRING(REGEX MATCH ".*%Module *\\( *name=.*\\).*" _mod_name "${_sip_module}")
+      IF (_mod_name)
+       STRING(REGEX REPLACE ".*%Module *\\( *name=(.*).*\\).*" "\\1" _mod_name ${_sip_module})
+      ELSE()
+       STRING(REGEX REPLACE ".*%Module *(.*)" "\\1" _mod_name ${_sip_module})
+      ENDIF()
+      SET(_mod_header "sipAPI${_mod_name}.h")
+      SET(_mod_source "sip${_mod_name}cmodule${_src_ext}")
+      LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/${_mod_source})
+      SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/${_mod_source})
+      SET(_module_input ${_input})
+    ENDFOREACH()
+    FOREACH(_sip_class ${_sip_classes})
+      STRING(REGEX MATCH ".*class +.* *:" _class_name "${_sip_class}")
+      IF (_class_name)
+       STRING(REGEX REPLACE ".*class +(.*) *:.*" "\\1" _class_name ${_sip_class})
+      ELSE()
+       STRING(REGEX REPLACE ".*class *(.*)" "\\1" _class_name ${_sip_class})
+      ENDIF()
+      STRING(STRIP ${_class_name} _class_name)
+      SET(_class_source "sip${_mod_name}${_class_name}${_src_ext}")
+      LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/${_class_source})
+      SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/${_class_source})
+    ENDFOREACH()
+  ENDFOREACH()
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${_output}
+    COMMAND ${SIP_EXECUTABLE} ${_options} ${CMAKE_CURRENT_SOURCE_DIR}/${_module_input}
+    MAIN_DEPENDENCY ${_module_input}
+    )
+ENDMACRO(SIP_WRAP_SIP)
index 6cd8e5dd5e04cad073e84c641a190e532b58b69e..10de9c3ed247dbc3265b1b17274cfdc25608a097 100644 (file)
@@ -22,5 +22,5 @@
 
 %Module SalomePyQtGUILight
 
 
 %Module SalomePyQtGUILight
 
-%Import QtGuimod.sip
-%Import QtXmlmod.sip
+%Import QtGui/QtGuimod.sip
+%Import QtXml/QtXmlmod.sip
index 0c32162b11dcac145c3d2b95e0da4c226b4f3e37..aa1a95104a419ef31730e6c7f7320c6a564b508b 100644 (file)
@@ -28,8 +28,8 @@
 %Feature ENABLE_CORBA
 %Feature ENABLE_PLOT2D
 
 %Feature ENABLE_CORBA
 %Feature ENABLE_PLOT2D
 
-%Import QtGuimod.sip
-%Import QtXmlmod.sip
+%Import QtGui/QtGuimod.sip
+%Import QtXml/QtXmlmod.sip
 
 %If (ENABLE_PLOT2D)
 %Include SalomePyQt_Plot2d.sip
 
 %If (ENABLE_PLOT2D)
 %Include SalomePyQt_Plot2d.sip