File: macos_xcode_cmake.sh

package info (click to toggle)
chromium 145.0.7632.159-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,976,224 kB
  • sloc: cpp: 36,198,469; ansic: 7,634,080; javascript: 3,564,060; python: 1,649,622; xml: 838,470; asm: 717,087; pascal: 185,708; sh: 88,786; perl: 88,718; objc: 79,984; sql: 59,811; cs: 42,452; fortran: 24,101; makefile: 21,144; tcl: 15,277; php: 14,022; yacc: 9,066; ruby: 7,553; awk: 3,720; lisp: 3,233; lex: 1,328; ada: 727; jsp: 228; sed: 36
file content (78 lines) | stat: -rwxr-xr-x 2,635 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
#
# Copyright 2019 The Abseil Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -euox pipefail

# Use Xcode 16.3
sudo xcode-select -s /Applications/Xcode_16.3.app/Contents/Developer

brew install cmake

export CMAKE_BUILD_PARALLEL_LEVEL=$(sysctl -n hw.ncpu)
export CTEST_PARALLEL_LEVEL=$(sysctl -n hw.ncpu)

if [[ -z ${ABSEIL_ROOT:-} ]]; then
  ABSEIL_ROOT="$(dirname ${0})/.."
fi
ABSEIL_ROOT=$(realpath ${ABSEIL_ROOT})

source "${ABSEIL_ROOT}/ci/cmake_common.sh"

# Avoid depending on GitHub by looking for a cached copy of GoogleTest.
if [[ -r "${KOKORO_GFILE_DIR:-}/distdir/googletest-${ABSL_GOOGLETEST_VERSION}.tar.gz" ]]; then
  ABSL_GOOGLETEST_DOWNLOAD_URL="${KOKORO_GFILE_DIR}/distdir/googletest-${ABSL_GOOGLETEST_VERSION}.tar.gz"
fi

if [[ -z ${ABSL_CMAKE_BUILD_TYPES:-} ]]; then
  ABSL_CMAKE_BUILD_TYPES="Debug"
fi

if [[ -z ${ABSL_CMAKE_BUILD_SHARED:-} ]]; then
  ABSL_CMAKE_BUILD_SHARED="OFF ON"
fi

if [[ -z ${ABSL_CMAKE_BUILD_MONOLITHIC_SHARED_LIBS:-} ]]; then
  ABSL_CMAKE_BUILD_MONOLITHIC_SHARED_LIBS="OFF ON"
fi

for compilation_mode in ${ABSL_CMAKE_BUILD_TYPES}; do
  for build_shared in ${ABSL_CMAKE_BUILD_SHARED}; do
    if [[ $build_shared == "OFF" ]]; then
      monolithic_shared_options="OFF"
    else
      monolithic_shared_options="$ABSL_CMAKE_BUILD_MONOLITHIC_SHARED_LIBS"
    fi

    for monolithic_shared in $monolithic_shared_options; do
      BUILD_DIR=$(mktemp -d ${compilation_mode}.XXXXXXXX)
      cd ${BUILD_DIR}

      # TODO(absl-team): Enable -Werror once all warnings are fixed.
      time cmake ${ABSEIL_ROOT} \
        -GXcode \
        -DBUILD_SHARED_LIBS=${build_shared} \
        -DABSL_BUILD_TESTING=ON \
        -DCMAKE_BUILD_TYPE=${compilation_mode} \
        -DCMAKE_CXX_STANDARD=17 \
        -DCMAKE_MODULE_LINKER_FLAGS="-Wl,--no-undefined" \
        -DABSL_BUILD_MONOLITHIC_SHARED_LIBS=${monolithic_shared} \
        -DABSL_GOOGLETEST_DOWNLOAD_URL="${ABSL_GOOGLETEST_DOWNLOAD_URL}"
      time cmake --build .
      time TZDIR=${ABSEIL_ROOT}/absl/time/internal/cctz/testdata/zoneinfo \
        ctest -C ${compilation_mode} --output-on-failure
    done
  done
done