Hi all!
I'm working on the python plugin interface and have run into a
problem. I am using SWIG to generate the wrapper code, and to access
the SWIG-generated types from C++, I have to include an automatically
generated header file. On the command line I can generate this file by
typing
swig -c++ -python -external-runtime
Which produces the file in the current directory with the default name
'swigpyrun.h'. I can also specify the filename, like in
swig -c++ -python -external-runtime use_another_name.h
If I'm not happy with the default name or want it somewhere else.
Cmake is set up as per Cmake wiki, this is the section I use to
generate the wrapper code from the two files hsi.i and hsi.cpp:
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})
FIND_PACKAGE(PythonLibs)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
SET(CMAKE_SWIG_FLAGS "")
SET_SOURCE_FILES_PROPERTIES(hsi.i PROPERTIES CPLUSPLUS ON)
SWIG_ADD_MODULE(hsi python hsi.i hsi.cpp)
SWIG_LINK_LIBRARIES(hsi ${PYTHON_LIBRARIES} ${common_libs})
That works well and automatically generates the relevant wrapper files
hsi.py and _hsi.so, but so far I haven't found a way of telling Cmake
to also generate above-mentioned header file swigpyrun.h. It's not
totally crucial to generate it from scratch every time, but it must be
compatible with the wrapper code, so I'd rather have it generated than
later run into obscure incompatibilities for using one I make manually
now.
I also have another question: Cmake generates a C++ file which
contains the wrapping. This file is clean C++ and does not rely on any
SWIG libraries or headers to compile - it can be used to distribute
SWIG's output without SWIG. This file is generated from the interface
definition file; in my case, with the CMakeLists.txt as above, it is
generated from hsi.i, named automatically as hsiPYTHON_wrap.cxx and
written to the output directory. then it is compiled and linked with
hsi.cpp and the output, _hsi.so and hsi.py is created. My question is
how I could customize the behaviour to:
- create hsiPYTHON_wrap.cxx only if SWIG and hsi.i are available
- use a prefabricated version of it if SWIG is not available and not
bother with hsi.i at all in that case
Help with these problems would be greatly appreciated
Kay
--
You received this message because you are subscribed to the Google Groups
"Hugin and other free panoramic software" group.
A list of frequently asked questions is available at:
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/hugin-ptx