lib3mf.sh 778 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. if [ $1 == "release" ]; then
  28. sed -i "s|SHARED|STATIC|g" CMakeLists.txt
  29. fi
  30. cmake . -DCMAKE_INSTALL_PREFIX="$DEPLOYDIR" $CONFIG $OPTIONS
  31. cmake --build . --parallel $JOBS
  32. cmake --install .
  33. popd