#
# Generate C++ wrappings for *.sip files by processing them with sip.
#
-# USAGE: PYQT_WRAP_SIP(output_files sip_file [sip_file ...])
+# USAGE: PYQT_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)
-#
-# NOTES: See SIP_WRAP_SIP macro from UseSIP.cmake.
+# NOTES: See SIP_WRAP_SIP macro from UseSIP.cmake for the usage description.
#
####################################################################
MACRO(PYQT_WRAP_SIP outfiles)
#
# 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:
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()
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}")