ci: add Clang package

Use flags to tell Waf what compiler to use
Don't use Make build system if compiler is Clang
This commit is contained in:
Francisco Ferreira 2016-03-09 00:52:33 +00:00 committed by Lucas De Marchi
parent 72b246e52c
commit 34de26502d
2 changed files with 25 additions and 16 deletions

View File

@ -8,6 +8,8 @@ set -ex
. ~/.profile . ~/.profile
# CXX and CC are exported by default by travis # CXX and CC are exported by default by travis
c_compiler=${CC:-gcc}
cxx_compiler=${CXX:-g++}
unset CXX CC unset CXX CC
export BUILDROOT=/tmp/travis.build.$$ export BUILDROOT=/tmp/travis.build.$$
@ -61,26 +63,29 @@ for board in $($waf list_boards | head -n1); do waf_supported_boards[$board]=1;
echo "Targets: $CI_BUILD_TARGET" echo "Targets: $CI_BUILD_TARGET"
for t in $CI_BUILD_TARGET; do for t in $CI_BUILD_TARGET; do
echo "Starting make based build for target ${t}..." # skip make-based build for clang
for v in ${!build_platforms[@]}; do if [[ "$cxx_compiler" != "clang++" ]]; then
if [[ ${build_platforms[$v]} != *$t* ]]; then echo "Starting make based build for target ${t}..."
continue for v in ${!build_platforms[@]}; do
fi if [[ ${build_platforms[$v]} != *$t* ]]; then
echo "Building $v for ${t}..." continue
fi
echo "Building $v for ${t}..."
pushd $v pushd $v
make clean make clean
if [ ${build_extra_clean[$t]+_} ]; then if [ ${build_extra_clean[$t]+_} ]; then
${build_extra_clean[$t]} ${build_extra_clean[$t]}
fi fi
make $t ${build_concurrency[$t]} make $t ${build_concurrency[$t]}
popd popd
done done
fi
if [[ -n ${waf_supported_boards[$t]} ]]; then if [[ -n ${waf_supported_boards[$t]} ]]; then
echo "Starting waf build for board ${t}..." echo "Starting waf build for board ${t}..."
$waf configure --board $t --enable-benchmarks $waf configure --board $t --enable-benchmarks --check-c-compiler="$c_compiler" --check-cxx-compiler="$cxx_compiler"
$waf clean $waf clean
$waf ${build_concurrency[$t]} all $waf ${build_concurrency[$t]} all
if [[ $t == linux ]]; then if [[ $t == linux ]]; then

View File

@ -4,7 +4,7 @@
set -ex set -ex
PKGS="build-essential gawk ccache genromfs libc6-i386 \ PKGS="build-essential gawk ccache genromfs libc6-i386 \
python-argparse python-empy python-serial python-pexpect python-dev python-pip zlib1g-dev gcc-4.9 g++-4.9 cmake cmake-data" python-argparse python-empy python-serial python-pexpect python-dev python-pip zlib1g-dev gcc-4.9 g++-4.9 cmake cmake-data clang-3.7"
ARM_ROOT="gcc-arm-none-eabi-4_9-2015q3" ARM_ROOT="gcc-arm-none-eabi-4_9-2015q3"
ARM_TARBALL="$ARM_ROOT-20150921-linux.tar.bz2" ARM_TARBALL="$ARM_ROOT-20150921-linux.tar.bz2"
@ -22,8 +22,12 @@ elif [ "$UBUNTU_CODENAME" = "trusty" ]; then
sudo add-apt-repository ppa:george-edison55/cmake-3.x -y sudo add-apt-repository ppa:george-edison55/cmake-3.x -y
fi fi
wget -q -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://llvm.org/apt/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-3.7 main" -y
sudo apt-get -qq -y update sudo apt-get -qq -y update
sudo apt-get -y install $PKGS sudo apt-get -y install $PKGS
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.7 37 \
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-3.7
sudo pip install mavproxy sudo pip install mavproxy
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 90 \ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 90 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.9 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9