Skip to content

Commit 6637725

Browse files
remyabelcoryan
authored andcommitted
feat: Add Ninja build. (#2931)
1 parent 3cd542f commit 6637725

5 files changed

Lines changed: 11 additions & 0 deletions

File tree

ci/kokoro/docker/Dockerfile.ubuntu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ RUN apt update && \
3636
libtool \
3737
lsb-release \
3838
make \
39+
ninja-build \
3940
pkg-config \
4041
python-pip \
4142
shellcheck \

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ if [[ "${USE_LIBCXX:-}" == "yes" ]]; then
6868
cmake_extra_flags+=( "-DGOOGLE_CLOUD_CPP_USE_LIBCXX=ON" )
6969
fi
7070

71+
if [[ "${USE_NINJA:-}" == "yes" ]]; then
72+
cmake_extra_flags+=( "-GNinja" )
73+
fi
74+
7175
# We use parameter expansion for ${cmake_extra_flags} because set -u doesn't
7276
# like empty arrays on older versions of Bash (which some of our builds use).
7377
# The expression ${parameter+word} will expand word only if parameter is not

ci/kokoro/docker/build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ elif [[ "${BUILD_NAME}" = "cmake-super" ]]; then
7474
# what spanner does where RUN_INTEGRATION_TESTS is explicitly set to yes.
7575
export RUN_INTEGRATION_TESTS="no"
7676
in_docker_script="ci/kokoro/docker/build-in-docker-cmake.sh"
77+
elif [[ "${BUILD_NAME}" = "ninja" ]]; then
78+
# Compiling with Ninja can catch bugs that may not be caught using Make.
79+
export USE_NINJA=yes
7780
elif [[ "${BUILD_NAME}" = "gcc-9" ]]; then
7881
# Compile under fedora:30. This distro uses gcc-9.
7982
export DISTRO=fedora
@@ -221,6 +224,9 @@ docker_flags=(
221224
# If set, enable using libc++ with CMake.
222225
"--env" "USE_LIBCXX=${USE_LIBCXX:-}"
223226

227+
# If set, enable the Ninja generator with CMake.
228+
"--env" "USE_NINJA=${USE_NINJA:-}"
229+
224230
# If set, use Clang's static analyzer. Currently there is no build that
225231
# uses this feature, it may have rotten.
226232
"--env" "SCAN_BUILD=${SCAN_BUILD:-}"

ci/kokoro/docker/ninja-presubmit.cfg

Whitespace-only changes.

ci/kokoro/docker/ninja.cfg

Whitespace-only changes.

0 commit comments

Comments
 (0)