Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions CMake/EdenConfigChecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ fb_find_or_fetch(FBThrift)
include_directories(${FBTHRIFT_INCLUDE_DIR})

# The Python CLI uses fb303's thrift-python modules, which, like thrift-python,
# getdeps only builds on Linux.
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# getdeps builds on Linux and macOS.
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR APPLE)
set(FB303_THRIFT_PYTHON ON)
endif()
fb_find_or_fetch(fb303)
Expand Down Expand Up @@ -111,9 +111,9 @@ if (NOT BLAKE3_FOUND)
endif()
include_directories(${BLAKE3_INCLUDE_DIR})

# The Python CLI uses thrift-python, which getdeps only builds on Linux, and
# the thrift-python modules that fb303 builds with FB303_THRIFT_PYTHON.
if (ENABLE_THRIFT_PYTHON AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
# The Python CLI uses thrift-python and the thrift-python modules that fb303
# builds with FB303_THRIFT_PYTHON. getdeps provides them on Linux and macOS.
if (ENABLE_THRIFT_PYTHON AND (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR APPLE))
include(FBThriftPythonLibrary)
if (ENABLE_THRIFT_PYTHON STREQUAL "AUTO")
fb_find_thrift_python_runtime(QUIET)
Expand Down
24 changes: 15 additions & 9 deletions build/fbcode_builder/CMake/FBThriftPythonLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ macro(fb_find_thrift_python_runtime)
if(
NOT _FB_THRIFT_PYTHON_RUNTIME_FOUND OR
NOT EXISTS "${THRIFT_PYTHON_SITE_PACKAGES}/thrift/python" OR
NOT EXISTS "${THRIFT_PYTHON_SITE_PACKAGES}/thrift.libs" OR
(NOT APPLE AND NOT EXISTS "${THRIFT_PYTHON_SITE_PACKAGES}/thrift.libs") OR
NOT EXISTS "${FOLLY_PYTHON_SITE_PACKAGES}/folly"
)
# Ensure Python3 is found so we can use ${Python3_EXECUTABLE}
Expand Down Expand Up @@ -121,7 +121,7 @@ macro(fb_find_thrift_python_runtime)
"fbthrift-python was found at ${THRIFT_PYTHON_SITE_PACKAGES}, but "
"its thrift/python runtime package is missing.")
unset(THRIFT_PYTHON_SITE_PACKAGES)
elseif(NOT EXISTS "${THRIFT_PYTHON_SITE_PACKAGES}/thrift.libs")
elseif(NOT APPLE AND NOT EXISTS "${THRIFT_PYTHON_SITE_PACKAGES}/thrift.libs")
message(WARNING
"fbthrift-python was found at ${THRIFT_PYTHON_SITE_PACKAGES}, but "
"thrift.libs is missing. Install an auditwheel-repaired "
Expand Down Expand Up @@ -370,7 +370,7 @@ function(add_fb_thrift_python_executable TARGET)
if(
THRIFT_PYTHON_SITE_PACKAGES AND
EXISTS "${THRIFT_PYTHON_SITE_PACKAGES}/thrift/python" AND
EXISTS "${THRIFT_PYTHON_SITE_PACKAGES}/thrift.libs"
(APPLE OR EXISTS "${THRIFT_PYTHON_SITE_PACKAGES}/thrift.libs")
)
# The bundled thrift/ hides the wheel's namespace package, so link all of
# its subpackages: thrift.python imports thrift.py3, for example.
Expand All @@ -390,17 +390,23 @@ function(add_fb_thrift_python_executable TARGET)
)
endif()
endforeach()
set(thrift_libs_link_commands)
if(EXISTS "${THRIFT_PYTHON_SITE_PACKAGES}/thrift.libs")
list(APPEND thrift_libs_link_commands
COMMAND ${CMAKE_COMMAND}
"-DFB_REMOVE_PATH=${target_dir}/thrift.libs"
-P "${_FB_THRIFT_PYTHON_REMOVE_PATH_SCRIPT}"
COMMAND ${CMAKE_COMMAND} -E create_symlink
"${THRIFT_PYTHON_SITE_PACKAGES}/thrift.libs"
"${target_dir}/thrift.libs"
)
endif()
add_custom_command(
TARGET ${TARGET}.GEN_PY_EXE POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${target_dir}/thrift"
COMMAND ${CMAKE_COMMAND} -E touch "${target_dir}/thrift/__init__.py"
${link_commands}
COMMAND ${CMAKE_COMMAND}
"-DFB_REMOVE_PATH=${target_dir}/thrift.libs"
-P "${_FB_THRIFT_PYTHON_REMOVE_PATH_SCRIPT}"
COMMAND ${CMAKE_COMMAND} -E create_symlink
"${THRIFT_PYTHON_SITE_PACKAGES}/thrift.libs"
"${target_dir}/thrift.libs"
${thrift_libs_link_commands}
COMMENT "Symlinking thrift-python and its native dependencies into ${TARGET}"
)
else()
Expand Down
3 changes: 3 additions & 0 deletions build/fbcode_builder/manifests/cpptoml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ subdir = cpptoml-0.1.2

[cmake.defines.os=freebsd]
ENABLE_LIBCXX=NO

[cmake.defines.os=darwin]
ENABLE_LIBCXX=NO
7 changes: 3 additions & 4 deletions build/fbcode_builder/manifests/eden
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,14 @@ rust-shed
[dependencies.fbsource=on]
rust

[dependencies.os=darwin]
osxfuse

[dependencies.not(os=windows)]
# TODO: teach getdeps to compile curl on Windows.
# Enabling curl on Windows requires us to find a way to compile libcurl with
# msvc.
libcurl
# Added so that OSS doesn't see system "python" which is python 2 on darwin and some linux

[dependencies.not(any(os=windows, os=darwin))]
# On Linux, avoid finding a system "python" that may still be Python 2.
python

[dependencies.test=on]
Expand Down
1 change: 1 addition & 0 deletions build/fbcode_builder/manifests/edencommon
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ repo_url = https://github.com/facebookexperimental/edencommon.git

[build]
builder = cmake
patchfile = edencommon_pipe_darwin.patch

[dependencies]
boost
Expand Down
29 changes: 23 additions & 6 deletions build/fbcode_builder/manifests/fbthrift-python
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ fbthrift = thrift/lib/rust
[build]
builder = cmake
job_weight_mib = 3072
patchfile = fbthrift_python_darwin.patch

[build.not(os=linux)]
[build.os=darwin]
builder = cmake

[build.os=windows]
builder = nop

[cmake.defines]
Expand All @@ -34,25 +38,38 @@ THRIFT_TESTS=OFF
[cmake.defines.os=linux]
THRIFT_PYTHON=ON

[cmake.defines.os=darwin]
THRIFT_PYTHON=ON

[dependencies]
benchmark
fizz-python
fmt-python
folly-python
googletest
libsodium
wangle-python
zstd-python
mvfst-python
xxhash
# Thrift also depends on openssl but since the latter requires a platform-
# specific configuration we rely on the folly manifest to provide this
# dependency to avoid duplication.

[dependencies.os=linux]
fizz-python
fmt-python
wangle-python
zstd-python
mvfst-python
libaio-python
libevent-python

[dependencies.os=darwin]
fizz
fmt
wangle
zstd
mvfst
liboqs
libevent
libdwarf

[shipit.pathmap]
xplat/thrift/public_tld = .
xplat/thrift = thrift
Expand Down
29 changes: 22 additions & 7 deletions build/fbcode_builder/manifests/folly-python
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ repo_url = https://github.com/facebook/folly.git
[build]
builder = cmake
job_weight_mib = 1024
patchfile = folly_python_darwin.patch

[build.not(os=linux)]
[build.os=darwin]
builder = cmake

[build.os=windows]
builder = nop

[dependencies]
Expand All @@ -20,15 +24,9 @@ gflags
# copy of glog.
glog = shared_libs
googletest
boost-python
libdwarf-python
libevent-python
libsodium
fast_float
fmt-python
lz4-python
snappy
zstd-python
# no openssl or zlib in the linux case, why?
# these are usually installed on the system
# and are the easiest system deps to pull in.
Expand All @@ -41,6 +39,12 @@ zstd-python
# to build our own.
[dependencies.os=darwin]
openssl
boost
libdwarf
libevent
fmt
lz4
zstd

# Windows has neither openssl nor zlib, so we get
# to provide both
Expand All @@ -49,6 +53,12 @@ openssl
zlib

[dependencies.os=linux]
boost-python
libdwarf-python
libevent-python
fmt-python
lz4-python
zstd-python
libaio-python
libiberty-python
libunwind
Expand All @@ -70,6 +80,11 @@ fbcode/folly = folly
PYTHON_EXTENSIONS=ON
BUILD_SHARED_LIBS=ON

[cmake.defines.os=darwin]
PYTHON_EXTENSIONS=ON
BUILD_SHARED_LIBS=ON
CMAKE_CXX_FLAGS=-DGLOG_USE_GLOG_EXPORT

[cmake.defines.not(os=windows)]
BOOST_LINK_STATIC=ON

Expand Down
22 changes: 22 additions & 0 deletions build/fbcode_builder/patches/edencommon_pipe_darwin.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/eden/common/utils/Pipe.cpp b/eden/common/utils/Pipe.cpp
index 1724dbd1..67e188b2 100644
--- a/eden/common/utils/Pipe.cpp
+++ b/eden/common/utils/Pipe.cpp
@@ -43,7 +43,7 @@ Pipe::Pipe(bool nonBlocking) {
#else
int fds[2];
int res;
-#if FOLLY_HAVE_PIPE2
+#if FOLLY_HAVE_PIPE2 && !defined(__APPLE__)
res = pipe2(fds, (nonBlocking ? O_NONBLOCK : 0) | O_CLOEXEC);
#else
res = pipe(fds);
@@ -58,7 +58,7 @@ Pipe::Pipe(bool nonBlocking) {
read = FileDescriptor(fds[0], FileDescriptor::FDType::Pipe);
write = FileDescriptor(fds[1], FileDescriptor::FDType::Pipe);

-#if !FOLLY_HAVE_PIPE2
+#if !FOLLY_HAVE_PIPE2 || defined(__APPLE__)
read.setCloExec();
write.setCloExec();
if (nonBlocking) {
Loading