Skip to content

Commit

Permalink
Apple arm64 build (#2)
Browse files Browse the repository at this point in the history
* Apple arm64 build

* Compile flag cleanup

Remove avx2 and rely on Clang native arch (M2 CPU)
  • Loading branch information
egao1980 authored Dec 7, 2023
1 parent 03a18d3 commit 115ef64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
CC ?= gcc
OUT := libvorbis
SUFFIX := so
CFLAGS := -O3 -ftree-vectorize -msse -mfpmath=sse -fPIC -g
CFLAGS := -O3 -ftree-vectorize -fPIC -g
SSE_DEFAULT := -msse -mfpmath=sse
SSE_MAC_SILICON := -march=native
LDFLAGS := -l m

ifeq ($(OS),Windows_NT)
CFLAGS := $(CFLAGS) $(SSE_DEFAULT)
OUT := $(OUT)-win
SUFFIX := dll
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
Expand All @@ -28,13 +31,16 @@ else
SUFFIX = dylib
endif
PROC_P := $(shell $(CC) -dumpmachine)
ifeq ($(filter, %x86_64,$(PROC)),)
ifneq ($(filter, %x86_64,$(PROC_P)),)
CFLAGS := $(CFLAGS) $(SSE_DEFAULT)
OUT := $(OUT)-amd64
endif
ifneq ($(filter %86,$(PROC)),)
ifneq ($(filter %86,$(PROC_P)),)
CFLAGS := $(CFLAGS) $(SSE_DEFAULT)
OUT := $(OUT)-i686
endif
ifneq ($(filter arm%,$(PROC)),)
ifneq ($(filter arm%,$(PROC_P)),)
CFLAGS := $(CFLAGS) $(SSE_MAC_SILICON)
OUT := $(OUT)-arm
endif
endif
Expand Down
Binary file added static/libvorbis-mac-arm.dylib
Binary file not shown.

0 comments on commit 115ef64

Please sign in to comment.