Cleanup Code,

add missing directory changes
This commit is contained in:
Johannes Theiner 2019-10-28 10:19:48 +00:00
parent 836a1532cc
commit 777dea9073
3 changed files with 21 additions and 43 deletions

View File

@ -12,5 +12,5 @@ for d in */; do
cd ..
done
cd
cd installation
./build.sh

View File

@ -1,58 +1,36 @@
#!/bin/bash
debian=false;
arch=false;
mac=false;
# get operating system
os_info() {
install_packages() {
declare -A osInfo;
osInfo[/etc/arch-release]=arch
osInfo[/etc/debian_version]=debian
osInfo[/usr/local/Homebrew]=mac
osInfo[/usr/bin/pacman]=pacman
osInfo[/usr/bin/apt]=apt
osInfo[/usr/local/Homebrew]=brew
for f in ${!osInfo[@]}
do
if [[ -f $f ]];then
if [[ ${osInfo[$f]} == 'arch' ]]; then
arch=true;
elif [[ ${osInfo[$f]} == 'debian' ]]; then
debian=true;
elif [[ ${osInfo[$f]} == 'mac' ]]; then
mac=true;
if [[ ${osInfo[$f]} == 'pacman' ]]; then
pacman -S clang make cmake fltk catch2
elif [[ ${osInfo[$f]} == 'apt' ]]; then
apt install clang make cmake clang-tidy libfltk1.3 libfltk1.3-dev
git clone https://github.com/catchorg/Catch2.git
cd Catch2
cmake -Bbuild -H. -DBUILD_TESTING=OFF
sudo cmake --build build/ --target install
elif [[ ${osInfo[$f]} == 'brew' ]]; then
brew install llvm clang make cmake clang-format fltk catch2
fi
fi
done
}
# installing package, $1 = pacman; $2 = apt-get, $3 = homebrew
install() {
if [ $debian == true ] && [ $2 != 'null' ]; then
sudo apt-get install $2
elif [ $arch == true ] && [ $1 != 'null' ]; then
sudo pacman -S $1
elif [ $mac == true ] && [ $3 != 'null' ]; then
sudo brew install $3
fi
}
os_info
install 'clang' 'clang' 'clang'
install 'make' 'make' 'make'
install 'cmake' 'cmake' 'cmake'
install 'null' 'clang-tidy' 'clang-tidy'
install 'fltk' 'libfltk1.3 libfltk1.3-dev' 'fltk'
install 'catch2' 'null' 'catch2'
if [[ $apt ]]; then
git clone https://github.com/catchorg/Catch2.git
cd Catch2
cmake -Bbuild -H. -DBUILD_TESTING=OFF
sudo cmake --build build/ --target install
fi
install_packages
echo "cloning repositories"
cd ..

View File

@ -15,5 +15,5 @@ for d in */; do
cd ..
done
cd
cd installation
./build.sh