From 49a596c2e97350217bbfadd21d3e23787808278d Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Thu, 20 Jun 2019 15:03:30 -0400 Subject: [PATCH] set clang to default compiler on ubuntu,amz2,macos also bump the minimum version of clang the script looks for to 6.0 (cmake check is left at 5.0 for now still, still that still technically compiles eosio okay) --- scripts/helpers/eosio.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/helpers/eosio.sh b/scripts/helpers/eosio.sh index 98a676ab452..077a4675230 100755 --- a/scripts/helpers/eosio.sh +++ b/scripts/helpers/eosio.sh @@ -121,8 +121,14 @@ function prompt-mongo-install() { } function ensure-compiler() { - export CXX=${CXX:-c++} - export CC=${CC:-cc} + DEFAULT_CXX=clang++ + DEFAULT_CC=clang + if [[ $NAME == "CentOS Linux" ]]; then + DEFAULT_CXX=g++ + DEFAULT_CC=gcc + fi + export CXX=${CXX:-$DEFAULT_CXX} + export CC=${CC:-$DEFAULT_CC} if $PIN_COMPILER || [[ -f $CLANG_ROOT/bin/clang++ ]]; then export PIN_COMPILER=true export BUILD_CLANG=true @@ -141,9 +147,9 @@ function ensure-compiler() { [[ $( $(which $CXX) --version | cut -d ' ' -f 4 | cut -d '.' -f 1 | head -n 1 ) -lt 10 ]] && export NO_CPP17=true else if [[ $( $(which $CXX) --version | cut -d ' ' -f 3 | head -n 1 | cut -d '.' -f1) =~ ^[0-9]+$ ]]; then # Check if the version message cut returns an integer - [[ $( $(which $CXX) --version | cut -d ' ' -f 3 | head -n 1 | cut -d '.' -f1) < 5 ]] && export NO_CPP17=true + [[ $( $(which $CXX) --version | cut -d ' ' -f 3 | head -n 1 | cut -d '.' -f1) < 6 ]] && export NO_CPP17=true elif [[ $(clang --version | cut -d ' ' -f 4 | head -n 1 | cut -d '.' -f1) =~ ^[0-9]+$ ]]; then # Check if the version message cut returns an integer - [[ $( $(which $CXX) --version | cut -d ' ' -f 4 | cut -d '.' -f 1 | head -n 1 ) < 5 ]] && export NO_CPP17=true + [[ $( $(which $CXX) --version | cut -d ' ' -f 4 | cut -d '.' -f 1 | head -n 1 ) < 6 ]] && export NO_CPP17=true fi fi else