<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">This worked !!! Thank you so much for
your swift reply David.<br>
<br>
On 09/20/2016 11:31 AM, David Gobbi wrote:<br>
</div>
<blockquote
cite="mid:CANwS1=HKnVFgKwyJ3jE5hD8hXP5uAo9aXc-uYu0CEDXcN9CysQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>Hi Kate,</div>
<div><br>
</div>
<div>The magic CMake incantations for python modules are as
follows:</div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px"> set(MODULE_PYTHON_NAME
vtkhdftIOPython)</span></div>
<div> add_library(${MODULE_PYTHON_<wbr>NAME} MODULE
${MODULE_PYTHON_NAME}Init.cxx)</div>
<div> set_target_properties(${<wbr>MODULE_PYTHON_NAME}
PROPERTIES PREFIX "")</div>
<div> if(WIN32 AND NOT CYGWIN)</div>
<div> set_target_properties(${<wbr>MODULE_PYTHON_NAME}
PROPERTIES SUFFIX ".pyd")</div>
<div> endif()</div>
<div> if(CMAKE_VERSION VERSION_GREATER 2.8.8)</div>
<div> set_target_properties(${<wbr>MODULE_PYTHON_NAME}
PROPERTIES NO_SONAME 1)</div>
<div> endif()</div>
<div><br>
</div>
<div>The trick is to set the prefix specifically for
vtkhdftIOPython, don't try to set a global prefix with <span
style="font-size:12.8px">CMAKE_SHARED_LIBRARY_<wbr>PREFIX.</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px"> - David</span></div>
<div><br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Sep 20, 2016 at 7:43 AM, Kate
Fissell <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:fissell@pitt.edu" target="_blank">fissell@pitt.edu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I am running VTK-7.0.0 on an Ubuntu platform using python
2.7.<br>
I have a cmake configuration for python wrapping that
worked on VTK-6.2.0 and I<br>
am trying to port it to VTK-7.<br>
<br>
It builds ok, but when I try to import into python I get
the error<br>
ImportError: dynamic module does not define init function
(initlibvtkhdftIOPython)<br>
(my function is vtkhdftIO).<br>
<br>
I believe this is because vtkWrapPythonInit.c no longer
has the loop<br>
#if defined(__CYGWIN__) || !defined(_WIN32)<br>
/* add a "lib" prefix for compatibility with old
python scripts */<br>
if (strcmp(prefix, "lib") != 0)<br>
{<br>
prefix = "lib";<br>
continue;<br>
}<br>
#endif<br>
<br>
<br>
My lib is named libvtkhdftIOPython.so,
libvtkhdftIOPythonD.so, but it contains<br>
initvtkhdftIOPython (from running strings on the .so).
Under vtk-6.2.0<br>
the so file contained<br>
initvtkhdftIOPython<br>
initlibvtkhdftIOPython<br>
<br>
I have tried various things with
CMAKE_SHARED_LIBRARY_PREFIX to either<br>
get cmake to build the initlibvtkhdftIOPython function,
or, to take the lib prefix off<br>
the .so, but have not succeeded.<br>
<br>
Can you tell me how to get the lib prefix correctly
coordinated between init<br>
function and lib name ?<br>
<br>
thanks<br>
Kate<br>
</blockquote>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>