Skip to content

Instantly share code, notes, and snippets.

@berndhahnebach
Last active April 3, 2019 13:25
Show Gist options
  • Save berndhahnebach/2a26af2cee8367ce2a3ece67490a418e to your computer and use it in GitHub Desktop.
Save berndhahnebach/2a26af2cee8367ce2a3ece67490a418e to your computer and use it in GitHub Desktop.
compile XC (https://github.com/xcfem) on Ubuntu Bionic Beaver (18.04)
#!/bin/bash
# Released under GPL v2.0
# [email protected]
# tested on Ubuntu Bionic = 18.04
# username on my vagrant box = ubuntu
# cd ~ # use if start on a local machine or inside a virtual machine
cd /home/ubuntu # use with a vagrant box, because cd ~ returns /root
cd Documents
sudo rm -rf build_xc
mkdir build_xc
cd build_xc
base_dir=`pwd`
##########################################################
# update system
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get autoremove -y
##########################################################
# install packages apt-get
packages_build="\
git \
cmake \
g++ \
gfortran \
libboost-all-dev"
sudo apt-get install -y $packages_build
packages_lib="\
libarpack2-dev \
libarpack++2-dev \
libcgal-dev \
libdb-dev \
libf2c2-dev \
libglib2.0-dev \
libgmp3-dev \
libgtk2.0-dev \
libgtkgl2.0-dev \
libgtkglextmm-x11-1.2-dev \
libgtkmm-2.4-dev \
libgts-bin \
libgts-dev \
liblapack-dev \
libmpfr-dev \
libmysql++-dev \
libplot-dev \
libsqlite3-dev \
libsuperlu-dev \
libsuitesparse-dev \
libvtk6-dev \
libx11-dev \
libmetis-dev"
sudo apt-get install -y $packages_lib
packages_dev="\
cimg-dev \
petsc-dev \
tcl-dev"
sudo apt-get install -y $packages_dev
packages_python="\
python-vtk6 \
python-scipy \
python-sympy \
python-matplotlib \
python-pandas \
python-sklearn \
python-pip"
sudo apt-get install -y $packages_python
packages_div="\
gnuplot \
bc"
# bc is needed by xc_utils verification tests
sudo apt-get install -y $packages_div
# install nonfree packages (ubuntu does not know nonfree, means we gone just install)
packages_nonfree="\
libparmetis-dev"
sudo apt-get install -y $packages_nonfree
##########################################################
# install packages pip (pip has to be installed, see Python packages)
sudo -H pip install mayavi
##########################################################
# clean system
sudo apt-get clean
##########################################################
# clone xc_basic, xc_utils, XC
cd $base_dir
git clone https://github.com/xcfem/xc_basic/ xc_basic
git clone https://github.com/xcfem/xc_utils/ xc_utils
git clone https://github.com/xcfem/xc/ xc
##########################################################
# build xc_basic
cd $base_dir
mkdir build-xc_basic
cd build-xc_basic
cmake ../xc_basic/src
make -j 2
sudo make install
## source needed as include dir for xc_utils, includes are not installed into /usr/local/include
## in xc_utils sqlite will only be found if build of xc_basic will not be removed
## or add find_packages sqlite to xc_utils, see a commit on a branch in my repo of xc_utils
##########################################################
# build xc_utils
cd $base_dir
mkdir build-xc_utils
cd build-xc_utils
cmake ../xc_utils/src
make -j 2
sudo make install
cd $base_dir/xc_utils/python_modules
sudo sh local_install.sh
##########################################################
# build XC
cd $base_dir
mkdir build-xc
cd build-xc
cmake ../xc/src
make -j 2
sudo make install
cd $base_dir/xc/python_modules
sudo sh local_install.sh
##########################################################
# run unit tests
cd $base_dir/xc_utils/verif
sh run_verif.sh
cd $base_dir/xc/verif
sh run_verif.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment