Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Michael Cho <[email protected]> Signed-off-by: Michael Cho <[email protected]>
- Loading branch information
1 parent
aae6685
commit 116e1a4
Showing
1 changed file
with
18 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
class Mlx < Formula | ||
desc "Array framework for Apple silicon" | ||
homepage "https://github.com/ml-explore/mlx" | ||
url "https://github.com/ml-explore/mlx/archive/refs/tags/v0.10.0.tar.gz" | ||
sha256 "09e9859e364ee8d19bf656730b7d6a471c8da2d397325efd1c73b836819f6e56" | ||
url "https://github.com/ml-explore/mlx/archive/refs/tags/v0.11.1.tar.gz" | ||
sha256 "20ffd4fee274b084661708407d0680eb9d1e9f16bb856b71546fd0beccbd1fad" | ||
license "MIT" | ||
head "https://github.com/ml-explore/mlx.git", branch: "main" | ||
|
||
|
@@ -12,34 +12,42 @@ class Mlx < Formula | |
end | ||
|
||
depends_on "cmake" => :build | ||
depends_on "nlohmann-json" => :build | ||
depends_on xcode: ["14.3", :build] | ||
depends_on arch: :arm64 | ||
depends_on :macos | ||
depends_on "[email protected]" | ||
|
||
# Update to GIT_TAG at https://github.com/ml-explore/mlx/blob/v#{version}/mlx/io/CMakeLists.txt#L21 | ||
resource "gguflib" do | ||
url "https://github.com/antirez/gguf-tools/archive/af7d88d808a7608a33723fba067036202910acb3.tar.gz" | ||
sha256 "1ee2dde74a3f9506af9ad61d7638a5e87b5e891b5e36a5dd3d5f412a8ce8dd03" | ||
end | ||
|
||
def python3 | ||
"python3.12" | ||
end | ||
|
||
def install | ||
args = %w[ | ||
ENV.append_to_cflags "-I#{Formula["nlohmann-json"].opt_include}/nlohmann" | ||
(buildpath/"gguflib").install resource("gguflib") | ||
args = %W[ | ||
-DBUILD_SHARED_LIBS=ON | ||
-DFETCHCONTENT_SOURCE_DIR_GGUFLIB=#{buildpath}/gguflib | ||
-DMLX_BUILD_BENCHMARKS=OFF | ||
-DMLX_BUILD_EXAMPLES=OFF | ||
-DMLX_BUILD_METAL=OFF | ||
-DMLX_BUILD_PYTHON_BINDINGS=OFF | ||
-DMLX_BUILD_TESTS=OFF | ||
] | ||
system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args | ||
|
||
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args | ||
system "cmake", "--build", "build" | ||
system "cmake", "--install", "build" | ||
|
||
env = { PYPI_RELEASE: version.to_s } | ||
env["DEV_RELEASE"] = "1" if build.head? | ||
env["MACOSX_DEPLOYMENT_TARGET"] = "#{MacOS.version.major}.#{MacOS.version.minor.to_i}" if OS.mac? | ||
with_env(env) do | ||
system python3, "-m", "pip", "install", *std_pip_args(build_isolation: true), "." | ||
end | ||
ENV[build.head? ? "DEV_RELEASE" : "PYPI_RELEASE"] = "1" | ||
ENV["MACOSX_DEPLOYMENT_TARGET"] = "#{MacOS.version.major}.#{MacOS.version.minor.to_i}" if OS.mac? | ||
system python3, "-m", "pip", "install", *std_pip_args(build_isolation: true), "." | ||
end | ||
|
||
test do | ||
|