[CMake] CMake SWIG support for nested python modules
Bill Hoffman
bill.hoffman at kitware.com
Tue Mar 31 16:54:11 EDT 2009
Bill Spotz wrote:
> Hello,
>
> I am the developer of PyTrilinos, the python interface to Trilinos and I
> have hit upon some unexpected behavior.
>
> I am trying to wrap the interface to NOX, which utilizes nested
> namespaces. I shadow this structure in python by utilizing nested
> modules. For example, a subset of the NOX namespace structure is given by
>
> NOX
> Abstract
> StatusTest
> Solver
> Epetra
> Interface
>
> My goal, which I had previously achieved under an autotools/distutils
> hybrid build system, is to generate the following directory structure:
>
> NOX/__init__.py
> Abstract.py
> StatusTest.py
> Solver.py
> Epetra/__init__.py
> Interface.py
>
> To do this, I have the following swig interface files:
>
> NOX.__init__.i
> NOX.Abstract.i
> NOX.StatusTest.i
> NOX.Solver.i
> NOX.Epetra.__init__.i
> NOX.Epetra.Interface.i
>
> The problem I am running into seems to be associated with the "."
> characters in the swig interface filenames. I get several invocations
> of the swig executable working on NOX.__init__.i that produce
> NOXPYTHON_wrap.cxx. Is there a way around this behavior?
>
I assume you are using the macro's for swig found in UseSWIG.cmake?
You might have to create the custom commands by hand.
Information about that can be found here:
http://www.vtk.org/Wiki/CMake_FAQ#How_can_I_generate_a_source_file_during_the_build.3F
It is just a matter of using the correct swig invocation in the custom
command to create the files where you want them. Can post a small
example of what you are trying right now?
-Bill
More information about the CMake
mailing list