[vtkusers] getting started

Steven Hansen stevenhansen01 at yahoo.com
Thu Nov 10 23:03:46 EST 2005


Hey everybody,
 
    I'm a new VTK user, and I just need a few tips to get started.  I mainly need help with the CMakeLists.txt file.  I have an example VTK program called "Helix" that I am trying to run.  I have installed VTK, and it contains the libraries that Helix needs to run, but when I try to build the Helix solution, there are errors saying that it cannot find vtkRenderWindowInteractor.h, vtkActor.h, etc.  I can find these files on my own, and they are in directories like C:/VTK/Rendering/   However, this is in the original VTK directory, and not the VTK_Build directory.  All of the right directories are in the CMakeLists.txt file in these lines:
 
TARGET_LINK_LIBRARIES( helix
  ${QT_LIBRARIES}
  vtkRendering
  vtkFiltering
  vtkGraphics
  vtkIO
  vtkCommon
 
but there is something that isn't right.  Either I didn't build VTK right, and the h-files didn't get into the build directory, or I need to know how to add lines into the CMakeLists.txt file to tell my Helix build where to go find the right files.  Here is my entire CMakeLists.txt file in case it helps:  (P.S.- I am working in WindowsXP.)
 
PROJECT(helix)
 
SET(VTK_DIR C:/VTK_ALL/VTK)
INCLUDE_DIRECTORIES(${VTK_DIR}/include/vtk)
LINK_DIRECTORIES(${VTK_DIR}/lib/vtk)
 
#FIND_PACKAGE(VTK)
#IF(NOT VTK_DIR)
#  MESSAGE(FATAL_ERROR "Please set VTK_DIR.")
#ENDIF(NOT VTK_DIR)
#INCLUDE(${VTK_USE_FILE})
 
# use what QVTK built with
SET(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
SET(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")
SET(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
SET(DESIRED_QT_VERSION ${VTK_DESIRED_QT_VERSION} CACHE STRING "")
FIND_PACKAGE(Qt)
IF(QT_USE_FILE)
  INCLUDE(${QT_USE_FILE})
ELSE(QT_USE_FILE)
  SET(QT_LIBRARIES   ${QT_QT_LIBRARY})
ENDIF(QT_USE_FILE)
 
SET (HelixSrcs
  main.cpp
  QVTKWidget.cxx
)
SET(UIS helix.ui)
SET (HelixHeaders QVTKWidget.h)
 
# Use the include path and library for Qt that is used by VTK.
INCLUDE_DIRECTORIES(
  ${QT_INCLUDE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
)
 
QT_WRAP_UI( helix UIHeaders UISrcs ${UIS})
QT_WRAP_CPP( shelix MOCSrcs ${HelixHeaders} )
SET_SOURCE_FILES_PROPERTIES(${HelixSrcs} PROPERTIES
                            OBJECT_DEPENDS "${UIHeaders}")
 

# It's nice to have the ui in the windows project file...just double click on it
# and designer comes up on that ui file :)
IF (${CMAKE_BUILD_TOOL} MATCHES "msdev")
  SET (HelixSrcs ${HelixSrcs} ${UIS})
ENDIF (${CMAKE_BUILD_TOOL} MATCHES "msdev")
IF (${CMAKE_BUILD_TOOL} MATCHES "devenv")
  SET (SimpleViewSrcs ${SimpleViewSrcs} ${UIS})
ENDIF (${CMAKE_BUILD_TOOL} MATCHES "devenv")
 
#ADD_EXECUTABLE( helix WIN32 ${HelixSrcs} ${UISrcs} ${MOCSrcs})
ADD_EXECUTABLE( helix ${HelixSrcs} ${UISrcs} ${MOCSrcs})
 
TARGET_LINK_LIBRARIES( helix
  ${QT_LIBRARIES}
  vtkRendering
  vtkFiltering
  vtkGraphics
  vtkIO
  vtkCommon
)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051110/8e4ac472/attachment.htm>


More information about the vtkusers mailing list