openscenegraph.sh 977 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. # Build OpenSceneGraph
  3. set -e
  4. if [ $1 == "release" ]; then
  5. BASEDIR=$PWD/thirdparty/openscenegraph-static
  6. OPTIONS="-DDYNAMIC_OPENSCENEGRAPH:BOOL=OFF -DDYNAMIC_OPENTHREADS:BOOL=OFF -DOSG_GL_LIBRARY_STATIC:BOOL=ON"
  7. else
  8. BASEDIR=$PWD/thirdparty/openscenegraph
  9. OPTIONS=""
  10. fi
  11. CORES=$(getconf _NPROCESSORS_ONLN)
  12. JOBS=$(($CORES-1))
  13. DEPLOYDIR=$BASEDIR/install
  14. OPENSCENEGRAPH_TAG="OpenSceneGraph-3.6.5"
  15. OPENSCENEGRAPH_REPO="https://github.com/openscenegraph/OpenSceneGraph"
  16. CONFIG="-DBUILD_OSG_EXAMPLES:BOOL=OFF -DBUILD_OSG_APPLICATIONS:BOOL=OFF -DOSG_TEXT_USE_FONTCONFIG:BOOL=OFF"
  17. mkdir -p $BASEDIR
  18. if [ -d $DEPLOYDIR ]; then
  19. rm -rf $DEPLOYDIR
  20. fi
  21. mkdir -p $DEPLOYDIR
  22. pushd $BASEDIR
  23. if [ -d "OpenSceneGraph" ]; then
  24. rm -rf "OpenSceneGraph"
  25. fi
  26. git clone --depth 1 --branch $OPENSCENEGRAPH_TAG $OPENSCENEGRAPH_REPO
  27. pushd OpenSceneGraph
  28. cmake . -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR $CONFIG $OPTIONS
  29. cmake --build . --parallel $JOBS
  30. cmake --install .
  31. popd