Skip to content

macos x64: crossplatform native build#6448

Open
MaxRayskiy wants to merge 3 commits into
masterfrom
feature/macos-crossplatform-native
Open

macos x64: crossplatform native build#6448
MaxRayskiy wants to merge 3 commits into
masterfrom
feature/macos-crossplatform-native

Conversation

@MaxRayskiy

Copy link
Copy Markdown
Contributor

No description provided.

MaxRayskiy and others added 3 commits July 2, 2026 00:02
Alternative to the Rosetta approach: build the Intel target with a NATIVE
arm64 toolchain that cross-targets x86_64 (-arch x86_64), linking the
x86_64 Homebrew at /usr/local. Compiles run on native arm64 clang (fast);
only the output is x86_64.

- ConfigureHomebrew.cmake: honor an explicit `-D HOMEBREW_PREFIX=<prefix>`
  override (falls back to `brew --prefix`), so a native arm64 cmake can be
  pointed at the /usr/local x86_64 bottles.
- build_source.sh: honor a caller-set NPROC to cap build parallelism.
- macos/crossplatform-builds/README.md: documents the recipe, the critical
  gotchas (must force CMAKE_MAKE_PROGRAM to the arm64 ninja, else CMake's
  find_program grabs the x86_64 ninja from /usr/local and silently compiles
  under Rosetta; CMAKE_PREFIX_PATH=/usr/local for find_package; x86_64 python
  shim), and a native-vs-Rosetta comparison.

Validated on an Apple M4: native arm64 clang (Code Type: ARM64) cross-built
MeshLib core to x86_64; all binaries x86_64, linked against /usr/local
x86_64 dylibs; 294/294 unit tests pass under Rosetta.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Idempotent provisioning for the NATIVE (non-Rosetta) x86_64 cross build:
 1. native arm64 cmake + ninja at /opt/homebrew (the build driver; installs
    only if missing, no force-upgrade)
 2. Rosetta 2 (only to RUN the x86_64 output + CMake configure probes; the
    compilation itself is native)
 3. x86_64 Homebrew at /usr/local (source of x86_64 bottles); --prewarm to
    install the formulae now, else CI installs them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant