Commit 48752aec authored by Tim Thirion's avatar Tim Thirion

Remove shell script for creating VTK framework; update iOS readme

Change-Id: I19f5a6850ab0bdc659b755d38658606e514ee0bd
parent 7465b7b4
......@@ -525,7 +525,7 @@ configure_file("${VTK_CMAKE_DIR}/CTestCustom.cmake.in"
# For iOS builds, allow user to 'make framework' with a custom destination
if (APPLE_IOS)
set(CMAKE_FRAMEWORK_INSTALL_PREFIX "~/Library/Frameworks"
set(CMAKE_FRAMEWORK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/frameworks"
CACHE PATH "Framework install path")
configure_file(${VTK_CMAKE_DIR}/MakeFramework.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/CMake/MakeFramework.cmake
......
# copy the example to the binary tree where they can be built manually using xcode
#configure a script for making vtk a framework as the iOS examples will use the framework
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/make_vtk_framework.sh.in
${CMAKE_CURRENT_BINARY_DIR}/make_vtk_framework.sh)
if (TRUE)
add_custom_target(iOS-examples-rm ALL
COMMAND ${CMAKE_COMMAND} -E remove_directory
......@@ -20,4 +15,4 @@ else ()
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_CURRENT_SOURCE_DIR}/MaceVTK"
"${CMAKE_CURRENT_BINARY_DIR}/MaceVTK")
endif ()
\ No newline at end of file
endif ()
#!/bin/bash
#------------------------------------------------------------------------------
install=${CMAKE_INSTALL_PREFIX}
if [ ! -d $install ]; then
echo "Install directory not found. This script should be run from the top level build directory that contains CMakeExternals/Install."
exit 1
fi
#------------------------------------------------------------------------------
make_vtk_framework ()
{
libs=`ls $install/lib/libvtk*.a`
headers=$install/${VTK_INSTALL_INCLUDE_DIR}
libname=vtk
framework=$install/frameworks/vtk.framework
mkdir -p $framework
rm -rf $framework/*
mkdir $framework/Headers
cp -r $headers/* $framework/Headers/
libtool -static -o $framework/lib_device $libs
lipo -create $framework/lib_device -output $framework/$libname
rm $framework/lib_device
}
#------------------------------------------------------------------------------
make_vtk_framework
*** Danger Danger Danger ***
The iOS build of VTK is in an alpha state. Please do try it out but understand it is very new.
To build a VTK application for iOS you will need a Mac/Macbook that has Xcode on it and the iOS dev kit. What follows are the basic steps:
The iOS build of VTK is in an alpha state. Please do try it out but understand
it is very new.
* make a directory for the host binaries (e.g. vtkbin) I typically create this next to the VTK source tree
To build a VTK application for iOS you will need a Mac/Macbook that has Xcode on
it and the iOS dev kit. What follows are the basic steps:
* build vtk the normal way into that directory, no cross compiling, nothing fancy, you just need a build of vtk on the host system for a few executables VTK uses as part of its build process.
* make a directory for the iOS binaries to go into (your binary tree). I usually create a directory next to VTK caled vtkiphone for example.
* Make a directory for the host binaries (e.g. vtkbin). I typically create this
* next to the VTK source tree.
* cross compile VTK into theis new directory using CMake and select the Unix Makefiles (or Ninja) generator and select a toolchain when prompted to (or specify it on the cmake command line if you are not using the GUI. This is a second build of VTK, this time cross compiled. The toolchain files are kept in VTK/CMake and are named
* Build VTK the normal way into that directory, no cross compiling, nothing
* fancy, you just need a build of VTK on the host system for a few executables
* VTK uses as part of its build process.
ios.device.toolchain.cmake -- for an ipan or iphone
ios.simulator.toolchain.cmake -- for the simulator that run on the mac
* Make a directory for the iOS binaries to go into (your binary tree). I
* usually create a directory next to VTK caled vtkiphone, for example.
e.g.
* Cross compile VTK into this new directory using CMake. Select the Unix
* Makefiles (or Ninja) generator. Select a toolchain when prompted to (or
* specify it on the CMake command line if you are not using the GUI). This is a
* second build of VTK, this time cross compiled. The toolchain files are kept in
* VTK/CMake and are named
cd vtk-ios-device-bin
ccmake -DCMAKE_TOOLCHAIN_FILE=../VTK/CMake/ios.device.toolchain.cmake -DVTKCompileTools_DIR=../vtk-bin -DBUILD_EXAMPLES=ON -DBUILD_TESTING=OFF ../VTK
ios.device.toolchain.cmake -- for an iPad or iPhone
ios.simulator.toolchain.cmake -- for the simulator that runs on the mac
* Make sure the CMAKE_INSTALL_PREFIX is set to somethign you are OK with installing to. Part of this build process required you do a make install so make sure it is a good place.
So, a full command line example is:
* as part of the Cmake configure process it will ask you to set VTKCompileTools_DIR, set this to the binary tree from your first build, e.g. vtkbin
$ cd vtk-ios-device-bin
$ ccmake
-DCMAKE_TOOLCHAIN_FILE=../VTK/CMake/ios.device.toolchain.cmake
-DVTKCompileTools_DIR=../vtk-bin -DBUILD_EXAMPLES=ON -DBUILD_TESTING=OFF
../VTK
* Build the iphone version of VTK
* Make sure the CMAKE_INSTALL_PREFIX is set to something you are OK with
* installing to. Part of this build process requires you do a make install
* so make sure it is a good place.
* do a make install (or ninja instal) to install VTK on your iphone binary tree. Use either the device or simulator build.
* Similarly, make sure that you have write access to the directory specified
* by CMAKE_FRAMEWORK_INSTALL_PREFIX. By default, this directory is
* /usr/local/frameworks, to which you should have write access. The iOS
* examples expect vtk.framework in this directory, so if you change this
* directory you will have to repair the framework reference in the Xcode
* project.
* DANGER: look at the following shell script before running it to make sure it will not do a rm -r * or anything like that. It should be fine, but there are configured values and it does delete file, so I get nervous.
* As part of the Cmake configure process it will ask you to set
* VTKCompileTools_DIR, set this to the binary tree from your first build, e.g.
* vtkbin
* make a framework out of vtk by running the shell script make_vtk_framework.sh which can be found in your binary tree under Examples/iOS
* Build by running make or ninja.
* load the GLPaint xcode project from your binary tree into XCode
* Run 'make install' (or 'ninja install') to install your just-built VTK.
* Modify the framework search path and header search path to include the location you installed the frameworks. If for example you used /usr/local as the install root then add
* Run 'make framework' (or 'ninja framework') to create vtk.framework from your
* current VTK installation.
Framework search paths : /usr/local/frameworks
Header search paths : /usr/local/frameworks/vtk.framework/Headers
* Choose an example Xcode project in Examples/iOS. If you modified the framework
* install path you will need to repair the framework reference, the framework
* search path and the header search path.
* make sure you have any provisiong certificates, devices setiup properly, Apple requires iOS developers to have apple issued certificates and their devices have to be registered before they can be used to test apps. So do all that stuff. Have fun, it is a bit hellish but there are guides out on the internet. If you are already doing iOS app developent and testing then you shoudl be good.
* If you built VTK to run on the actual device, make sure you have all
* provisioning certificates and devices setup properly. Apple requires iOS
* developers to have Apple-issued certificates and their devices have to be
* registered before development apps may be run on the device.
* build it in xcode and then run it
* Choose the correct target device (i.e., device or simulator) then build and
* run the Xcode project.
* enjoy a delicious mudslide, you earned it
* Enjoy a delicious mudslide, you earned it!
The app is very simple with most of the opengl setup etc being handled by the vtkIOSView class in VTK. The pipeline is setup in the class PaintingView.mm in the usual VTK way. The superclass will authomatically create a renderwindow and interactor for you.
The app is very simple with most of the opengl setup etc being handled by the
vtkIOSView class in VTK. The pipeline is setup in the class PaintingView.mm in
the usual VTK way. The superclass will automatically create a render window and
interactor for you.
The GLPaint example is a modified version of Apple's GLPaint example. So credit to them for the original example file and framework.
The GLPaint example is a modified version of Apple's GLPaint example. So credit
to them for the original example file and framework.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment