Skip to content

Commit 67bdf94

Browse files
committed
Update Makefile for macOS fat library support
1 parent 795e606 commit 67bdf94

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ ifeq ($(PLATFORM),windows)
5656
else ifeq ($(PLATFORM),macos)
5757
TARGET := $(DIST_DIR)/ai.dylib
5858
LIBS += $(BUILD_DIR)/lib/ggml/src/ggml-metal/libggml-metal.a
59-
LDFLAGS += -L./$(BUILD_DIR)/lib/ggml/src/ggml-metal -lggml-metal -framework Metal -framework Foundation -framework CoreFoundation -framework QuartzCore -framework Accelerate -dynamiclib -undefined dynamic_lookup
60-
#LDFLAGS += -arch x86_64 -arch arm64 -L./$(BUILD_DIR)/lib/ggml/src/ggml-metal -lggml-metal
61-
#CFLAGS += -arch x86_64 -arch arm64
59+
LDFLAGS += -arch x86_64 -arch arm64 -L./$(BUILD_DIR)/lib/ggml/src/ggml-metal -lggml-metal -framework Metal -framework Foundation -framework CoreFoundation -framework QuartzCore -framework Accelerate -dynamiclib -undefined dynamic_lookup
60+
CFLAGS += -arch x86_64 -arch arm64
61+
LLAMA_OPTIONS = -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
6262
else ifeq ($(PLATFORM),android)
6363
# Set ARCH to find Android NDK's Clang compiler, the user should set the ARCH
6464
ifeq ($(filter %,$(ARCH)),)
@@ -127,9 +127,8 @@ test: $(TARGET)
127127

128128
# Build all libraries at once using one CMake call
129129
build/libs.stamp:
130-
#-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
131130
cd $(BUILD_DIR) && \
132-
cmake -B lib -DBUILD_SHARED_LIBS=OFF ../$(LLAMA_DIR) && \
131+
cmake -B lib -DBUILD_SHARED_LIBS=OFF $(LLAMA_OPTIONS) ../$(LLAMA_DIR) && \
133132
cmake --build lib --config Release -- -j$(CPUS)
134133
touch $@
135134

0 commit comments

Comments
 (0)