Help: Static build of vtk on win32

pahsieh at usgs.gov pahsieh at usgs.gov
Mon Mar 6 21:45:24 EST 2000


Andrew, Martin:

Building a static vtk library is actually quite easy in VC++, if you don't
want
to do anything fancy. Just create a Win32 Static Library project and don't
bother
with Pcmaker at all. Add all the vtk source files (in common, graphics,
imaging,
contrib) to the project except for any file whose name mentions java, tcl,
tk,
python, XGL, or Starbase. Also, leave out vtkOpenGLRenderWindow.

You have to make one line of code change. In vtkWin32Header.h, there is the
code

#ifdef VTKDLL
#define VTK_EXPORT __declspec( dllexport )
#else
#define VTK_EXPORT __declspec( dllimport )
#endif

Change the 4th line to

#define VTK_EXPORT

In other words, you will not define VTKDLL, and VTK_EXPORT will be defined
as nothing.

This takes just a few minutes to set up. Then just build away. I think the
default project settings work fine.

I have done this successfully in with past versions of vtk and I think this
should still work. (Actually, I only built the static library for the
common and
graphics toolkit.) When you build your executable, just add the .lib file
to
your project, and don't forget opengl32.lib and glaux.lib.

Actually, I prefer using dll myself, and people who use Java, tcl or python
also require the dll. I am a satisfied user of Pcmaker and I hope they
don't
do away with it unless replaced by something equivalent.

Gook luck.
Paul


> Hi Martin,
> I had exactly the same problem lately. The way I solved it: I edited the
> file 'getclasses.cxx' from VTK's Pcmaker.
> The point is: the MAKEFILEs for VTK are generated by this Pcmaker tool
that
> comes with the win32 VTK distribution, i.e. if you want VTK to be created
as
> a static library, then you HAVE to edit the Pcmaker's source files (which
> can be quite painful....). If you have Microsoft's VC++ then the task
gets a
> little bit simpler since Pcmaker comes with a .dsw (pojectworkspace for
> MSVC++) file.
> Besides that issue, I've changed several other things, if you are
> interested, I can send you the code (but beware: it may still contain
some
> bugs...).
> I think, that they should get rid of Pcmaker (I know, that its purpose is
> not only to generate makefiles....) and instead try to use TMAKE, a very
> neat tool used for makefile generation by QT. It would take some effort
to
> do that, but I think it would definitely be worth it. I don't know if the
> source code of TMAKE is available, but if it is then someone with
experience
> in perl (and enough time...) could do it (TMAKE uses templates that are
perl
> scripts basically).
> If anybody is interested in doing it (I just don't have enough time and
I'm
> not very experienced in perl...), I'd gladly help where I can.
>
> Andrew
>
> P.S.: If there's a simpler way to get static VTK libraries, I'd be glad
to
> hear about it.
>
>
> > -----Original Message-----
> > From: owner-vtkusers at public.kitware.com
> > [mailto:owner-vtkusers at public.kitware.com]On Behalf Of Martin MacRobert
> > Sent: Monday, March 06, 2000 4:18 PM
> > To: vtkusers at public.kitware.com
> > Subject: Help: Static build of vtk on win32
> >
> >
> > Has anyone successfully built a static library of VTK for win32?
> > What files do I include/exclude from the build?
> > What are the preprocessor settings if any?
> > Are there instructions already on the web?
> > Where can I find detailed information on licencing the code in a
> > commercial product?
> >
> > Many thanks,
> > Martin


--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list