From c13de4518c0c8e670f35330a87e7020431ab1638 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Jan 2021 19:25:53 +0100 Subject: [PATCH] (macOS) Add 64bit ARM MacOS support --- .gitlab-ci.yml | 10 ++++++++++ src/libretro/Makefile | 23 +++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 355aba24..a0bb99c9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,6 +34,10 @@ include: # MacOS 64-bit - project: 'libretro-infrastructure/ci-templates' file: '/osx-x64.yml' + + # MacOS ARM 64-bit + - project: 'libretro-infrastructure/ci-templates' + file: '/osx-arm64.yml' ################################## CELLULAR ################################ # Android @@ -93,6 +97,12 @@ libretro-build-osx-x64: extends: - .libretro-osx-x64-make-default - .core-defs + +# MacOS ARM 64-bit +libretro-build-osx-arm64: + extends: + - .libretro-osx-arm64-make-default + - .core-defs ################################### CELLULAR ################################# # Android ARMv7a diff --git a/src/libretro/Makefile b/src/libretro/Makefile index 063e76bf..5e444e2f 100644 --- a/src/libretro/Makefile +++ b/src/libretro/Makefile @@ -20,6 +20,9 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),) else ifneq ($(findstring Darwin,$(shell uname -a)),) platform = osx arch = intel +ifeq ($(shell uname -p),arm) + arch = arm +endif ifeq ($(shell uname -p),powerpc) arch = ppc endif @@ -36,6 +39,9 @@ EXE_EXT = .exe else ifneq ($(findstring Darwin,$(shell uname -a)),) system_platform = osx arch = intel +ifeq ($(shell uname -p),arm) + arch = arm +endif ifeq ($(shell uname -p),powerpc) arch = ppc endif @@ -138,11 +144,24 @@ else ifeq ($(platform), osx) endif OSXVER = `sw_vers -productVersion | cut -d. -f 2` OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"` + MINVERSION = ifeq ($(OSX_LT_MAVERICKS),"YES") - fpic += -mmacosx-version-min=10.2 + MINVERSION = -mmacosx-version-min=10.2 else - fpic += -mmacosx-version-min=10.7 -stdlib=libc++ + MINVERSION = -mmacosx-version-min=10.7 endif +ifeq ($(shell uname -p),arm) + MINVERSION = +endif + ifeq ($(CROSS_COMPILE),1) + TARGET_RULE = -target $(LIBRETRO_APPLE_PLATFORM) -isysroot $(LIBRETRO_APPLE_ISYSROOT) + CFLAGS += $(TARGET_RULE) + CPPFLAGS += $(TARGET_RULE) + CXXFLAGS += $(TARGET_RULE) + LDFLAGS += $(TARGET_RULE) + MINVERSION = + endif + fpic += $(MINVERSION) -stdlib=libc++ SHARED := -dynamiclib TILED_RENDERING=1