Generating an iOS XCode Project 2017

This is an updated simplified guide to build OpenSceneGraph for iOS. The version tested against was osg 3.5.6

What you'll need


Setup project folder

Create a folder on your machine where you'll download the third party dependancies for OSG and the OSG source code we want to build. In this example we create


Download the third party dependancies from the below link and extract into your project folder


Get OSG Source

Clone the osg source into our project folder

cd /Users/thomashogarth/osg-ios
git clone osg 


Run CMake

Our project folder should now look like this


Now open a terminal window, cd to your osg folder and run the following command being sure to change the THIRD_PARTY export to point to your 3rdParty folder and change the IPHONE_SDKVER to the iOS sdk version you have installed.

export THIRDPARTY_PATH=/Users/thomashogarth/osg-ios/3rdParty
-DCURL_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/curl-ios-device/include" \
-DCURL_LIBRARY:PATH="$THIRDPARTY_PATH/curl-ios-device/lib/libcurl.a" \
-DFREETYPE_INCLUDE_DIR_freetype2:PATH="$THIRDPARTY_PATH/freetype-ios-universal/include/freetype" \
-DFREETYPE_INCLUDE_DIR_ft2build:PATH="$THIRDPARTY_PATH/freetype-ios-universal/include" \
-DFREETYPE_LIBRARY:PATH="$THIRDPARTY_PATH/freetype-ios-universal/lib/libFreeType_iphone_universal.a" \
-DTIFF_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/tiff-ios-device/include" \
-DTIFF_LIBRARY:PATH="$THIRDPARTY_PATH/tiff-ios-device/lib/libtiff.a" \
-DGDAL_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/gdal-ios-device/include" \

Open the generated Xcode project, select the example_osgViewerIPhone target. In 'General' tab set a development team. In the 'Build Settings' tab search for 'Other Linker Flags', then for each target type (debug, release etc) that you want to use open the list of arguments and delete the 'OpenGL' line and the '-framework' line above it. This is because cmake has tried to add the desktop OpenGL library which we don't want.

Once this is done you should be able to build and deploy the example_osgViewerIPhone target on your device.