From: vsr Date: Fri, 29 Jan 2016 08:16:50 +0000 (+0300) Subject: Additionally provide SOURCES paramerter for SIP_WRAP_SIP() macro X-Git-Tag: V8_0_0rc1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3ea3cbc0ced565193b09e2ea27b28d5e1c090e32;p=modules%2Fgui.git Additionally provide SOURCES paramerter for SIP_WRAP_SIP() macro --- diff --git a/adm_local/cmake_files/UsePyQt.cmake b/adm_local/cmake_files/UsePyQt.cmake index 8a36012a5..c9f747780 100644 --- a/adm_local/cmake_files/UsePyQt.cmake +++ b/adm_local/cmake_files/UsePyQt.cmake @@ -116,13 +116,9 @@ ENDMACRO(PYQT_WRAP_UIC) # # 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) diff --git a/adm_local/cmake_files/UseSIP.cmake b/adm_local/cmake_files/UseSIP.cmake index 3cf805734..cda454cf3 100644 --- a/adm_local/cmake_files/UseSIP.cmake +++ b/adm_local/cmake_files/UseSIP.cmake @@ -24,12 +24,13 @@ # # 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. @@ -41,7 +42,10 @@ # - 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}")