lib3mf.sh 689 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. # Build lib3mf
  3. set -e
  4. if [ $1 == "release" ]; then
  5. OPTIONS="-DBUILD_SHARED_LIBS:BOOL=OFF"
  6. else
  7. OPTIONS=""
  8. fi
  9. CORES=$(getconf _NPROCESSORS_ONLN)
  10. JOBS=$(($CORES-1))
  11. BASEDIR=$PWD/thirdparty/lib3mf
  12. DEPLOYDIR=$BASEDIR/install
  13. LIB3MF_TAG="v2.1.1"
  14. LIB3MF_REPO="https://github.com/3MFConsortium/lib3mf"
  15. CONFIG="-DLIB3MF_TESTS:BOOL=OFF"
  16. mkdir -p $BASEDIR
  17. if [ -d $DEPLOYDIR ]; then
  18. rm -rf $DEPLOYDIR
  19. fi
  20. mkdir -p $DEPLOYDIR
  21. pushd $BASEDIR
  22. if [ -d "lib3mf" ]; then
  23. rm -rf "lib3mf"
  24. fi
  25. git clone --depth 1 --branch $LIB3MF_TAG $LIB3MF_REPO
  26. pushd lib3mf
  27. cmake . -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR $CONFIG $OPTIONS
  28. cmake --build . --parallel $JOBS
  29. cmake --install .
  30. popd