vtkLocal in 15 Easy Steps (was RE: [vtkusers] VTK 4.0 Local?)

Volpe, Christopher R (CRD) volpecr at crd.ge.com
Wed Dec 19 09:48:53 EST 2001


Well, it's been suggested before, but the kitware folks say it leads to problems where, if the
directory's recognized by CVS, people will inadvertently check in their own local files.


For what it's worth, here are my changes for ensuring that the LOCAL directory works not only from a
"package require vtk" in wish, but also in the vtk.exe executable. Where I say to add things to a
file, it should be fairly obvious upon looking at the file where the things are to be added. (Note:
This assumes your local depends on hybrid. If something else would be more appropriate for you,
adjust accordingly.)

1) Create LocalUserOptions.cmake in top-level VTK source folder that contains this:
---
OPTION (VTK_USE_LOCAL "Build the local directory classes")

IF (VTK_USE_LOCAL)
  INCLUDE_DIRECTORIES(${VTK_SOURCE_DIR}/Local)
  LINK_DIRECTORIES(${VTK_BINARY_DIR}/Local)
  SUBDIRS(Local)
  SUBDIR_DEPENDS(Local Hybrid)
  IF (VTK_WRAP_TCL)
    SUBDIR_DEPENDS(Wrapping/Tcl Local)
  ENDIF (VTK_WRAP_TCL)
ENDIF (VTK_USE_LOCAL)
---

2) Add the following to vtkCMakeOptions.cmake:

---
IF (VTK_USE_LOCAL)
  # local required hybrid
  IF (VTK_USE_HYBRID)
    INCLUDE_DIRECTORIES(${VTK_SOURCE_DIR}/Local)
    IF (NOT VTK_LIBRARY_PATH)
      LINK_DIRECTORIES(${VTK_BINARY_DIR}/Local)
    ENDIF (NOT VTK_LIBRARY_PATH)
  ELSE (VTK_USE_HYBRID)
    MESSAGE("The Local option requires Hybrid, but you do not have Hybrid selected." "Warning")
  ENDIF (VTK_USE_HYBRID)
ENDIF (VTK_USE_LOCAL)  
---

3) Add the following to vtkToolkits.h.in:
---
#cmakedefine VTK_USE_LOCAL
---

4) Add the following to Wrapping/vtktcl.c:
---
#ifdef VTK_USE_LOCAL
extern Vtklocaltcl_Init(Tcl_Interp *interp);
#endif
---
and
---
#ifdef VTK_USE_LOCAL
  if (Vtklocaltcl_Init(interp) == TCL_ERROR) 
    {
    return TCL_ERROR;
    }
#endif
---

5) Create a file LocalUserOptions.cmake in Wrapping/Tcl that contains the following:
---
IF (VTK_USE_LOCAL)
  LINK_LIBRARIES(vtkLocalTCL vtkLocal)
ENDIF (VTK_USE_LOCAL)

IF (VTK_USE_LOCAL)
  SUBDIRS(vtklocal)
ENDIF (VTK_USE_LOCAL)
---

6) Add the following to Wrapping/Tcl/tkAppInit.cxx.in:
---
#ifdef VTK_USE_LOCAL
extern "C" int Vtklocaltcl_Init(Tcl_Interp *interp);
#endif
---
and
---
#ifdef VTK_USE_LOCAL
  if (Vtklocaltcl_Init(interp) == TCL_ERROR) 
    {
    return TCL_ERROR;
    }
#endif
---

7) Add the following to Wrapping/Tcl/vtktcl.c:
---
#ifdef VTK_USE_LOCAL
extern int vtklocaltcl_Init(Tcl_Interp *interp);
#endif
---
and
---
#ifdef VTK_USE_LOCAL
  if (vtklocaltcl_Init(interp) == TCL_ERROR)
    {
    return TCL_ERROR;
    }
#endif
---

8) Add the following to Wrapping/Tcl/vtk/vtk.tcl
---
catch {
    package require vtklocal
}
---

9) Create a new folder "vtklocal" under Wrapping/Tcl

10) Create a file CMakeLists.txt in Wrapping/Tcl/vtklocal that contains the following:
---
INSTALL_FILES(/lib/vtk/tcl/vtklocal "\\.tcl$")
---

11) Create a file vtklocal.tcl in Wrapping/Tcl/vtklocal that contains the following:
---
package require hybrid

if {[info commands vtkSoundData] != "" ||
    [::vtk::load_component vtkLocalTCL] == ""} {
    package provide vtklocal 4.0
}
---

12) Add the following to Wrapping/Tcl/MakePackages.tcl
---
pkg_mkIndex -direct -verbose vtklocal
---

13) Run the MakePackages.tcl script in Wrapping/Tcl so that it
creates the pkgIndex.tcl file in Wrapping/Tcl/vtklocal

14) Run CMake, configure, turn on the USE_VTK_LOCAL option, configure, ok

15) Load vtk.dsw in DevStudio and rebuild.


Hope this helps.

Chris
> GE Corporate Research & Development 
> 
Christopher R. Volpe
Computer Scientist
Visualization and Computer Vision Lab / Global Imaging Technology
Bldg KW, Room C215
P.O. Box 8, Schenectady, NY 12301

(518) 387-7766, Dial Comm: 8*833-7766, Fax: (518) 387-6981
e-mail: volpecr at crd.ge.com    web: http://www.crd.ge.com/~volpecr







> -----Original Message-----
> From: Mumit Khan [mailto:khan at nanotech.wisc.edu]
> Sent: Tuesday, December 18, 2001 4:58 PM
> To: William A. Hoffman
> Cc: VTK Users
> Subject: Re: [vtkusers] VTK 4.0 Local?
> 
> 
> On Tue, 20 Nov 2001, William A. Hoffman wrote:
> 
> > You can create one yourself with cmake.
> >
> > Just create a  LocalUserOptions.cmake at the top with a
> > SUBDIRS(Local) in it.
> >
> > You will need another LocalUserOptions.cmake in the Wrapping/Tcl/
> > directory as well.
> > That should have a LINK_LIBRARIES(vtkLocal) in it.
> >
> > We don't want any user editable files in the source tree.
> > This was a problem with vtk in the past.   It was too easy 
> to cvs commit
> > those files by mistake.
> 
> May I suggest a contrib package (.tar.gz, .zip, what not) that has the
> skeleton files needed for Local? The following files should cover the
> basic need:
> 
>   VTK/LocalUserOptions.cmake
>   VTK/Local/CMakeLists.txt
>   VTK/Local/vtkDummyObject.cxx
>   VTK/Local/vtkDummyObject.h
>   VTK/Wrapping/Tcl/LocalUserOptions.cmake
>   VTK/Wrapping/Tcl/vtklocal/CMakeLists.txt
>   VTK/Wrapping/Tcl/vtklocal/pkgIndex.tcl
>   VTK/Wrapping/Tcl/vtklocal/vtklocal.tcl
> 
> Where vtkDummyObject.{h,cxx} is just what the name implies. If there's
> interest, I'll package it up.
> 
> Regards,
> Mumit
> 
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: 
> <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
> 



More information about the vtkusers mailing list