Code snippets‎ > ‎Scripting‎ > ‎

building OpenSceneGraph

#!/bin/bash

function build_osg {
  [ ! -d ${BUILD_DIR} ] && mkdir ${BUILD_DIR}
  cd ${BUILD_DIR} || exit 1
  #rm -rf *
  cmake \
    -DCMAKE_OSX_ARCHITECTURES=x86_64 \
    -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
    -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
    -DBUILD_OSG_EXAMPLES=ON \
    ${SOURCE_DIR}
  make -j${NUM_CORES} || exit 1
  make install || exit 1
  cd ..
}

clear

SOURCE_DIR=`pwd`/OpenSceneGraph-3.0.1
[ ! -d ${SOURCE_DIR} ] && echo "Coudn't find OSG source" && exit 1

INSTALL_DIR=${SOURCE_DIR}_install
NUM_CORES=$(cat /proc/cpuinfo | grep processor | wc -l)


BUILD_DIR=${SOURCE_DIR}_build_release
BUILD_TYPE=Release
build_osg

BUILD_DIR=${SOURCE_DIR}_build_debug
BUILD_TYPE=Debug
build_osg

Settings on OS X:
OSG_WINDOWING_SYSTEM to "Cocoa"
OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX to "imageio"
CMAKE_OSX_SYSROOT = /Developer/SDKs/MacOSX10.6.sdk
Comments