Skip to content

Commit

Permalink
allow using system ffi on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
bjia56 committed Sep 27, 2023
1 parent 11a369e commit c45d712
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions cmake/extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -382,19 +382,29 @@ if(WIN32)
endif()
else()
if(APPLE)
add_python_extension(_ctypes
SOURCES ${ctypes_COMMON_SOURCES}
_ctypes/malloc_closure.c
_ctypes/darwin/dlfcn_simple.c
_ctypes/libffi_osx/ffi.c
_ctypes/libffi_osx/x86/darwin64.S
_ctypes/libffi_osx/x86/x86-darwin.S
_ctypes/libffi_osx/x86/x86-ffi_darwin.c
_ctypes/libffi_osx/x86/x86-ffi64.c
INCLUDEDIRS ${SRC_DIR}/Modules/_ctypes/libffi_osx/include
${SRC_DIR}/Modules/_ctypes/darwin
DEFINITIONS MACOSX
)
if(not USE_SYSTEM_LibFFI)
add_python_extension(_ctypes
SOURCES ${ctypes_COMMON_SOURCES}
_ctypes/malloc_closure.c
_ctypes/darwin/dlfcn_simple.c
_ctypes/libffi_osx/ffi.c
_ctypes/libffi_osx/x86/darwin64.S
_ctypes/libffi_osx/x86/x86-darwin.S
_ctypes/libffi_osx/x86/x86-ffi_darwin.c
_ctypes/libffi_osx/x86/x86-ffi64.c
INCLUDEDIRS ${SRC_DIR}/Modules/_ctypes/libffi_osx/include
${SRC_DIR}/Modules/_ctypes/darwin
DEFINITIONS MACOSX
)
else()
add_python_extension(_ctypes
REQUIRES LibFFI_INCLUDE_DIR LibFFI_LIBRARY
SOURCES ${ctypes_COMMON_SOURCES}
DEFINITIONS Py_BUILD_CORE_MODULE FFI_BUILDING
INCLUDEDIRS ${LibFFI_INCLUDE_DIR}
LIBRARIES ${LibFFI_LIBRARY}
)
endif()
else()
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
set(_libffi_system_extra_src
Expand Down

0 comments on commit c45d712

Please sign in to comment.