Skip to content

Commit

Permalink
Generate Xcode project which can support both iOS and iOS Simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
vkedwardli authored and flyinghead committed Dec 30, 2024
1 parent 2f03c1b commit f3a3364
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion core/build.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions core/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,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, *))
Expand Down
7 changes: 7 additions & 0 deletions shell/apple/emulator-ios/emulator/FlycastViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,13 @@ - (void)viewDidLoad
}
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];
Expand Down
6 changes: 5 additions & 1 deletion shell/apple/generate_xcode_project.command
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit f3a3364

Please sign in to comment.