Skip to content

Instantly share code, notes, and snippets.

@kode54
Created March 27, 2021 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kode54/b4f31ccf1ec8fc2c008eb80522d35e64 to your computer and use it in GitHub Desktop.
Save kode54/b4f31ccf1ec8fc2c008eb80522d35e64 to your computer and use it in GitHub Desktop.
Exhale Universal 2 (plus enable working directory change)
diff --git a/makefile b/makefile
index 924d4f3..94cc0ee 100644
--- a/makefile
+++ b/makefile
@@ -11,20 +11,24 @@
## BUILD32=1: compile for 32-bit platforms, BUILD32=0: compile for 64-bit platforms
BUILD32?=0
+## UNIVERSAL2=1: compile for both x86_64 and arm64 on macOS, UNIVERSAL2=0: compile for native architecture on all platforms
+UNIVERSAL2?=0
+
export BUILD32
+export UNIVERSAL2
all:
- $(MAKE) -C src/lib MM32=$(BUILD32)
- $(MAKE) -C src/app MM32=$(BUILD32)
+ $(MAKE) -C src/lib MM32=$(BUILD32) UNIVERSAL2=$(UNIVERSAL2)
+ $(MAKE) -C src/app MM32=$(BUILD32) UNIVERSAL2=$(UNIVERSAL2)
debug:
- $(MAKE) -C src/lib debug MM32=$(BUILD32)
- $(MAKE) -C src/app debug MM32=$(BUILD32)
+ $(MAKE) -C src/lib debug MM32=$(BUILD32) UNIVERSAL2=$(UNIVERSAL2)
+ $(MAKE) -C src/app debug MM32=$(BUILD32) UNIVERSAL2=$(UNIVERSAL2)
release:
- $(MAKE) -C src/lib release MM32=$(BUILD32)
- $(MAKE) -C src/app release MM32=$(BUILD32)
+ $(MAKE) -C src/lib release MM32=$(BUILD32) UNIVERSAL2=$(UNIVERSAL2)
+ $(MAKE) -C src/app release MM32=$(BUILD32) UNIVERSAL2=$(UNIVERSAL2)
clean:
- $(MAKE) -C src/lib clean MM32=$(BUILD32)
- $(MAKE) -C src/app clean MM32=$(BUILD32)
+ $(MAKE) -C src/lib clean MM32=$(BUILD32) UNIVERSAL2=$(UNIVERSAL2)
+ $(MAKE) -C src/app clean MM32=$(BUILD32) UNIVERSAL2=$(UNIVERSAL2)
diff --git a/src/app/exhaleApp.cpp b/src/app/exhaleApp.cpp
index 0a59ab4..301b9f8 100644
--- a/src/app/exhaleApp.cpp
+++ b/src/app/exhaleApp.cpp
@@ -61,7 +61,7 @@
#define EA_LOUD_NORM -42.25f // -100 + 57.75 of ISO 23003-4, Table A.48
#define EA_PEAK_NORM -96.33f // 20 * log10(2^-16), 16-bit normalization
#define EA_PEAK_MIN 0.262f // 20 * log10() + EA_PEAK_NORM = -108 dbFS
-#define EA_USE_WORK_DIR (defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64)) // 1: use working instead of app directory
+#define EA_USE_WORK_DIR 1 // 1: use working instead of app directory
#define ENABLE_RESAMPLING 1 // 1: automatic input up- and downsampling
#define XHE_AAC_LOW_DELAY 0 // 1: allow encoding with 768 frame length
#if ENABLE_RESAMPLING
diff --git a/src/makefile.base b/src/makefile.base
index 5a60ab5..63db52e 100644
--- a/src/makefile.base
+++ b/src/makefile.base
@@ -50,6 +50,12 @@ ifeq ($(MM32), 1)
CPPFLAGS+=-m32
endif
+# setting Apple Silicon Universal 2 compiler flags
+UNIVERSAL2?=0
+ifeq ($(UNIVERSAL2), 1)
+ CPPFLAGS+=-arch x86_64 -arch arm64 -mmacosx-version-min=10.9
+endif
+
# debug and release compiler flags
DEBUG_CPPFLAGS = -g -D_DEBUG
RELEASE_CPPFLAGS = -O3 -Wuninitialized
@@ -66,6 +72,10 @@ ifeq ($(MM32), 1)
ALL_LDFLAGS+=-m32
endif
+ifeq ($(UNIVERSAL2), 1)
+ ALL_LDFLAGS+=-arch x86_64 -arch arm64 -mmacosx-version-min=10.9
+endif
+
# debug and release linker flags
ifeq ($(CONFIG), CONSOLE)
LDFLAGS = $(ALL_LDFLAGS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment