refactor(metal): move dtype, array, metal, stream to internal/metal
Move foundation CGO files from root package to internal/metal/ package. Changes package declaration from `package mlx` to `package metal`. Updates CGO SRCDIR paths to account for new location (two levels deeper). Extracts go:generate directives into root generate.go. Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
643df757e0
commit
1cf5178c80
5 changed files with 13 additions and 20 deletions
5
generate.go
Normal file
5
generate.go
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
package mlx
|
||||
|
||||
//go:generate cmake -S . -B build -DCMAKE_INSTALL_PREFIX=dist -DCMAKE_BUILD_TYPE=Release
|
||||
//go:generate cmake --build build --parallel
|
||||
//go:generate cmake --install build
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
//go:build darwin && arm64
|
||||
|
||||
package mlx
|
||||
package metal
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
//go:build darwin && arm64
|
||||
|
||||
package mlx
|
||||
package metal
|
||||
|
||||
// #include "mlx/c/mlx.h"
|
||||
import "C"
|
||||
|
|
@ -1,27 +1,15 @@
|
|||
//go:build darwin && arm64
|
||||
|
||||
// Package mlx provides Go bindings for Apple's MLX framework via mlx-c.
|
||||
//
|
||||
// Build mlx-c before use:
|
||||
//
|
||||
// cd pkg/mlx && go generate ./...
|
||||
//
|
||||
// Build (MLX is auto-enabled on darwin/arm64):
|
||||
//
|
||||
// go build -o core .
|
||||
package mlx
|
||||
|
||||
//go:generate cmake -S . -B build -DCMAKE_INSTALL_PREFIX=dist -DCMAKE_BUILD_TYPE=Release
|
||||
//go:generate cmake --build build --parallel
|
||||
//go:generate cmake --install build
|
||||
// Package metal provides Go bindings for Apple's MLX framework via mlx-c.
|
||||
package metal
|
||||
|
||||
/*
|
||||
#cgo CXXFLAGS: -std=c++17
|
||||
#cgo CFLAGS: -mmacosx-version-min=26.0
|
||||
#cgo CPPFLAGS: -I${SRCDIR}/dist/include
|
||||
#cgo LDFLAGS: -L${SRCDIR}/dist/lib -lmlxc -lmlx
|
||||
#cgo CPPFLAGS: -I${SRCDIR}/../../dist/include
|
||||
#cgo LDFLAGS: -L${SRCDIR}/../../dist/lib -lmlxc -lmlx
|
||||
#cgo darwin LDFLAGS: -framework Foundation -framework Metal -framework Accelerate
|
||||
#cgo darwin LDFLAGS: -Wl,-rpath,${SRCDIR}/dist/lib
|
||||
#cgo darwin LDFLAGS: -Wl,-rpath,${SRCDIR}/../../dist/lib
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
//go:build darwin && arm64
|
||||
|
||||
package mlx
|
||||
package metal
|
||||
|
||||
/*
|
||||
#include "mlx/c/mlx.h"
|
||||
Loading…
Add table
Reference in a new issue