Generate Xcode project which can support both iOS and iOS Simulator

This commit is contained in:
Edward Li 2024-12-29 04:03:32 +08:00 committed by flyinghead
parent c94deaee9d
commit 8dc55721d0
5 changed files with 21 additions and 4 deletions

View File

@ -21,6 +21,7 @@ if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum macOS deployment version")
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "")
endif()
set(ZLIB_LIBRARY "-lz" CACHE STRING "Use generic linker flag for Xcode to support multiple SDKs")
endif()
if(LIBRETRO)

View File

@ -36,10 +36,16 @@
#error Unsupported architecture
#endif
#if defined(TARGET_IPHONE) && !defined(__aarch64__)
#if defined(__APPLE__)
#include "TargetConditionals.h"
#if defined(TARGET_OS_SIMULATOR)
// iOS simulator
#define TARGET_NO_REC
#endif
#if defined(TARGET_MAC) && HOST_CPU == CPU_ARM64
#define TARGET_ARM_MAC
#endif
#endif
#if defined(TARGET_NO_REC)
#define FEAT_SHREC DYNAREC_NONE

View File

@ -56,8 +56,7 @@ int darw_printf(const char* Text,...);
#endif
#ifndef TARGET_IPHONE
#if defined(__APPLE__) && defined(__MACH__) && HOST_CPU == CPU_ARM64
#define TARGET_ARM_MAC
#if defined(TARGET_ARM_MAC)
#include <pthread.h>
inline static void JITWriteProtect(bool enabled) {
if (__builtin_available(macOS 11.0, *))

View File

@ -323,6 +323,13 @@ static void updateAudioSession(Event event, void *)
}
settings.display.dpi = 160.f * scale;
initRenderApi();
#if defined(TARGET_OS_SIMULATOR) && HOST_CPU == CPU_ARM64
if (config::RendererType.get() == RenderType::OpenGL)
{
NSLog(@"🚨🚨🚨 OpenGL renderer is not supported in Apple Silicon Mac 🚨🚨🚨\n");
raise(SIGTRAP);
}
#endif
mainui_init();
[self altKitStart];

View File

@ -6,7 +6,11 @@ echo "2) iOS"
read -p "Choose your target platform: " x
if [ $x -eq 2 ]; then
option="-DCMAKE_SYSTEM_NAME=iOS"
if [ "$(uname -m)" = "arm64" ]; then
option="-DCMAKE_SYSTEM_NAME=iOS"
else
option="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64;x86_64"
fi
lldbinitfolder="emulator-ios"
echo 'Building iOS xcodeproj for debugging'
echo 'Remove CODE_SIGNING_ALLOWED=NO in Build Settings if you are using your Apple Developer Certificate for signing'