[vtkusers] building MATLAB MEX files with vtk 6.1?
David Gobbi
david.gobbi at gmail.com
Wed Aug 6 16:38:28 EDT 2014
Also, though this is slightly off-topic, I'd also like to point out that it is
possible (and not very difficult) to build mex files with cmake without
using mex at all. After all, "mex" is just a shell script that calls the
compiler. Cmake can do that and a whole lot more.
- David
On Wed, Aug 6, 2014 at 2:27 PM, David E DeMarle
<dave.demarle at kitware.com> wrote:
> You will also be interested in this branch, in which Jameson restored VTK's
> matlab interface, which was lost in 6.0.
> * http://review.source.kitware.com/#/c/16043/
>
> On Wed, Aug 6, 2014 at 4:14 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>
>> Hi Bernard,
>>
>> As you have rightly guessed, the libraries vtkCommon, vtkRendering,
>> etc. no longer exist in VTK 6. The minimal set of libraries that you
>> need for VTK 6 are probably the following:
>>
>> vtkCommonCore
>> vtkCommonDataModel
>> vtkRenderingCore
>> vtkRenderingOpenGL
>> vtkRenderingFreeTypeOpenGL
>> vtkInteractionStyle
>>
>> - David
>>
>>
>> On Wed, Aug 6, 2014 at 11:13 AM, Meehan, Bernard <MEEHANBT at nv.doe.gov>
>> wrote:
>> > I've tried to get a couple of tutorials built using CMake and haven't
>> > had a
>> > whole lot of luck ...
>> >
>> > http://www.cmake.org/Wiki/CMake/MatlabMex
>> >
>> > http://www.mathworks.com/matlabcentral/fileexchange/19638-visualization-toolkit--vtk--mex-interface
>> > http://www.kitware.com/media/html/MATLABAndGNURIntegrationWithVTK.html
>> >
>> > I figured that I might try to do it by hand so to speak - just to prove
>> > to
>> > myself that I could get it to work. I used this as a test file (does
>> > nothing
>> > on purpose):
>> > #include "mex.h"
>> >
>> > #include <vtkSmartPointer.h>
>> > #include <vtkSphereSource.h>
>> > #define VTK_CREATE(type, name) \
>> > vtkSmartPointer<type> name = vtkSmartPointer<type>::New()
>> >
>> > void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray
>> > *prhs[])
>> > {
>> > mexPrintf("Hi there!\n");
>> > VTK_CREATE(vtkSphereSource, source);
>> > }
>> >
>> > And I tried to compile it with:
>> > #!/bin/sh
>> > MEX=/Applications/MATLAB_R2013b.app/bin/mex
>> > $MEX -I/Users/meehanbt/VTK/include/vtk-6.1/ hello.cxx
>> > -L/Users/meehanbt/VTK/lib/ -lvtkCommon -lvtkRendering
>> >
>> > Obviously, for VTK 6.1 - the libraries are much more finely grained ...
>> > and
>> > I just did a copy/paste from a webpage somewhere. Trying to build the
>> > simple
>> > program gives:
>> > ld: library not found for -lvtkCommon
>> > clang: error: linker command failed with exit code 1 (use -v to see
>> > invocation)
>> >
>> > mex: link of ' "hello.mexmaci64"' failed.
>> >
>> > Does anyone have any advice for how I would go about making a simple
>> > data
>> > display window or something like that as a MEX file?
More information about the vtkusers
mailing list