Files
pybind11_abseil/cmake/dependencies/CMakeLists.txt
Corentin Le Molgat d1bd9b3ca4 deep rework (mostly ci and build system)
# Fix
* Fix `absl::monostate` support against C++14
* Fix `MSVC C2466` compilation error
  ref: https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2466
* Fix `bazel test -c opt` run

# CMake
* Bump CMake minimal version to 3.18 to align with pybind11_protobuf and needed to work with pypa/manylinux image (ed need `Development.Module` option in `FindPython3`)
* rename `status` as `status_py_extension_stub` target to avoid conflict with abseil-cpp when fetched (ed cmake target are NOT scoped)<br>
  note: still provide the `pybind11_abseil::status` target alias.
* Disable C++ gnu extension.
* Rework third party management
  * disable test for dependencies BUT still allow to enable them for pybind11_abseil
  * Bump abseil-cpp from `20230802.0` to `20240722.0`
  * Bump pybind11 from master(floating) to `v2.13.6`
* Fix XCode build using `MODULE` in `pybind_extension`
* Fix Python support by not linking against the python library as manylinux images and PEP-513 require<br>
  ref: https://peps.python.org/pep-0513/#libpythonx-y-so-1

# Bazel
* Update dependencies in `MODULE.bazel` and `WORKSPACE`
  * Bump Protobuf to `v29.2`
* Add a `.bazelignore` to avoid to parse cmake's usual `build` directory
* Add a `.bazelrc` with default options (similar to the one in `pybind11_protobuf`)

# Update CI workflows
* Split CMake and Bazel workflows to get independent badges
* Split MacOS (amd64 and M1) and Windows (amd64) and Linux (amd64) jobs
* import ubuntu-build.yml from pybind11_protobuf

## Bazel
* Add C++14, c++17 and c++20 flavours
* Add `-c opt` and `-c dbg` variants
* only test against the default python3.11

## CMake
* Test Python 3.9, 3.10. 3.11, 3.12
* cmake(linux): Test Unix Makefile and Ninja Build generators
* cmake(macOS): Test XCode and Makefile generators
* cmake(windows): Test MSVC (VC 2022) generator

PiperOrigin-RevId: 721778070
2025-01-31 08:12:32 -08:00

51 lines
1.5 KiB
CMake

include(FetchContent)
set(BUILD_SHARED_LIBS ON)
set(BUILD_TESTING OFF)
message(CHECK_START "Checking for external dependencies")
list(APPEND CMAKE_MESSAGE_INDENT " ")
if(NOT TARGET absl::base)
if(USE_SYSTEM_ABSEIL)
# Version omitted, as absl only allows EXACT version matches
find_package(absl REQUIRED)
else()
message(CHECK_START "Fetching Abseil-cpp")
list(APPEND CMAKE_MESSAGE_INDENT " ")
# ensure that abseil also installs itself, since we are using it in our
# public API
set(ABSL_ENABLE_INSTALL ON)
set(ABSL_PROPAGATE_CXX_STD ON)
set(ABSL_USE_SYSTEM_INCLUDES ON)
set(ABSL_BUILD_TESTING OFF)
FetchContent_Declare(
absl
GIT_REPOSITORY "https://github.com/abseil/abseil-cpp.git"
GIT_TAG "20240722.0"
GIT_SHALLOW TRUE)
FetchContent_MakeAvailable(absl)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
endif()
if(NOT TARGET pybind11::pybind11_headers)
if(USE_SYSTEM_PYBIND)
find_package(pybind11 2.13.6 REQUIRED)
else()
message(CHECK_START "Fetching pybind11")
list(APPEND CMAKE_MESSAGE_INDENT " ")
FetchContent_Declare(
pybind11
GIT_REPOSITORY "https://github.com/pybind/pybind11.git"
GIT_TAG "v2.13.6"
GIT_SHALLOW TRUE)
FetchContent_MakeAvailable(pybind11)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
endif()
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "all dependencies found")