VES/XCode Project Setup
The following instructions describe how to setup an Xcode project from scratch using VTK, VES, and kiwi.
1. Add the OpenGLES and QuartzCore frameworks. These can be added in the "Build Phases" section of the target. Expand the "Link Binary with Libraries" section and select + button to add these frameworks.
2. Add the Kiwi/VES/VTK libraries to the project. These can also be added in the "Link Binaries with Libraries" section of Xcode. You can either use the + button and navigate to the libraries, or drag and drop them into the window. These libraries can be located in your VES directory:
- VES/Apps/iOS/CMakeBuild/build/CMakeExternals/Build/ves-ios-device/lib/libkiwi.a
- VES/Apps/iOS/CMakeBuild/build/CMakeExternals/Build/ves-ios-device/lib/libves.a
- VES/Apps/iOS/CMakeBuild/build/CMakeExternals/Build/ves-ios-device/lib/libevesShaders.a
- Additionally, there are a many VTK libraries to add. Add all of the libraries from the following directory.
- VES/Apps/iOS/CMakeBuild/build/CMakeExternals/Build/vtk-ios-device/lib/
3. Add user-defined settings to the "Build Settings" section of Xcode. These are really just variables you can use to store the paths to the build and source directories in your VES installation. This is not completely necessary but it allows you to use relative paths in step 4 and 5 rather than absolute paths (good if you ever move or share your project). To set these user-defined settings, click the "Add Build Setting" then "Add User-Defined Setting". In the left cell, you will type the name of the build setting. On the right, you will put the absolute paths to your VES build and source folders as follows:
- Build Defined Setting:
- Name: ves_build
- Value: <absolute path to VES directory>/VES/Apps/iOS/CMakeBuild/build
- Source Defined Setting:
- Name: ves_source
- Value: <absolute path to VES directory>/VES
4. Add the header search paths which are needed for the libraries. Locate the "Header Search Paths" line in "Build Settings". Here, you can add the following header search paths. Some of these paths should be flagged as recursive paths by selecting the checkbox next to the path.
- $(ves_build)/CMakeExternals/Source/vtk (recursive)
- $(ves_source)/src/kiwi (recursive)
- $(ves_source)/src/ves (recursive)
- $(ves_build)/CMakeExternals/Install/eigen
- $(ves_build)/CMakeExternals/Build/vtk-host/Common (recursive)
- $(ves_build)/CMakeExternals/Build/ves-ios-device/src (recursive)
- $(ves_build)/CMakeExternals/Build/vtk-host/Utilities/KWSys
5. Add the library search paths in the section just below the "Header Search Path" section. You will need to add library search paths for both the simulator and an actual IOS device. They use different libraries in the VES directory since they use different architectures. Remove any library search paths referring to VES/VTK/Kiwi that Xcode automatically inserted when adding your libraries previously. These need removed since they do not account for the two difference architectures.
Expand the Library Search Paths row and you should a "Debug" and "Release" row. Both the Debug and Release rows will be configured the same. Click the + button that appears in these respective rows when highlighting them. On the left, select "Any IOS simulator". Then add the following library search paths:
- $(ves_build)/CMakeExternals/Build/vtk-ios-simulator/lib
- $(ves_build)/CMakeExternals/Build/ves-ios-simulator/lib
- Click the + button again and select "Any IOS". Add the following library search paths for the device:
- $(ves_build)/CMakeExternals/Build/vtk-ios-device/lib
- $(ves_build)/CMakeExternals/Build/ves-ios-device/lib
Add the setting above for both debug and release.
6. Test your setup. The easiest way to test your linking is to build your Xcode project. To test your header search paths, you can #include some arbitrary VTK or VES header files and check for errors. If you receive any errors, check that your paths (including recursive checkboxes) are setup correctly. Also ensure you have added all necessary libraries in steps 1 and 2. Certain warnings associated with linking can be suppressed in Xcode in Build Settings. For the row "Symbols Hidden by Default", select YES.