Slicer3:Module Link Setup for Windows

From NAMIC Wiki
Revision as of 16:56, 19 September 2007 by Pieper (talk | contribs) (New page: When making a new library or module for Slicer3 you need to carefully set things up so for building. Best thing to do is copy an existing directory that does something similar to what you...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home < Slicer3:Module Link Setup for Windows

When making a new library or module for Slicer3 you need to carefully set things up so for building. Best thing to do is copy an existing directory that does something similar to what you have in mind and then change things to match your module setup.

Definitions

LibraryName is the first argument to ADD_LIBRARY in CMakeLists for your directory.

LIRBARYNAME is the argument to PROJECT() at the top of the CMakeLists

Files to Change/Create

vtkLibraryNameConfigure.h.in -- just copy and rename an example one.

vtkLibraryName.h -- copy and rename example one and have it include vtkLibraryNameWind32Header.h (note that this .h file will be in your build directory and is made from the .h.in file above).

vtkLibraryNameWin32Header.h -- make the following changes:

#ifndef __vtkLibraryNameWin32Header_h
#define __vtkLibraryNameWin32Header_h

#include <vtkLibraryNameConfigure.h>

#if defined(WIN32) && !defined(VTKSLICER_STATIC)
#if defined(LibraryName_EXPORTS)
#define VTK_LIBRARYNAME_EXPORT __declspec( dllexport ) 
#else
#define VTK_LIBRARYNAME_EXPORT __declspec( dllimport ) 
#endif
#else
#define VTK_LIBRARYNAME_EXPORT 
#endif

#endif

CMakeLists.txt should contain:

CONFIGURE_FILE(
  ${LIBRARYNAME_SOURCE_DIR}/vtkLibraryNameConfigure.h.in 
  ${LIBRARYNAME_BINARY_DIR}/vtkLibraryNameConfigure.h
)