linux_gcc_alpine_cmake.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. set -euox pipefail
  17. if [[ -z ${ABSEIL_ROOT:-} ]]; then
  18. ABSEIL_ROOT="$(realpath $(dirname ${0})/..)"
  19. fi
  20. source "${ABSEIL_ROOT}/ci/cmake_common.sh"
  21. if [[ -z ${ABSL_CMAKE_CXX_STANDARDS:-} ]]; then
  22. ABSL_CMAKE_CXX_STANDARDS="14 17"
  23. fi
  24. if [[ -z ${ABSL_CMAKE_BUILD_TYPES:-} ]]; then
  25. ABSL_CMAKE_BUILD_TYPES="Debug Release"
  26. fi
  27. if [[ -z ${ABSL_CMAKE_BUILD_SHARED:-} ]]; then
  28. ABSL_CMAKE_BUILD_SHARED="OFF ON"
  29. fi
  30. source "${ABSEIL_ROOT}/ci/linux_docker_containers.sh"
  31. readonly DOCKER_CONTAINER=${LINUX_ALPINE_CONTAINER}
  32. for std in ${ABSL_CMAKE_CXX_STANDARDS}; do
  33. for compilation_mode in ${ABSL_CMAKE_BUILD_TYPES}; do
  34. for build_shared in ${ABSL_CMAKE_BUILD_SHARED}; do
  35. time docker run \
  36. --mount type=bind,source="${ABSEIL_ROOT}",target=/abseil-cpp,readonly \
  37. --tmpfs=/buildfs:exec \
  38. --workdir=/buildfs \
  39. --cap-add=SYS_PTRACE \
  40. --rm \
  41. -e CFLAGS="-Werror" \
  42. -e CXXFLAGS="-Werror" \
  43. ${DOCKER_EXTRA_ARGS:-} \
  44. "${DOCKER_CONTAINER}" \
  45. /bin/sh -c "
  46. cmake /abseil-cpp \
  47. -DABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL} \
  48. -DABSL_BUILD_TESTING=ON \
  49. -DCMAKE_BUILD_TYPE=${compilation_mode} \
  50. -DCMAKE_CXX_STANDARD=${std} \
  51. -DCMAKE_MODULE_LINKER_FLAGS=\"-Wl,--no-undefined\" && \
  52. make -j$(nproc) && \
  53. ctest -j$(nproc) --output-on-failure"
  54. done
  55. done
  56. done