View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004147CMakeModulespublic2006-12-05 19:122016-06-10 14:30
ReporterTristan Carel 
Assigned Tojschueller 
PrioritylowSeverityfeatureReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0004147: [MODULES][UseSWIG] Use swig to compute dependencies
DescriptionSwig is able to generate a file (in make language) which contains the
exact dependencies of the generated wrapper.

The following patch add the macro `SWIG_GET_WRAPPER_DEPENDENCIES' to the
`UseSWIG' module:

# SWIG_GET_WRAPPER_DEPENDENCIES(swigFile genWrapper language DEST_VARIABLE)
# - Put dependencies of the wrapper genWrapper generated by swig from
# swigFile in DEST_VARIABLE

The macro uses a `EXECUTE_PROCESS' which calls swig with the option
described above. The way to compute the command line used in the
EXECUTE_PROCESS is performed like `SWIG_ADD_MODULE' does:
- use GET_DIRECTORY_PROPERTY to retrieve the INCLUDE_DIRECTORIES
- use GET_SOURCE_FILE_PROPERTY to get extra flags attached to the swig
input file.

The dirty part of the macro is the content's extraction of the generated
file which is written in `make language'
target: \
 dependence1 \
 dependence2 \
 ...
 dependenceN

I has been tested with swig 1.3.{29,30,31} under Windows / Debian
Linux in 2 use cases:

/*--------------------------------------------------.
| with code which use the `SWIG_ADD_MODULE' command |
`--------------------------------------------------*/

# ...
SWIG_ADD_MODULE(Test python module.i foo.cpp foo.h)
# ...

/*----------------------------.
| with targets made manually: |
`----------------------------*/

# ...
SWIG_GET_WRAPPER_DEPENDENCIES(module.i module_wrap.cpp python module_deps)
ADD_CUSTOM_COMMAND(OUTPUT module_wrap.cpp
 COMMAND ${SWIG_EXECUTABLE} ARGS [...] -o module_wrap.cpp module.i
  MAIN_DEPENDENCY module.i
  DEPENDS ${module_deps}
SET_SOURCE_FILE_PROPERTIES(module_wrap.cpp PROPERTIES GENERATED TRUE)
# ...

thx
--
Tristan
TagsNo tags attached.
Attached Filespatch file icon UseSWIG.cmake.patch [^] (3,771 bytes) 1969-12-31 19:00 [Show Content]
? file icon UseSWIG.cmake.diff.RC2 [^] (3,714 bytes) 1969-12-31 19:00
? file icon UseSWIG.cmake.diff.RC3 [^] (3,750 bytes) 1969-12-31 19:00
? file icon UseSWIG.cmake.diff.RC4 [^] (3,770 bytes) 1969-12-31 19:00

 Relationships
related to 0012307closed regression in 2.8.5 rc2: UseSWIG.cmake broken 

  Notes
(0005904)
Tristan Carel (reporter)
2006-12-07 11:34

Please consider the RC2.
Thank you
(0005951)
Tristan Carel (reporter)
2006-12-12 10:34

RC3 changes with RC2:
- Fix typo SWIG -> SWIG_EXECUTABLE
- EXECUTE_PROCESS considers the variable CMAKE_SWIG_FLAGS (is used by the SWIG_ADD_MODULE macro)

Thanks to Axel Roebel!
(0005952)
Tristan Carel (reporter)
2006-12-12 11:47

RC4 changes with RC3:
Fix typo in the MESSAGE(SEND_ERROR ...)
(0013798)
Bill Hoffman (manager)
2008-10-09 13:09

Do you want to maintain this module?

http://www.cmake.org/Wiki/CMake:Module_Maintainers [^]
(0025934)
Mathieu Malaterre (developer)
2011-03-28 12:20

$ git push stage HEAD
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 1.21 KiB, done.
Total 4 (delta 3), reused 0 (delta 0)
To git@cmake.org:stage/cmake.git
 * [new branch] HEAD -> fixbug_0004147
(0026976)
David Cole (manager)
2011-06-26 08:39

Looks like the fix for this bug is the cause of 0012307
(0026991)
Brad King (manager)
2011-06-27 13:06

Due to issue 0012307 I'm re-opening this issue and reverting its fix for the 2.8.5 release:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2377d7a2 [^]

Now the interested parties can take the necessary time to find a solution to the regression.
(0026994)
Brad King (manager)
2011-06-27 13:40

New revert commit with better message:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fc045318 [^]
(0038989)
FlorianM (reporter)
2015-06-26 11:00
edited on: 2015-06-26 11:01

This is a useful feature and I like to advocate to add it again.

Just adding -ignoremissing SWIG option should solve the problems discussed in 0012307:

EXECUTE_PROCESS(
    COMMAND ${SWIG_EXECUTABLE}
    -MM -MF ${swig_getdeps_depsfile} ${swig_getdeps_extra_flags}
    -ignoremissing ${CMAKE_SWIG_FLAGS} -${language}
    -o ${genWrapper} ${swig_getdeps_include_dirs} ${swigFile}
    RESULT_VARIABLE swig_getdeps_result
    ERROR_VARIABLE swig_getdeps_error
    OUTPUT_STRIP_TRAILING_WHITESPACE)

(0038991)
Brad King (manager)
2015-06-26 11:10

Re 0004147:0038989: If you are interested in working on the feature, please read CONTRIBUTING.rst at the top of our source tree. Also see:

 http://www.cmake.org/Wiki/CMake:Module_Maintainers [^]
(0039007)
Cameron Christensen (reporter)
2015-07-01 11:48

I'm working on this issue as well, and we're talking about it over here: http://stackoverflow.com/questions/31007635/is-there-a-way-for-cmake-to-utilize-dependencies-generated-by-swig-mm?noredirect=1#comment50300252_31007635 [^]

I have reapplied the original patch from Mathieu and added the -ignoremissing suggestion from Florian. In my real life project it appears that generated files, whose presence is now ignored by swig -MM, still cause a problem on the cmake side. I need to investigate this more by adding a generated file to my example case from the stackoverflow question.

The current changes are available in the swig-dependencies branch here: https://github.com/cchriste/cmake [^]

I do not wish to become a module maintainer at this time, only to resolve this issue.
(0041335)
Kitware Robot (administrator)
2016-06-10 14:27

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2008-10-09 13:09 Bill Hoffman Note Added: 0013798
2009-10-30 11:55 Mathieu Malaterre Assigned To Bill Hoffman => Mathieu Malaterre
2011-03-28 12:20 Mathieu Malaterre Note Added: 0025934
2011-03-28 12:20 Mathieu Malaterre Status assigned => closed
2011-03-28 12:20 Mathieu Malaterre Resolution open => fixed
2011-06-26 08:38 David Cole Relationship added related to 0012307
2011-06-26 08:39 David Cole Note Added: 0026976
2011-06-27 13:06 Brad King Note Added: 0026991
2011-06-27 13:06 Brad King Status closed => feedback
2011-06-27 13:06 Brad King Resolution fixed => reopened
2011-06-27 13:40 Brad King Note Added: 0026994
2015-06-26 11:00 FlorianM Note Added: 0038989
2015-06-26 11:01 FlorianM Note Edited: 0038989
2015-06-26 11:06 Brad King Assigned To Mathieu Malaterre => jschueller
2015-06-26 11:06 Brad King Status feedback => assigned
2015-06-26 11:06 Brad King Resolution reopened => open
2015-06-26 11:10 Brad King Note Added: 0038991
2015-07-01 11:48 Cameron Christensen Note Added: 0039007
2016-06-10 14:27 Kitware Robot Note Added: 0041335
2016-06-10 14:27 Kitware Robot Status assigned => resolved
2016-06-10 14:27 Kitware Robot Resolution open => moved
2016-06-10 14:30 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team