ci: add configs for a CMake+Ninja build (#27)

This commit is contained in:
Carlos O'Ryan 2019-10-17 14:47:50 -04:00 committed by GitHub
parent b6c30c0eee
commit 449df1fd37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 0 deletions

View file

@ -58,6 +58,10 @@ if [[ "${CODE_COVERAGE:-}" == "yes" ]]; then
"-DCMAKE_BUILD_TYPE=Coverage")
fi
if [[ "${USE_NINJA:-}" == "yes" ]]; then
cmake_flags+=( "-GNinja" )
fi
# Avoid unbound variable error with older bash
if [[ "${#cmake_flags[@]}" == 0 ]]; then
cmake "-H${SOURCE_DIR}" "-B${BINARY_DIR}"

View file

@ -78,6 +78,9 @@ elif [[ "${BUILD_NAME}" = "clang-3.8" ]]; then
export DISTRO_VERSION=16.04
export CC=clang
export CXX=clang++
elif [[ "${BUILD_NAME}" = "ninja" ]]; then
# Compiling with Ninja can catch bugs that may not be caught using Make.
export USE_NINJA=yes
else
echo "Unknown BUILD_NAME (${BUILD_NAME}). Fix the Kokoro .cfg file."
exit 1
@ -211,6 +214,10 @@ docker_flags=(
# CMake builds use this flag.
"--env" "CODE_COVERAGE=${CODE_COVERAGE:-}"
# If set to 'yes', use Ninja as the CMake generator. Ninja is more strict
# that Make and can detect errors in your CMake files, it is also faster.
"--env" "USE_NINJA=${USE_NINJA:-}"
# If set, pass -DGOOGLE_CLOUD_CPP_CXX_STANDARD=<value> to CMake.
"--env" "GOOGLE_CLOUD_CPP_CXX_STANDARD=${GOOGLE_CLOUD_CPP_CXX_STANDARD:-}"

View file

View file