Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Commit 449df1f

Browse files
authored
ci: add configs for a CMake+Ninja build (#27)
1 parent b6c30c0 commit 449df1f

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

ci/kokoro/docker/build-in-docker-cmake.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ if [[ "${CODE_COVERAGE:-}" == "yes" ]]; then
5858
"-DCMAKE_BUILD_TYPE=Coverage")
5959
fi
6060

61+
if [[ "${USE_NINJA:-}" == "yes" ]]; then
62+
cmake_flags+=( "-GNinja" )
63+
fi
64+
6165
# Avoid unbound variable error with older bash
6266
if [[ "${#cmake_flags[@]}" == 0 ]]; then
6367
cmake "-H${SOURCE_DIR}" "-B${BINARY_DIR}"

ci/kokoro/docker/build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ elif [[ "${BUILD_NAME}" = "clang-3.8" ]]; then
7878
export DISTRO_VERSION=16.04
7979
export CC=clang
8080
export CXX=clang++
81+
elif [[ "${BUILD_NAME}" = "ninja" ]]; then
82+
# Compiling with Ninja can catch bugs that may not be caught using Make.
83+
export USE_NINJA=yes
8184
else
8285
echo "Unknown BUILD_NAME (${BUILD_NAME}). Fix the Kokoro .cfg file."
8386
exit 1
@@ -211,6 +214,10 @@ docker_flags=(
211214
# CMake builds use this flag.
212215
"--env" "CODE_COVERAGE=${CODE_COVERAGE:-}"
213216

217+
# If set to 'yes', use Ninja as the CMake generator. Ninja is more strict
218+
# that Make and can detect errors in your CMake files, it is also faster.
219+
"--env" "USE_NINJA=${USE_NINJA:-}"
220+
214221
# If set, pass -DGOOGLE_CLOUD_CPP_CXX_STANDARD=<value> to CMake.
215222
"--env" "GOOGLE_CLOUD_CPP_CXX_STANDARD=${GOOGLE_CLOUD_CPP_CXX_STANDARD:-}"
216223

ci/kokoro/docker/ninja-presubmit.cfg

Whitespace-only changes.

ci/kokoro/docker/ninja.cfg

Whitespace-only changes.

0 commit comments

Comments
 (0)