ITK/Examples/Instructions

From KitwarePublic
< ITK‎ | Examples
Revision as of 14:57, 14 February 2011 by Daviddoria (talk | contribs) (Created page with "==Build an example== # Create a source directory (mkdir '''ExampleName''') # Copy and paste the source code under the heading '''ExampleName'''.cxx into an editor and save the fi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Build an example

  1. Create a source directory (mkdir ExampleName)
  2. Copy and paste the source code under the heading ExampleName.cxx into an editor and save the file as ExampleName.cxx in the source directory you have just created.
  3. Copy and paste the text under the heading CMakeLists.txt into an editor and save the file as CMakeLists.txt in the same directory.
  4. Create a build directory (mkdir bin). This can be inside of your source directory, but it doesn't have to be.

From here, the instructions are operating system specific:

Linux

From your build directory, run

ccmake YourSourceDirectory (to create a Unix Makefile)

or

ccmake YourSourceDirectory -G YourIDE (e.g. KDevelop3)
  1. Press 'c' to configure.
  2. If CMake finds the correct location of you VTK binary build (the VTK_DIR cmake variable), great! If not, use the arrow keys to scroll down to VTK_DIR, press enter, type the location of your VTK binary build (likely something like /home/yourname/bin/VTK), and press enter.
  3. Press 'c' again to reconfigure
  4. Press 'g' to generate
  5. If you generated a Unix Makefile, type 'make' in your build directory
  6. If you generated a project for an IDE, open the project file with your IDE

Windows

  1. Open CMake
  2. Select your CMakeLists.txt file
  3. Select your build system
  4. Click "Generate"
  5. You will now have a "project" for your IDE (for example, a .sln file if you selected Visual Studio). You can open this project with your IDE and return to your normal workflow.