Skip to content

Commit

Permalink
Change setup to use safer cd
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesYang007 committed Jun 3, 2020
1 parent 612c647 commit f2b893a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions clean-build.sh
Expand Up @@ -16,10 +16,10 @@ mkdir -p release

# if debug mode
if [ "$mode" = "debug" ]; then
cd debug
cd "debug"
# if release mode
elif [ "$mode" = "release" ]; then
cd release
cd "release"
else
echo "usage: $0 <debug/release> [cmake options]" 1>&2
exit 1
Expand Down
18 changes: 9 additions & 9 deletions setup.sh
Expand Up @@ -8,45 +8,45 @@ fastadpath="lib/FastAD"
# setup google benchmark
if [ ! -d "$gbenchpath" ]; then
git clone https://github.com/google/benchmark.git $gbenchpath
cd $gbenchpath 2>&1 /dev/null
cd "$gbenchpath" 2>&1 /dev/null
git checkout -q v1.5.0
cd ~- # change back to previous dir and no output to terminal
fi

# setup googletest
if [ ! -d "$gtestpath" ]; then
git clone https://github.com/google/googletest.git $gtestpath
cd $gtestpath 2>&1 /dev/null
cd "$gtestpath" 2>&1 /dev/null
git checkout -q release-1.10.0
cd ~- # change back to previous dir and no output to terminal
fi

# setup Armadillo
if [ ! -d "$armapath" ]; then
if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "darwin"* ]]; then
cd lib 2>&1 /dev/null
cd "lib" 2>&1 /dev/null
if [[ "$OSTYPE" == "linux-gnu" ]]; then
sudo apt install libopenblas-dev liblapack-dev
fi
wget http://sourceforge.net/projects/arma/files/armadillo-9.870.2.tar.xz
tar -xvf armadillo-9.870.2.tar.xz
cd armadillo-9.870.2
cd "armadillo-9.870.2"
cmake . -DCMAKE_INSTALL_PREFIX="../armadillo"
make
make install
cd ../../ 2>&1 /dev/null
cd "../../" 2>&1 /dev/null
fi
fi

# setup FastAD
if [ ! -d "$fastadpath" ]; then
git clone https://github.com/JamesYang007/FastAD.git $fastadpath
cd $fastadpath
cd "$fastadpath"
./setup.sh
./clean-build.sh release -DFASTAD_ENABLE_TEST=OFF \
-DCMAKE_INSTALL_PREFIX=".." # installs into build
cd build/release
cd "build/release"
ninja install
cd ../../ # in lib/FastAD
cd ../../ # in working directory
cd "../../" # in lib/FastAD
cd "../../" # in working directory
fi

0 comments on commit f2b893a

Please sign in to comment.