From 60d4f2814c1ae4ace74e215807733ef29feccb65 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Jan 2021 20:40:53 +0100 Subject: [PATCH] (MacOS) Set up CROSS_COMPILING for ARM 64bit --- .gitlab-ci.yml | 10 ++++++++++ Makefile | 15 ++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 83ebf59..c7cedd7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,6 +33,10 @@ include: - project: 'libretro-infrastructure/ci-templates' file: '/osx-x64.yml' + # MacOS ARM 64-bit + - project: 'libretro-infrastructure/ci-templates' + file: '/osx-arm64.yml' + ################################## CELLULAR ################################ # Android - project: 'libretro-infrastructure/ci-templates' @@ -121,6 +125,12 @@ libretro-build-osx-x64: - .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 android-armeabi-v7a: diff --git a/Makefile b/Makefile index eba0e09..b9ab4cf 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,9 @@ ifeq ($(platform),) else ifneq ($(findstring Darwin,$(shell uname -s)),) platform = osx arch = intel + ifeq ($(shell uname -p),arm64) + arch = arm + endif ifeq ($(shell uname -p),powerpc) arch = ppc endif @@ -158,11 +161,21 @@ else ifeq ($(platform), osx) endif OSXVER = `sw_vers -productVersion | cut -d. -f 2` OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"` - fpic += -mmacosx-version-min=10.7 + MINVERSION += -mmacosx-version-min=10.7 ifeq ($(OSX_LT_MAVERICKS),"YES") else fpic += -stdlib=libc++ 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) # iOS else ifneq (,$(findstring ios,$(platform)))