Skip to content

Instantly share code, notes, and snippets.

@mitmul
Created September 13, 2017 08:16
Show Gist options
  • Save mitmul/41e0e8363775d3c14acac3c0dfcd4102 to your computer and use it in GitHub Desktop.
Save mitmul/41e0e8363775d3c14acac3c0dfcd4102 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Install VTK First
if [ ! -d VTK-6.3.0 ]; then
brew uninstall vtk
brew unisntall pcl
brew install cmake
brew install pkg-config
brew install boost
brew install cminpack
brew install eigen
brew install flann
brew install glew
brew install libusb
brew install qhull
brew install openni2
curl -L -O http://www.vtk.org/files/release/6.3/VTK-6.3.0.tar.gz
tar zxvf VTK-6.3.0.tar.gz
rm -rf VTK-6.3.0.tar.gz
echo "VTK-6.3.0 is downloaded."
else
echo "VTK-6.3.0 dir has already existed."
fi
cd VTK-6.3.0
if [ ! -d build ]; then
mkdir build
fi
cd build
if [ ! -d ../install ]; then
cmake \
-DCMAKE_INSTALL_PREFIX=../install \
..
make -j4
make install
echo "VTK 6.3.0 is installed."
else
echo "VTK 6.3.0 has been already installed."
fi
cd ../install
VTK_DIR=${PWD}
export DYLD_LIBRARY_PATH="${PWD}/lib:${DYLD_LIBRARY_PATH}"
export CPATH="${PWD}/include:${CPATH}"
export C_INCLUDE_PATH="${PWD}/include:${C_INCLUDE_PATH}"
export CPLUS_INCLUDE_PATH="${PWD}/include:${CPLUS_INCLUDE_PATH}"
cd ../..
if [ ! -d pcl-pcl-1.7.2 ]; then
curl -L -O https://github.com/PointCloudLibrary/pcl/archive/pcl-1.7.2.tar.gz
tar zxvf pcl-1.7.2.tar.gz
rm -rf pcl-1.7.2.tar.gz
echo "pcl-pcl-1.7.2 is downloaded."
else
echo "pcl-pcl-1.7.2 has already existed."
fi
echo "VTK_DIR: ${VTK_DIR}"
cd pcl-pcl-1.7.2
if [ ! -d build ]; then
mkdir build
fi
cd build
if [ ! -d ../install ]; then
CFLAGS="-I../../VTK-6.3.0/install/include/vtk-6.3" \
cmake \
-DBUILD_examples=OFF \
-DCMAKE_INSTALL_PREFIX=../install \
-DBUILD_OPENNI=OFF \
-DBUILD_visualization=ON \
-DVTK_DIR=../../VTK-6.3.0/install/lib/cmake/vtk-6.3 ..
make -j4
make install
echo "PCL 1.7.2 is installed."
else
echo "PCL 1.7.2 has been already installed."
fi
cd ../install
PCL_DIR=${PWD}
echo 'Add the recommended variables below to your dotfiles'
echo "* On Bash, add them to ~/.bashrc"
echo "* On Zsh, add them to ~/.zshrc instead"
echo "# VTK 6.3"
echo "export DYLD_LIBRARY_PATH=${VTK_DIR}/lib:\${DYLD_LIBRARY_PATH}"
echo "export CPATH=${VTK_DIR}/include:\${CPATH}"
echo "export C_INCLUDE_PATH=${VTK_DIR}/include:\${C_INCLUDE_PATH}"
echo "export CPLUS_INCLUDE_PATH=${VTK_DIR}/include:\${CPLUS_INCLUDE_PATH}"
echo "# PCL 1.7.2"
echo "export DYLD_LIBRARY_PATH=${PCL_DIR}/lib:\${DYLD_LIBRARY_PATH}"
echo "export CPATH=${PCL_DIR}/include:\${CPATH}"
echo "export C_INCLUDE_PATH=${PCL_DIR}/include:\${C_INCLUDE_PATH}"
echo "export CPLUS_INCLUDE_PATH=${PCL_DIR}/include:\${CPLUS_INCLUDE_PATH}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment