• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
19# Use Xcode 16.0
20sudo xcode-select -s /Applications/Xcode_16.0.app/Contents/Developer
21
22export CMAKE_BUILD_PARALLEL_LEVEL=$(sysctl -n hw.ncpu)
23export CTEST_PARALLEL_LEVEL=$(sysctl -n hw.ncpu)
24
25if [[ -z ${ABSEIL_ROOT:-} ]]; then
26  ABSEIL_ROOT="$(dirname ${0})/.."
27fi
28ABSEIL_ROOT=$(realpath ${ABSEIL_ROOT})
29
30source "${ABSEIL_ROOT}/ci/cmake_common.sh"
31
32if [[ -z ${ABSL_CMAKE_BUILD_TYPES:-} ]]; then
33  ABSL_CMAKE_BUILD_TYPES="Debug"
34fi
35
36if [[ -z ${ABSL_CMAKE_BUILD_SHARED:-} ]]; then
37  ABSL_CMAKE_BUILD_SHARED="OFF ON"
38fi
39
40if [[ -z ${ABSL_CMAKE_BUILD_MONOLITHIC_SHARED_LIBS:-} ]]; then
41  ABSL_CMAKE_BUILD_MONOLITHIC_SHARED_LIBS="OFF ON"
42fi
43
44for compilation_mode in ${ABSL_CMAKE_BUILD_TYPES}; do
45  for build_shared in ${ABSL_CMAKE_BUILD_SHARED}; do
46    if [[ $build_shared == "OFF" ]]; then
47      monolithic_shared_options="OFF"
48    else
49      monolithic_shared_options="$ABSL_CMAKE_BUILD_MONOLITHIC_SHARED_LIBS"
50    fi
51
52    for monolithic_shared in $monolithic_shared_options; do
53      BUILD_DIR=$(mktemp -d ${compilation_mode}.XXXXXXXX)
54      cd ${BUILD_DIR}
55
56      # TODO(absl-team): Enable -Werror once all warnings are fixed.
57      time cmake ${ABSEIL_ROOT} \
58        -GXcode \
59        -DBUILD_SHARED_LIBS=${build_shared} \
60        -DABSL_BUILD_TESTING=ON \
61        -DCMAKE_BUILD_TYPE=${compilation_mode} \
62        -DCMAKE_CXX_STANDARD=17 \
63        -DCMAKE_MODULE_LINKER_FLAGS="-Wl,--no-undefined" \
64        -DABSL_BUILD_MONOLITHIC_SHARED_LIBS=${monolithic_shared} \
65        -DABSL_GOOGLETEST_DOWNLOAD_URL="${ABSL_GOOGLETEST_DOWNLOAD_URL}"
66      time cmake --build .
67      time TZDIR=${ABSEIL_ROOT}/absl/time/internal/cctz/testdata/zoneinfo \
68        ctest -C ${compilation_mode} --output-on-failure
69    done
70  done
71done
72