Skip to content

add xcodeproj as a build method#289

Merged
davidkoski merged 6 commits intomainfrom
xcodeproj
Jan 14, 2026
Merged

add xcodeproj as a build method#289
davidkoski merged 6 commits intomainfrom
xcodeproj

Conversation

@davidkoski
Copy link
Collaborator

@davidkoski davidkoski commented Oct 23, 2025

Fix #281

  • build MLX, Cmlx via xcodeproj as a framework
  • expose C++ API at Cmlx framework level
  • update mlx script handles file prep
  • GitHub actions updated to build and test with these
  • tool to build xcframework (binary distribution format)

Docs updated for use case:

Note that the SwiftPM and XCode (1) methods build MLX as a Library, not as a framework.
It is possible to construct a situation where YourApp -> MLX, YourApp -> YourFramework
and YourFramework -> MLX. This would give two copies of MLX in the resulting process
and it may not work as expected.

If this cannot be avoided, either by making YourFramework a Library or having YourApp
not link MLX, you can use the xcode/MLX.xcodeproj to build MLX as a Framework.
This will require mlx-swift to be checked out adjacent or inside your project,
possibly using git submodules, and dragging the mlx-swift/xcode/MLX.xcodeproj into
your project. Once that is done your application can build and link MLX and related
as Frameworks.

Ready to go!

tests passing with ml-explore/mlx#2702 locally applied

expose C++ API
Comment on lines +1 to +3
See `xcode/MLX.xcodeproj` and [MAINTENANCE.md].

# Cmlx
Copy link
Member

Choose a reason for hiding this comment

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

Slightly confused by this readme is it meant for maintainers of MLX Swift or for users?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is meant for maintainers of MLX Swift. Maybe I should move this into MAINTENANCE.md and I can just leave a pointer to it here.

Copy link
Member

Choose a reason for hiding this comment

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

Yea I think that would've made it more clear to me!

Copy link
Member

@awni awni left a comment

Choose a reason for hiding this comment

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

Looks great, just a minor question about some docs, o/w good to go!

@davidkoski davidkoski merged commit 9a23343 into main Jan 14, 2026
7 checks passed
@davidkoski davidkoski deleted the xcodeproj branch January 14, 2026 17:30
@mattt
Copy link
Contributor

mattt commented Feb 5, 2026

@davidkoski @awni Excited to have this! I just opened #351, which creates automation so that releases have XCFramework assets. This way, API consumers — including dependent packages like mlx-swift-lm — can depend directly on pre-compiled framework.

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.

add an xcodeproj as an equivalent way to build and produce a framework

3 participants