1#!/bin/bash 2# 3# Copyright 2019 The Abseil Authors. 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# https://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17set -euox pipefail 18 19if [[ -z ${ABSEIL_ROOT:-} ]]; then 20 ABSEIL_ROOT="$(realpath $(dirname ${0})/..)" 21fi 22 23source "${ABSEIL_ROOT}/ci/cmake_common.sh" 24 25if [[ -z ${ABSL_CMAKE_CXX_STANDARDS:-} ]]; then 26 ABSL_CMAKE_CXX_STANDARDS="11 14 17 20" 27fi 28 29if [[ -z ${ABSL_CMAKE_BUILD_TYPES:-} ]]; then 30 ABSL_CMAKE_BUILD_TYPES="Debug Release" 31fi 32 33if [[ -z ${ABSL_CMAKE_BUILD_SHARED:-} ]]; then 34 ABSL_CMAKE_BUILD_SHARED="OFF ON" 35fi 36 37source "${ABSEIL_ROOT}/ci/linux_docker_containers.sh" 38readonly DOCKER_CONTAINER=${LINUX_GCC_LATEST_CONTAINER} 39 40for std in ${ABSL_CMAKE_CXX_STANDARDS}; do 41 for compilation_mode in ${ABSL_CMAKE_BUILD_TYPES}; do 42 for build_shared in ${ABSL_CMAKE_BUILD_SHARED}; do 43 time docker run \ 44 --mount type=bind,source="${ABSEIL_ROOT}",target=/abseil-cpp,readonly \ 45 --tmpfs=/buildfs:exec \ 46 --workdir=/buildfs \ 47 --cap-add=SYS_PTRACE \ 48 --rm \ 49 -e CFLAGS="-Werror" \ 50 -e CXXFLAGS="-Werror" \ 51 ${DOCKER_EXTRA_ARGS:-} \ 52 "${DOCKER_CONTAINER}" \ 53 /bin/bash -c " 54 cmake /abseil-cpp \ 55 -DABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL} \ 56 -DBUILD_SHARED_LIBS=${build_shared} \ 57 -DBUILD_TESTING=ON \ 58 -DCMAKE_BUILD_TYPE=${compilation_mode} \ 59 -DCMAKE_CXX_STANDARD=${std} \ 60 -DCMAKE_MODULE_LINKER_FLAGS=\"-Wl,--no-undefined\" && \ 61 make -j$(nproc) && \ 62 ctest -j$(nproc) --output-on-failure" 63 done 64 done 65done 66