Skip to content

Instantly share code, notes, and snippets.

@pollenjp
Last active May 8, 2019 15:22
Show Gist options
  • Save pollenjp/4cda36a5d8de99ae6753774f6e864278 to your computer and use it in GitHub Desktop.
Save pollenjp/4cda36a5d8de99ae6753774f6e864278 to your computer and use it in GitHub Desktop.
#!/bin/bash -eux
# [bash - What's a concise way to check that environment variables are set in a Unix shell script? - Stack Overflow](https://stackoverflow.com/a/307735/9316234)
#PCL_VERSION=1.9.1
: "${PCL_VERSION:?Need to be set. (ex: '$ PCL_VERSION=4.1.0 ./xxx.sh')}"
# 'shared' or 'static'
: "${PCL_LIBS:?Need to be set. 'static' or 'shared' (ex: '$ PCL_LIBS=shared ./xxx.sh')}"
if [ ${PCL_LIBS} == "static" ]; then
PCL_SHARED_LIBS=OFF
elif [ ${PCL_LIBS} == "shared" ]; then
PCL_SHARED_LIBS=ON
else
printf "\e[101m %s \e[0m \n" "Variable OPENCV_LIBS should be 'static' or 'shared'."
exit 1
fi
PCL_DIR=${HOME}/.pcl
CMAKE_INSTALL_PREFIX=${PCL_DIR}/install/PCL-${PCL_VERSION}/${PCL_LIBS}
# dependency
sudo apt-get -y install libflann-dev
cd pcl
git fetch --all
git pull --all
git co ${PCL_VERSION}
mkdir build
cd build
cmake \
-D PCL_SHARED_LIBS=${PCL_SHARED_LIBS} \
-D VTK_BUILD_SHARED_LIBS=OFF \
-D CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
..
# cmake -D CMAKE_INSTALL_PREFIX=~/.pcl/install/PCL-1.9.1 ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment