From 0e1ccb3fef5d07b2b9d3e8ad12fe69f704b9669b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 23 Mar 2021 18:34:41 +0100 Subject: Add ios-arm64/tvos-arm64, ios9, and osx-arm64. osx-arm64 is interpreter for now (lightrec crashes at startup) --- .gitlab-ci.yml | 42 +++++++++++++++++++++++ Makefile.libretro | 99 +++++++++++++++++++++++++++++++++++++---------------- frontend/libretro.c | 2 +- 3 files changed, 112 insertions(+), 31 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d3706fc..bf05cac 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,10 +34,22 @@ 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' file: '/android-jni.yml' + + # iOS + - project: 'libretro-infrastructure/ci-templates' + file: '/ios-arm64.yml' + + # iOS (armv7) + - project: 'libretro-infrastructure/ci-templates' + file: '/ios9.yml' ################################## CONSOLES ################################ # PlayStation Portable @@ -56,6 +68,12 @@ include: - project: 'libretro-infrastructure/ci-templates' file: '/libnx-static.yml' + # tvOS (AppleTV) + - project: 'libretro-infrastructure/ci-templates' + file: '/tvos-arm64.yml' + + #################################### MISC ################################## + # Stages for building stages: - build-prepare @@ -97,6 +115,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: @@ -121,6 +145,24 @@ android-x86: extends: - .libretro-android-jni-x86 - .core-defs + +# iOS +libretro-build-ios-arm64: + extends: + - .libretro-ios-arm64-make-default + - .core-defs + +# iOS (armv7) [iOS 9 and up] +libretro-build-ios9: + extends: + - .libretro-ios9-make-default + - .core-defs + +# tvOS +libretro-build-tvos-arm64: + extends: + - .libretro-tvos-arm64-make-default + - .core-defs ################################### CONSOLES ################################# # PlayStation Vita diff --git a/Makefile.libretro b/Makefile.libretro index 60feab4..bdc7b6e 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -90,59 +90,98 @@ else ifeq ($(platform), linux-portable) # OS X else ifeq ($(platform), osx) - DYNAREC ?= lightrec + DYNAREC := 0 TARGET := $(TARGET_NAME)_libretro.dylib fpic := -fPIC - fpic += -mmacosx-version-min=10.1 + HAVE_NEON = 0 +ifeq ($(DYNAREC),0) + TARGET := $(TARGET_NAME)_interpreter_libretro.dylib +endif + MACSOSVER = `sw_vers -productVersion | cut -d. -f 1` + OSXVER = `sw_vers -productVersion | cut -d. -f 2` + OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"` + ifeq ($(OSX_LT_MAVERICKS),YES) + fpic += -mmacosx-version-min=10.1 + 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) + endif + + CFLAGS += $(ARCHFLAGS) + CXXFLAGS += $(ARCHFLAGS) + LDFLAGS += $(ARCHFLAGS) # iOS -else ifeq ($(platform),$(filter $(platform),ios-arm64)) +else ifneq (,$(findstring ios,$(platform))) + TARGET := $(TARGET_NAME)_libretro_ios.dylib + MINVERSION := +ifeq ($(DYNAREC),lightrec) + # Override + DYNAREC := 0 +endif +ifeq ($(DYNAREC),0) + TARGET := $(TARGET_NAME)_interpreter_libretro_ios.dylib +endif + fpic := -fPIC + + ifeq ($(IOSSDK),) + IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path) + endif + + CFLAGS += -DIOS -marm +ifeq ($(platform),ios-arm64) + CC = cc -arch arm64 -isysroot $(IOSSDK) + CXX = c++ -arch arm64 -isysroot $(IOSSDK) ARCH := arm64 HAVE_NEON = 0 BUILTIN_GPU = peops DYNAREC = 0 - TARGET := $(TARGET_NAME)_interpreter_libretro_ios.dylib - - CC = clang -arch arm64 -isysroot $(IOSSDK) -miphoneos-version-min=8.0 - CXX = clang++ -arch arm64 -isysroot $(IOSSDK) -miphoneos-version-min=8.0 - CFLAGS += -marm -DIOS - -else ifneq (,$(findstring ios,$(platform))) +else + CC = cc -arch armv7 -isysroot $(IOSSDK) + CXX = c++ -arch armv7 -isysroot $(IOSSDK) ARCH := arm -# DYNAREC ?= ari64 HAVE_NEON = 1 BUILTIN_GPU = neon - TARGET := $(TARGET_NAME)_libretro_ios.dylib + CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon + ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon +endif + CC_AS = perl ./tools/gas-preprocessor.pl $(CC) +ifeq ($(platform),$(filter $(platform),ios9 ios-arm64)) + MINVERSION = -miphoneos-version-min=8.0 +else + MINVERSION = -miphoneos-version-min=5.0 +endif + CFLAGS += $(MINVERSION) + +else ifeq ($(platform), tvos-arm64) + TARGET := $(TARGET_NAME)_libretro_tvos.dylib + MINVERSION := ifeq ($(DYNAREC),lightrec) # Override DYNAREC := 0 endif ifeq ($(DYNAREC),0) - TARGET := $(TARGET_NAME)_interpreter_libretro_ios.dylib + TARGET := $(TARGET_NAME)_interpreter_libretro_tvos.dylib endif fpic := -fPIC ifeq ($(IOSSDK),) - IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path) + IOSSDK := $(shell xcodebuild -version -sdk appletvos Path) endif - CC = clang -arch armv7 -isysroot $(IOSSDK) - CXX = clang++ -arch armv7 -isysroot $(IOSSDK) + CFLAGS += -DIOS -DTVOS -marm + CC = cc -arch arm64 -isysroot $(IOSSDK) + CXX = c++ -arch arm64 -isysroot $(IOSSDK) + ARCH := arm64 + HAVE_NEON = 0 + BUILTIN_GPU = peops + DYNAREC = 0 CC_AS = perl ./tools/gas-preprocessor.pl $(CC) - CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm - ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon - CFLAGS += -DIOS -ifeq ($(platform),ios9) - CC += -miphoneos-version-min=8.0 - CXX += -miphoneos-version-min=8.0 - CC_AS += -miphoneos-version-min=8.0 - CFLAGS += -miphoneos-version-min=8.0 -else - CC += -miphoneos-version-min=5.0 - CXX += -miphoneos-version-min=5.0 - CC_AS += -miphoneos-version-min=5.0 - CFLAGS += -miphoneos-version-min=5.0 -endif # Nintendo Switch (libnx) else ifeq ($(platform), libnx) diff --git a/frontend/libretro.c b/frontend/libretro.c index 59f1201..9aadb32 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -2772,7 +2772,7 @@ void retro_init(void) msg_interface_version = 0; environ_cb(RETRO_ENVIRONMENT_GET_MESSAGE_INTERFACE_VERSION, &msg_interface_version); -#ifdef __MACH__ +#if defined(__MACH__) && !defined(TVOS) // magic sauce to make the dynarec work on iOS syscall(SYS_ptrace, 0 /*PTRACE_TRACEME*/, 0, 0, 0); #endif -- cgit v1.2.3