Add nproc option to configure.sh

Former-commit-id: 929fa5be4e
pull/1161/head
Dakota Benjamin 2017-09-22 13:51:12 -04:00
rodzic 63a1e890e7
commit 045ace6f3e
1 zmienionych plików z 10 dodań i 3 usunięć

Wyświetl plik

@ -6,6 +6,12 @@ install() {
export PYTHONPATH=$RUNPATH/SuperBuild/install/lib/python2.7/dist-packages:$RUNPATH/SuperBuild/src/opensfm:$PYTHONPATH export PYTHONPATH=$RUNPATH/SuperBuild/install/lib/python2.7/dist-packages:$RUNPATH/SuperBuild/src/opensfm:$PYTHONPATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RUNPATH/SuperBuild/install/lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RUNPATH/SuperBuild/install/lib
if [[ $2 =~ ^[0-9]+$ ]] ; then
processes=$2
else
processes=$(nproc)
fi
## Before installing ## Before installing
echo "Updating the system" echo "Updating the system"
sudo apt-get update sudo apt-get update
@ -97,12 +103,12 @@ install() {
echo "Compiling SuperBuild" echo "Compiling SuperBuild"
cd ${RUNPATH}/SuperBuild cd ${RUNPATH}/SuperBuild
mkdir -p build && cd build mkdir -p build && cd build
cmake .. && make -j$(nproc) cmake .. && make -j$processes
echo "Compiling build" echo "Compiling build"
cd ${RUNPATH} cd ${RUNPATH}
mkdir -p build && cd build mkdir -p build && cd build
cmake .. && make -j$(nproc) cmake .. && make -j$processes
echo "Configuration Finished" echo "Configuration Finished"
} }
@ -123,7 +129,7 @@ reinstall() {
usage() { usage() {
echo "Usage:" echo "Usage:"
echo "bash configure.sh <install|update|uninstall|help>" echo "bash configure.sh <install|update|uninstall|help> [nproc]"
echo "Subcommands:" echo "Subcommands:"
echo " install" echo " install"
echo " Installs all dependencies and modules for running OpenDroneMap" echo " Installs all dependencies and modules for running OpenDroneMap"
@ -133,6 +139,7 @@ usage() {
echo " Removes SuperBuild and build modules. Does not uninstall dependencies" echo " Removes SuperBuild and build modules. Does not uninstall dependencies"
echo " help" echo " help"
echo " Displays this message" echo " Displays this message"
echo "[nproc] is an optional argument that can set the number of processes for the make -j tag. By default it uses $(nproc)"
} }
if [[ $1 =~ ^(install|reinstall|uninstall|usage)$ ]]; then if [[ $1 =~ ^(install|reinstall|uninstall|usage)$ ]]; then