macOS/Apple Silicon port: NEON kernels + platform shim (PR #1 by RDouglasSharp)
This commit is contained in:
+23
-1
@@ -1,3 +1,24 @@
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
# --- macOS / Apple Silicon ---
|
||||
# Apple clang non include il runtime OpenMP: se c'e' libomp di Homebrew lo usa
|
||||
# (brew install libomp), altrimenti compila single-thread (i pragma omp sono ignorati).
|
||||
# Niente -march: su arm64 NEON e' baseline (i kernel __ARM_NEON si attivano da soli).
|
||||
CC = clang
|
||||
OMPDIR := $(shell brew --prefix libomp 2>/dev/null)
|
||||
ifneq ($(OMPDIR),)
|
||||
OMPC = -Xclang -fopenmp -I$(OMPDIR)/include
|
||||
OMPL = -L$(OMPDIR)/lib -lomp
|
||||
else
|
||||
$(warning libomp non trovato: build SINGLE-THREAD. Per il multithread: brew install libomp)
|
||||
OMPC =
|
||||
OMPL =
|
||||
endif
|
||||
CFLAGS = -O3 $(OMPC) -Wall -Wextra -Wno-unused-parameter -Wno-misleading-indentation -Wno-unused-function
|
||||
LDFLAGS = -lm $(OMPL)
|
||||
else
|
||||
# --- Linux x86-64 (percorso originale, invariato) ---
|
||||
CC = gcc
|
||||
# ARCH=native -> ottimizzato per QUESTA macchina (default, piu' veloce).
|
||||
# ARCH=x86-64-v3 -> binario PORTABILE su qualsiasi x86-64 moderno con AVX2 (per distribuire).
|
||||
@@ -5,10 +26,11 @@ CC = gcc
|
||||
ARCH ?= native
|
||||
CFLAGS = -O3 -march=$(ARCH) -fopenmp -Wall -Wextra -Wno-unused-parameter -Wno-misleading-indentation -Wno-unused-function
|
||||
LDFLAGS = -lm -fopenmp
|
||||
endif
|
||||
|
||||
all: glm
|
||||
|
||||
glm: glm.c st.h json.h tok.h tok_unicode.h
|
||||
glm: glm.c st.h json.h tok.h tok_unicode.h compat.h
|
||||
$(CC) $(CFLAGS) glm.c -o glm $(LDFLAGS)
|
||||
|
||||
olmoe: olmoe.c st.h json.h
|
||||
|
||||
Reference in New Issue
Block a user