diff options
author | Abseil Team <absl-team@google.com> | 2024-05-29 07:57:30 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-05-29 07:58:29 -0700 |
commit | 7ce797f21767a22fad7eed8f91962c08b8fa8d27 (patch) | |
tree | f2bcea7c3320d218f112d6f80eb45c939b94ad7f /ci | |
parent | 64457068f2b1960e4c339e0c090eeb8b73ddddd6 (diff) | |
download | abseil-7ce797f21767a22fad7eed8f91962c08b8fa8d27.tar.gz abseil-7ce797f21767a22fad7eed8f91962c08b8fa8d27.tar.bz2 abseil-7ce797f21767a22fad7eed8f91962c08b8fa8d27.zip |
Enable building monolithic shared library on macOS and Linux.
PiperOrigin-RevId: 638284938
Change-Id: I4189215d85862a8eeaff5c477ff2e47252fa52d3
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/linux_gcc-latest_libstdcxx_cmake.sh | 55 | ||||
-rwxr-xr-x | ci/linux_gcc_alpine_cmake.sh | 54 | ||||
-rwxr-xr-x | ci/macos_xcode_cmake.sh | 43 |
3 files changed, 96 insertions, 56 deletions
diff --git a/ci/linux_gcc-latest_libstdcxx_cmake.sh b/ci/linux_gcc-latest_libstdcxx_cmake.sh index 1f721236..243901c2 100755 --- a/ci/linux_gcc-latest_libstdcxx_cmake.sh +++ b/ci/linux_gcc-latest_libstdcxx_cmake.sh @@ -34,33 +34,46 @@ 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 + source "${ABSEIL_ROOT}/ci/linux_docker_containers.sh" readonly DOCKER_CONTAINER=${LINUX_GCC_LATEST_CONTAINER} for std in ${ABSL_CMAKE_CXX_STANDARDS}; do for compilation_mode in ${ABSL_CMAKE_BUILD_TYPES}; do for build_shared in ${ABSL_CMAKE_BUILD_SHARED}; do - time docker run \ - --mount type=bind,source="${ABSEIL_ROOT}",target=/abseil-cpp,readonly \ - --tmpfs=/buildfs:exec \ - --workdir=/buildfs \ - --cap-add=SYS_PTRACE \ - --rm \ - -e CFLAGS="-Werror" \ - -e CXXFLAGS="-Werror" \ - ${DOCKER_EXTRA_ARGS:-} \ - "${DOCKER_CONTAINER}" \ - /bin/bash -c " - cmake /abseil-cpp \ - -DABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL} \ - -DBUILD_SHARED_LIBS=${build_shared} \ - -DABSL_BUILD_TESTING=ON \ - -DCMAKE_BUILD_TYPE=${compilation_mode} \ - -DCMAKE_CXX_STANDARD=${std} \ - -DCMAKE_MODULE_LINKER_FLAGS=\"-Wl,--no-undefined\" && \ - make -j$(nproc) && \ - TZDIR=/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo \ - ctest -j$(nproc) --output-on-failure" + 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 + time docker run \ + --mount type=bind,source="${ABSEIL_ROOT}",target=/abseil-cpp,readonly \ + --tmpfs=/buildfs:exec \ + --workdir=/buildfs \ + --cap-add=SYS_PTRACE \ + --rm \ + -e CFLAGS="-Werror" \ + -e CXXFLAGS="-Werror" \ + ${DOCKER_EXTRA_ARGS:-} \ + "${DOCKER_CONTAINER}" \ + /bin/bash -c " + cmake /abseil-cpp \ + -DABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL} \ + -DBUILD_SHARED_LIBS=${build_shared} \ + -DABSL_BUILD_TESTING=ON \ + -DCMAKE_BUILD_TYPE=${compilation_mode} \ + -DCMAKE_CXX_STANDARD=${std} \ + -DABSL_BUILD_MONOLITHIC_SHARED_LIBS=${monolithic_shared} \ + -DCMAKE_MODULE_LINKER_FLAGS=\"-Wl,--no-undefined\" && \ + make -j$(nproc) && \ + TZDIR=/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo \ + ctest -j$(nproc) --output-on-failure" + done done done done diff --git a/ci/linux_gcc_alpine_cmake.sh b/ci/linux_gcc_alpine_cmake.sh index b784456f..f19954f5 100755 --- a/ci/linux_gcc_alpine_cmake.sh +++ b/ci/linux_gcc_alpine_cmake.sh @@ -34,32 +34,46 @@ 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 + source "${ABSEIL_ROOT}/ci/linux_docker_containers.sh" readonly DOCKER_CONTAINER=${LINUX_ALPINE_CONTAINER} for std in ${ABSL_CMAKE_CXX_STANDARDS}; do for compilation_mode in ${ABSL_CMAKE_BUILD_TYPES}; do for build_shared in ${ABSL_CMAKE_BUILD_SHARED}; do - time docker run \ - --mount type=bind,source="${ABSEIL_ROOT}",target=/abseil-cpp,readonly \ - --tmpfs=/buildfs:exec \ - --workdir=/buildfs \ - --cap-add=SYS_PTRACE \ - --rm \ - -e CFLAGS="-Werror" \ - -e CXXFLAGS="-Werror" \ - ${DOCKER_EXTRA_ARGS:-} \ - "${DOCKER_CONTAINER}" \ - /bin/sh -c " - cmake /abseil-cpp \ - -DABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL} \ - -DABSL_BUILD_TESTING=ON \ - -DCMAKE_BUILD_TYPE=${compilation_mode} \ - -DCMAKE_CXX_STANDARD=${std} \ - -DCMAKE_MODULE_LINKER_FLAGS=\"-Wl,--no-undefined\" && \ - make -j$(nproc) && \ - TZDIR=/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo \ - ctest -j$(nproc) --output-on-failure" + 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 + time docker run \ + --mount type=bind,source="${ABSEIL_ROOT}",target=/abseil-cpp,readonly \ + --tmpfs=/buildfs:exec \ + --workdir=/buildfs \ + --cap-add=SYS_PTRACE \ + --rm \ + -e CFLAGS="-Werror" \ + -e CXXFLAGS="-Werror" \ + ${DOCKER_EXTRA_ARGS:-} \ + "${DOCKER_CONTAINER}" \ + /bin/sh -c " + cmake /abseil-cpp \ + -DABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL} \ + -DBUILD_SHARED_LIBS=${build_shared} \ + -DABSL_BUILD_TESTING=ON \ + -DCMAKE_BUILD_TYPE=${compilation_mode} \ + -DCMAKE_CXX_STANDARD=${std} \ + -DABSL_BUILD_MONOLITHIC_SHARED_LIBS=${monolithic_shared} \ + -DCMAKE_MODULE_LINKER_FLAGS=\"-Wl,--no-undefined\" && \ + make -j$(nproc) && \ + TZDIR=/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo \ + ctest -j$(nproc) --output-on-failure" + done done done done diff --git a/ci/macos_xcode_cmake.sh b/ci/macos_xcode_cmake.sh index 690f86b8..c8780384 100755 --- a/ci/macos_xcode_cmake.sh +++ b/ci/macos_xcode_cmake.sh @@ -36,22 +36,35 @@ 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 - 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=14 \ - -DCMAKE_MODULE_LINKER_FLAGS="-Wl,--no-undefined" \ - -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 + 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=14 \ + -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 |