User Tools

Site Tools


openvsp_build_script

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

openvsp_build_script [2019/11/11 11:37] (current)
cibin Add build-script for Ubuntu
Line 1: Line 1:
 +====== OpenVSP Build Script for Ubuntu ======
  
 +The following bash script downloads and builds OpenVSP on Debian based systems.
 +
 +You may copy the script to an editor and name it //​openvsp-build.sh//​. The script may then be executed with the command:
 +
 +''​bash openvsp-build.sh''​.
 + 
 +<​file>​
 +#!/bin/bash
 +#
 +# This script builds OpenVSP on a Debian-based system
 +# It provides the user with options to create a zip or deb package
 +#
 +# Usage: bash openvsp-build.sh
 +
 +set -e
 +
 +# Get variables
 +OpenVSPdir=$(pwd)/​OpenVSP
 +NumOfThreads=$(nproc)
 +echo "Do you want to create a:"
 +echo "[1] Zip folder or"
 +echo "[2] Deb package"​
 +read -p "​Choice [1/2] : " -n 1 pkgChoice
 +pkgChoice=${pkgChoice:​-1}
 +echo
 +
 +# Install packages using apt
 +echo
 +echo "​Installing required packages using apt ..."
 +sudo apt-get install python3-dev git git-gui cmake libxml2-dev \
 +  libfltk1.3-dev g++ libjpeg-dev libglm-dev libcminpack-dev \
 +  libglew-dev swig doxygen graphviz texlive-latex-base
 +
 +# Create temporary directories for build
 +echo
 +echo "​Creating temporary directories ..."
 +mkdir -p OpenVSP
 +mkdir -p $OpenVSPdir/​build $OpenVSPdir/​buildlibs $OpenVSPdir/​repo
 +git clone --depth=1 https://​github.com/​OpenVSP/​OpenVSP.git $OpenVSPdir/​repo
 +
 +# Build libraries
 +echo
 +echo "​Building libraries ..."
 +cd $OpenVSPdir/​buildlibs && ​
 +  cmake \
 +  -DVSP_USE_SYSTEM_LIBXML2=true \
 +  -DVSP_USE_SYSTEM_FLTK=true \
 +  -DVSP_USE_SYSTEM_GLM=true \
 +  -DVSP_USE_SYSTEM_GLEW=true \
 +  -DVSP_USE_SYSTEM_CMINPACK=true \
 +  -DVSP_USE_SYSTEM_LIBIGES=false \
 +  -DVSP_USE_SYSTEM_EIGEN=false \
 +  -DVSP_USE_SYSTEM_CODEELI=false \
 +  -DVSP_USE_SYSTEM_CPPTEST=false \
 +  $OpenVSPdir/​repo/​Libraries -DCMAKE_BUILD_TYPE=Release &&
 +  make -j $NumOfThreads
 +
 +# Build source
 +echo
 +echo "​Building source ..."
 +case $pkgChoice in 
 +  1)  # ZIP
 +    cd $OpenVSPdir/​build &&
 +      cmake ../​repo/​src/​ \
 +      -DVSP_LIBRARY_PATH=$OpenVSPdir/​buildlibs \
 +      -DCMAKE_BUILD_TYPE=Release &&
 +      make -j $NumOfThreads package &&
 +      cp *.zip $OpenVSPdir/​
 +    ;;
 +  2)  # DEB
 +    cd $OpenVSPdir/​build &&
 +      cmake ../​repo/​src/​ \
 +      -DVSP_LIBRARY_PATH=$OpenVSPdir/​buildlibs \
 +      -DCMAKE_BUILD_TYPE=Release \
 +      -DVSP_CPACK_GEN=DEB &&
 +      make -j $NumOfThreads package &&
 +      cp *.deb $OpenVSPdir/​
 +    ;;
 +  *)  # Wrong choice
 +    echo "​ERROR:​ Wrong package choice"​
 +    exit 1
 +    ;;
 +esac
 +
 +# Remove unnecessary temporary directories
 +echo
 +echo "​Removing temporary directories ..."
 +rm -rf $OpenVSPdir/​build* $OpenVSPdir/​repo
 +
 +echo 
 +echo "​OpenVSP build successfull!"​
 +</​file>​
openvsp_build_script.txt ยท Last modified: 2019/11/11 11:37 by cibin