sparkle/native/ext/Makefile
fiser_jun 4745f264b2
2026-08-04 14:34:00 +08:00

15 lines
668 B
Makefile
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 生产 MLX 扩展构建cmake 把 native_moe_mlx_ext.cpp 编成
# mlx_streaming/native_moe_ext$(EXT_SUFFIX).sonanobind + MLX Primitive
PYTHON ?= ../../.venv/bin/python
PY_SITE := $(abspath ../../.venv/lib/python3.12/site-packages)
NANOBIND_DIR := $(shell $(PYTHON) -m nanobind --cmake_dir)
MLX_CMAKE_DIR := $(PY_SITE)/mlx/share/cmake/MLX
native_moe_ext:
cmake -S . -B build -DPython_EXECUTABLE=$(abspath $(PYTHON)) -Dnanobind_DIR=$(NANOBIND_DIR) -DMLX_DIR=$(MLX_CMAKE_DIR) -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$(abspath ../../mlx_streaming)
cmake --build build --target native_moe_ext -j
clean:
rm -rf build
rm -f ../../mlx_streaming/native_moe_ext*.so