Abseil Team | 74d9175 | 2019-07-03 12:13:04 -0700 | [diff] [blame] | 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 | |
Abseil Team | 74d9175 | 2019-07-03 12:13:04 -0700 | [diff] [blame] | 17 | set -euox pipefail |
| 18 | |
Abseil Team | d43b799 | 2020-04-03 13:24:29 -0700 | [diff] [blame] | 19 | if [[ -z ${ABSEIL_ROOT:-} ]]; then |
Abseil Team | 74d9175 | 2019-07-03 12:13:04 -0700 | [diff] [blame] | 20 | ABSEIL_ROOT="$(realpath $(dirname ${0})/..)" |
| 21 | fi |
| 22 | |
Abseil Team | eb317a7 | 2020-10-21 00:01:29 -0700 | [diff] [blame] | 23 | source "${ABSEIL_ROOT}/ci/cmake_common.sh" |
| 24 | |
Abseil Team | d43b799 | 2020-04-03 13:24:29 -0700 | [diff] [blame] | 25 | if [[ -z ${ABSL_CMAKE_CXX_STANDARDS:-} ]]; then |
Derek Mauro | 4bbdb02 | 2022-07-05 09:37:54 -0700 | [diff] [blame] | 26 | ABSL_CMAKE_CXX_STANDARDS="14 17 20" |
Abseil Team | 74d9175 | 2019-07-03 12:13:04 -0700 | [diff] [blame] | 27 | fi |
| 28 | |
Abseil Team | d43b799 | 2020-04-03 13:24:29 -0700 | [diff] [blame] | 29 | if [[ -z ${ABSL_CMAKE_BUILD_TYPES:-} ]]; then |
Abseil Team | 74d9175 | 2019-07-03 12:13:04 -0700 | [diff] [blame] | 30 | ABSL_CMAKE_BUILD_TYPES="Debug Release" |
| 31 | fi |
| 32 | |
Abseil Team | 8f1c34a | 2020-10-16 18:59:21 -0700 | [diff] [blame] | 33 | if [[ -z ${ABSL_CMAKE_BUILD_SHARED:-} ]]; then |
| 34 | ABSL_CMAKE_BUILD_SHARED="OFF ON" |
| 35 | fi |
| 36 | |
Abseil Team | 092ed97 | 2020-03-20 09:47:42 -0700 | [diff] [blame] | 37 | source "${ABSEIL_ROOT}/ci/linux_docker_containers.sh" |
| 38 | readonly DOCKER_CONTAINER=${LINUX_GCC_LATEST_CONTAINER} |
| 39 | |
Abseil Team | 74d9175 | 2019-07-03 12:13:04 -0700 | [diff] [blame] | 40 | for std in ${ABSL_CMAKE_CXX_STANDARDS}; do |
| 41 | for compilation_mode in ${ABSL_CMAKE_BUILD_TYPES}; do |
Abseil Team | 8f1c34a | 2020-10-16 18:59:21 -0700 | [diff] [blame] | 42 | for build_shared in ${ABSL_CMAKE_BUILD_SHARED}; do |
| 43 | time docker run \ |
Abseil Team | 4b915e7 | 2020-10-19 15:25:26 -0700 | [diff] [blame] | 44 | --mount type=bind,source="${ABSEIL_ROOT}",target=/abseil-cpp,readonly \ |
Abseil Team | 8f1c34a | 2020-10-16 18:59:21 -0700 | [diff] [blame] | 45 | --tmpfs=/buildfs:exec \ |
Abseil Team | eb317a7 | 2020-10-21 00:01:29 -0700 | [diff] [blame] | 46 | --workdir=/buildfs \ |
Abseil Team | 8f1c34a | 2020-10-16 18:59:21 -0700 | [diff] [blame] | 47 | --cap-add=SYS_PTRACE \ |
| 48 | --rm \ |
| 49 | -e CFLAGS="-Werror" \ |
| 50 | -e CXXFLAGS="-Werror" \ |
Abseil Team | eb317a7 | 2020-10-21 00:01:29 -0700 | [diff] [blame] | 51 | ${DOCKER_EXTRA_ARGS:-} \ |
| 52 | "${DOCKER_CONTAINER}" \ |
Abseil Team | 8f1c34a | 2020-10-16 18:59:21 -0700 | [diff] [blame] | 53 | /bin/bash -c " |
Abseil Team | 8f1c34a | 2020-10-16 18:59:21 -0700 | [diff] [blame] | 54 | cmake /abseil-cpp \ |
Abseil Team | eb317a7 | 2020-10-21 00:01:29 -0700 | [diff] [blame] | 55 | -DABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL} \ |
Abseil Team | 8f1c34a | 2020-10-16 18:59:21 -0700 | [diff] [blame] | 56 | -DBUILD_SHARED_LIBS=${build_shared} \ |
Matt Armstrong | fb7dd24 | 2021-12-10 10:50:53 -0800 | [diff] [blame] | 57 | -DABSL_BUILD_TESTING=ON \ |
Abseil Team | 8f1c34a | 2020-10-16 18:59:21 -0700 | [diff] [blame] | 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 |
Abseil Team | 74d9175 | 2019-07-03 12:13:04 -0700 | [diff] [blame] | 64 | done |
| 65 | done |