refactor(build.sh): Add gcc over clang option(#1249)

There was no way to build with gcc when clang was installed using build.sh
This commit is contained in:
Doron Behar 2018-05-20 11:30:33 +03:00 committed by Patrick Ziegler
parent 3c0732ac2a
commit da9372fb70

View File

@ -38,9 +38,11 @@ function main
msg "Setting build options" msg "Setting build options"
read -r -p "$(msg "Use GCC even if Clang is installed -------------------------------- [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && try_to_use_clang="ON"
read -r -p "$(msg "Include support for \"internal/i3\" (requires i3) ------------------- [y/N]: ")" -n 1 p && echo read -r -p "$(msg "Include support for \"internal/i3\" (requires i3) ------------------- [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && enable_i3="OFF" [[ "${p^^}" != "Y" ]] && enable_i3="OFF"
read -r -p "$(msg "Include support for \"internal/alsa\" (requires alsalib) ---------- [y/N]: ")" -n 1 p && echo read -r -p "$(msg "Include support for \"internal/alsa\" (requires alsalib) ------------ [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && enable_alsa="OFF" [[ "${p^^}" != "Y" ]] && enable_alsa="OFF"
read -r -p "$(msg "Include support for \"internal/pulseaudio\" (requires libpulse) ----- [y/N]: ")" -n 1 p && echo read -r -p "$(msg "Include support for \"internal/pulseaudio\" (requires libpulse) ----- [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && enable_pulseaudio="OFF" [[ "${p^^}" != "Y" ]] && enable_pulseaudio="OFF"
@ -56,14 +58,19 @@ function main
local cxx="c++" local cxx="c++"
local cc="cc" local cc="cc"
if command -v clang++ >/dev/null; then if [[ "${try_to_use_clang}" == "ON" ]]; then
msg "Using compiler: clang++/clang" if command -v clang++ >/dev/null; then
cxx="clang++" msg "Using compiler: clang++/clang"
cc="clang" cxx="clang++"
elif command -v g++ >/dev/null; then cc="clang"
msg "Using compiler: g++/gcc" elif command -v g++ >/dev/null; then
cxx="g++" msg "Using compiler: g++/gcc"
cc="gcc" cxx="g++"
cc="gcc"
fi
else
cxx="g++"
cc="gcc"
fi fi
msg "Executing cmake command" msg "Executing cmake command"