On 18 Jan., 16:47, kfj <_...@yahoo.com> wrote:

> 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.

Try ADD_CUSTOM_COMMAND

e.g. something like

ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.h"
  COMMAND "${SWIG_EXECUTABLE}"
  ARGS "-c++" "-python" "-external-runtime"
  WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
  COMMENT "Build python header file..."
)
SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.h"
GENERATED)
ADD_CUSTOM_TARGET(hsi_header DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/
swigpyrun.h")

>
> - create hsiPYTHON_wrap.cxx only if SWIG and hsi.i are available
Change to
FIND_PACKAGE(SWIG)
IF(SWIG_FOUND)
..
ENDIF()


> - use a prefabricated version of it if SWIG is not available and not
> bother with hsi.i at all in that case

I think this is a bad idea. The wrapper file needs always to re-
generated if the (hugin) source was changed.
So the scripting interface should only be build if swig is found.

Thomas

PS: I tried hsi on windows. It compiles. But the generated lib is
called _hsi.pyd (not hsi.pyd).
And when I try to run in python your example, I'm getting errors. I
can run the procedure, but I'm can access the object:

>>> from _hsi import *
>>> p=pano_open('974-1-975-1.pto')
>>> img0=p.getImage(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'SwigPyObject' object has no attribute 'getImage'
>>> p.getCtrlPoints()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'SwigPyObject' object has no attribute 'getCtrlPoints'

-- 
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 hugin-ptx@googlegroups.com
To unsubscribe from this group, send email to 
hugin-ptx+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/hugin-ptx

Reply via email to