]> SALOME platform Git repositories - modules/gui.git/blobdiff - adm_local/cmake_files/UseSIP.cmake
Salome HOME
Allow setting / getting QByteArray preference item in Python modules.
[modules/gui.git] / adm_local / cmake_files / UseSIP.cmake
index 3cf805734ac799c147bb7059d03de05eb2842d8b..9ccfd07d83f0631238974055e18c5204ac9f7885 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2016  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
 #
 # Generate C++ wrappings for *.sip files by processing them with sip.
 #
-# USAGE: SIP_WRAP_SIP(output_files sip_file [sip_file...] [OPTIONS options])
+# 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.
 #   - 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 all input sip files).
+#     (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:
@@ -56,12 +60,20 @@ MACRO(SIP_WRAP_SIP outfiles)
   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()
@@ -69,7 +81,7 @@ MACRO(SIP_WRAP_SIP outfiles)
   ENDFOREACH()
   SET(_module_input)
   FOREACH(_input ${_sip_files})
-    FILE(STRINGS ${_input} _sip_modules REGEX "%Module")
+    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}")