Skip to content

Commit 2e1e234

Browse files
Mizuxcopybara-github
authored andcommitted
Rework CMake support
* Rework third party management * Fix XCode build using MODULE * Fix Python support by not linking against the python library as manylinux images and PEP-513 require ref: https://peps.python.org/pep-0513/#libpythonx-y-so-1 PiperOrigin-RevId: 715755360
1 parent 11b801f commit 2e1e234

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
include(FetchContent)
2+
set(BUILD_SHARED_LIBS ON)
3+
set(BUILD_TESTING OFF)
4+
5+
message(CHECK_START "Checking for external dependencies")
6+
list(APPEND CMAKE_MESSAGE_INDENT " ")
7+
8+
if(NOT TARGET absl::base)
9+
if(USE_SYSTEM_ABSEIL)
10+
# Version omitted, as absl only allows EXACT version matches
11+
find_package(absl REQUIRED)
12+
else()
13+
message(CHECK_START "Fetching Abseil-cpp")
14+
list(APPEND CMAKE_MESSAGE_INDENT " ")
15+
# ensure that abseil also installs itself, since we are using it in our public
16+
# API
17+
set(ABSL_ENABLE_INSTALL ON)
18+
set(ABSL_PROPAGATE_CXX_STD ON)
19+
set(ABSL_USE_SYSTEM_INCLUDES ON)
20+
set(ABSL_BUILD_TESTING OFF)
21+
FetchContent_Declare(
22+
absl
23+
GIT_REPOSITORY "https://github.com/abseil/abseil-cpp.git"
24+
GIT_TAG "20240722.0"
25+
GIT_SHALLOW TRUE)
26+
FetchContent_MakeAvailable(absl)
27+
list(POP_BACK CMAKE_MESSAGE_INDENT)
28+
message(CHECK_PASS "fetched")
29+
endif()
30+
endif()
31+
32+
if(NOT TARGET pybind11::pybind11_headers)
33+
if(USE_SYSTEM_PYBIND)
34+
find_package(pybind11 2.13.6 REQUIRED)
35+
else()
36+
message(CHECK_START "Fetching pybind11")
37+
list(APPEND CMAKE_MESSAGE_INDENT " ")
38+
FetchContent_Declare(
39+
pybind11
40+
GIT_REPOSITORY "https://github.com/pybind/pybind11.git"
41+
GIT_TAG "v2.13.6"
42+
GIT_SHALLOW TRUE)
43+
FetchContent_MakeAvailable(pybind11)
44+
list(POP_BACK CMAKE_MESSAGE_INDENT)
45+
message(CHECK_PASS "fetched")
46+
endif()
47+
endif()
48+
49+
list(POP_BACK CMAKE_MESSAGE_INDENT)
50+
message(CHECK_PASS "all dependencies found")

0 commit comments

Comments
 (0)