Skip to content

Conversation

@Dsssyc
Copy link
Member

@Dsssyc Dsssyc commented Dec 15, 2025

Introduce support for macOS architecture flags in the CMake build process to enhance compatibility with cibuildwheel. This change allows the build system to recognize and utilize architecture flags set in the environment.

Copilot AI review requested due to automatic review settings December 15, 2025 06:31
@Dsssyc Dsssyc merged commit dea9edb into main Dec 15, 2025
5 checks passed
@Dsssyc Dsssyc deleted the dev_feature branch December 15, 2025 06:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the CMake-based Python extension build system to support macOS architecture flags set by cibuildwheel. It adds logic to parse the ARCHFLAGS environment variable and translate it into the appropriate CMAKE_OSX_ARCHITECTURES CMake configuration, enabling proper multi-architecture builds (x86_64 and arm64) on macOS.

Key changes:

  • Added platform-specific handling for macOS in the build extension method
  • Introduced ARCHFLAGS parsing to extract architecture specifications
  • Configured CMAKE_OSX_ARCHITECTURES based on detected architectures

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +39 to +42
if "arm64" in archflags:
archs.append("arm64")
if "x86_64" in archflags:
archs.append("x86_64")
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

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

The substring matching approach for parsing ARCHFLAGS is fragile and could lead to false positives. For example, if ARCHFLAGS contains a path or comment with "arm64" or "x86_64", it would incorrectly match. The standard format for ARCHFLAGS is space-separated tokens like "-arch arm64 -arch x86_64", so the code should properly parse this format by splitting on whitespace and looking for values that follow the "-arch" flag. This ensures only actual architecture specifications are captured.

Suggested change
if "arm64" in archflags:
archs.append("arm64")
if "x86_64" in archflags:
archs.append("x86_64")
tokens = archflags.split()
for i, token in enumerate(tokens):
if token == "-arch" and i + 1 < len(tokens):
arch = tokens[i + 1]
if arch not in archs:
archs.append(arch)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants