FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

MacOS: skip bundled libffi on non-x86_64 by bjia56 · Pull Request #342 · python-cmake-buildsystem/python-cmake-buildsystem · GitHub

Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .txt  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
37 changes: 24 additions & 13 deletions cmake/extensions/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -382,19 +382,30 @@ 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(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")

theartful Sep 14, 2025
edited
Loading

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'm testing this PR, and trying to build python on an arm macos for x86_64, and then for arm64 (I made a wrong review that I deleted before, disregard it if you saw it).

I failed locally to build for x86_64 on an arm machine (ctypes didn't work), since I get CMAKE_SYSTEM_PROCESSOR = arm64, while CMAKE_OSX_ARCHITECTURES = x86_64.

I think it's better to check only for CMAKE_OSX_ARCHITECTURES

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()
# non-x86_64 architectures, e.g. arm64 or arm64+x86_64 universal build
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

Back | FazBrowse Home | New Git URL