Building VTK for Mobile Architectures

Starting with the 6.2.0 release, VTK now provides support for mobile architectures, specifically iOS and Android. The new OpenGL2 rendering backend supports both OpenGL ES 2.0 and 3.0. VTK’s build system has also been simplified for cross-compiling to mobile architectures.

 

With these changes, VES will soon be deprecated in favor of VTK for all new mobile development. As this support is currently considered beta quality, we encourage contributors to use, extend, and file bugs against VTK for these architectures.

 

The remainder of this post is a guide for building VTK for mobile devices:

 

 

iOS

 

First ensure that you have the latest Xcode and XCode developer tools installed.

 

To build the VTK framework for iOS development, configure CMake with VTK_IOS_BUILD=ON. CMake will then present a limited set of options, which will we shortly review. Be sure to generate only Unix Makefiles or Ninja build files, as Xcode will not work for this special build. Then use CMake as usual to produce project build files.

 

The project files generated by CMake will perform three builds. The first is done to generate VTK’s compile tools which are needed for cross compilation. The second build compiles all supported VTK libraries for the specified device architectures. The last build compiles the same libraries for the specified simulator architectures.

 

Once the three builds have been completed, all built libraries are statically combined into vtk.lib using libtool. This, along with the VTK header files, constitutes vtk.framework which can be used directly in iOS projects.

 

For a starting point, there are several examples in the Examples/iOS directory.

 

The CMake options relevant to most users here are:

 

CMAKE_FRAMEWORK_INSTALL_PREFIX is the directory in which vtk.framework will be installed. This path defaults to /usr/local/frameworks, which is where the examples bundled with VTK will look for the framework.

 

IOS_DEVICE_ARCHITECTURES is the list of device architectures to build. Check the current Xcode documentation to choose the correct architectures for your supported devices.

 

IOS_SIMULATOR_ARCHITECTURES is the list of simulator architectures to build. Typically this is simply i386 or x86_64, i.e., the architecture of your development and/or testing machines.

 

OPENGL_ES_VERSION should be either 2.0 or 3.0.

 

 

Android

 

Update: Please use VTK v6.2.0.rc1 or later as v6.2.0 has a bug that will prevent a successful build.

 

First ensure that you have installed the latest Android NDK (Native Development Kit). As of writing, VTK supports NDK versions 5 through 10d (December 2014).

 

Configure CMake with VTK_ANDROID_BUILD=ON, confirm or change the presented options, then build. Currently only Makefiles and Ninja build files are supported. As with the iOS build process, VTK will be built more than once. For Android only two passes are required, once for the compile tools and a second time to cross-compile to the chosen Android architecture.

 

The built static libraries can then be used in your Android project. Unfortunately as of this writing, there are no examples for Android. We encourage all developers to share and contribute examples when possible.

 

For Android, the relevant CMake options are:

 

ANDROID_NDK specifies the path to the Android NDK. Typically this is /opt/android-ndk on Unix-like systems.

 

ANDROID_ARCH_NAME specifies the target Android architecture for cross compilation.

 

ANDROID_NATIVE_API_LEVEL – The API level to support. For example, Android 5.0 ‘Lollipop’ is API level 21.

 

OPENGL_ES_VERSION should be 2.0 or 3.0.

 

46 Responses to Building VTK for Mobile Architectures

  1. Pingback: Arron Guo

  2. Pingback: Tim Thirion

  3. Pingback: Lonni Besançon

  4. Pingback: Tim Thirion

  5. Pingback: Lonni Besançon

  6. Pingback: William Du Roy

  7. Pingback: Tim Thirion

  8. Pingback: Lonni Besançon

  9. Pingback: Tim Thirion

  10. Pingback: Lonni Besançon

  11. Pingback: Tim Thirion

  12. Pingback: Lonni Besançon

  13. Pingback: Tim Thirion

  14. Pingback: William Du Roy

  15. Pingback: Tim Thirion

    • Pingback: shengfei

  16. Pingback: William Du Roy

  17. Pingback: Tim Thirion

  18. Pingback: William Du Roy

  19. Pingback: Tim Thirion

  20. Pingback: Yassmin Abdallah

    • Pingback: shengfei

  21. Pingback: Tim Thirion

  22. Pingback: Yassmin Abdallah

  23. Pingback: Tim Thirion

  24. Pingback: Yassmin Abdallah

  25. Pingback: Yassmin Abdallah

  26. Pingback: Tim Thirion

  27. Pingback: Yassmin Abdallah

  28. Pingback: Tim Thirion

  29. Pingback: occularis

  30. Pingback: Roberto Garrido Martín

  31. Pingback: Tim Thirion

  32. Pingback: Andrei

    • Pingback: shengfei

  33. Pingback: Tim Thirion

  34. Pingback: leon

  35. Pingback: shengfei

  36. Pingback: Tim Thirion

    • Pingback: shengfei

      • Pingback: Tim Thirion

        • Pingback: shengfei

          • Pingback: Tim Thirion

    • Pingback: shengfei

    • Pingback: shengfei

    • Pingback: shengfei

Questions or comments are always welcome!

X