From 9308d20d1b33d96b1ec59080ef83dbfd3282ecb6 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Wed, 27 Sep 2023 21:15:17 +0300 Subject: [PATCH] [iOS] Fix build with Xcode 15. (cherry picked from commit e1c7104e46fd3d2f97d365cb4b816b9c78e9e5df) --- .../godot_ios.xcodeproj/project.pbxproj | 12 +++++------ platform/ios/detect.py | 10 +++++----- platform/ios/display_server_ios.mm | 20 ++++++++----------- platform/ios/godot_view.mm | 6 +++--- platform/ios/view_controller.mm | 4 +--- 5 files changed, 23 insertions(+), 29 deletions(-) diff --git a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj index 09e8bf4cc74..cc2b1c64f88 100644 --- a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj +++ b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj @@ -254,8 +254,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; - OTHER_LDFLAGS = "$linker_flags"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + OTHER_LDFLAGS = "-ld_classic $linker_flags"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "$targeted_device_family"; }; @@ -293,8 +293,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; - OTHER_LDFLAGS = "$linker_flags"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + OTHER_LDFLAGS = "-ld_classic $linker_flags"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "$targeted_device_family"; VALIDATE_PRODUCT = YES; @@ -314,7 +314,7 @@ CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; DEVELOPMENT_TEAM = $team_id; INFOPLIST_FILE = "$binary/$binary-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -350,7 +350,7 @@ CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; DEVELOPMENT_TEAM = $team_id; INFOPLIST_FILE = "$binary/$binary-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/platform/ios/detect.py b/platform/ios/detect.py index e11c0b7d917..40eb61abc8e 100644 --- a/platform/ios/detect.py +++ b/platform/ios/detect.py @@ -103,13 +103,13 @@ def configure(env: "Environment"): if env["ios_simulator"]: detect_darwin_sdk_path("iossimulator", env) - env.Append(ASFLAGS=["-mios-simulator-version-min=11.0"]) - env.Append(CCFLAGS=["-mios-simulator-version-min=11.0"]) + env.Append(ASFLAGS=["-mios-simulator-version-min=12.0"]) + env.Append(CCFLAGS=["-mios-simulator-version-min=12.0"]) env.extra_suffix = ".simulator" + env.extra_suffix else: detect_darwin_sdk_path("ios", env) - env.Append(ASFLAGS=["-miphoneos-version-min=11.0"]) - env.Append(CCFLAGS=["-miphoneos-version-min=11.0"]) + env.Append(ASFLAGS=["-miphoneos-version-min=12.0"]) + env.Append(CCFLAGS=["-miphoneos-version-min=12.0"]) if env["arch"] == "x86_64": if not env["ios_simulator"]: @@ -154,7 +154,7 @@ def configure(env: "Environment"): env.Append(CPPDEFINES=["VULKAN_ENABLED"]) if env["opengl3"]: - env.Append(CPPDEFINES=["GLES3_ENABLED"]) + env.Append(CPPDEFINES=["GLES3_ENABLED", "GLES_SILENCE_DEPRECATION"]) env.Prepend( CPPPATH=[ "$IOS_SDK_PATH/System/Library/Frameworks/OpenGLES.framework/Headers", diff --git a/platform/ios/display_server_ios.mm b/platform/ios/display_server_ios.mm index 7d91274a0c5..108d674957b 100644 --- a/platform/ios/display_server_ios.mm +++ b/platform/ios/display_server_ios.mm @@ -355,19 +355,15 @@ void DisplayServerIOS::tts_stop() { } Rect2i DisplayServerIOS::get_display_safe_area() const { - if (@available(iOS 11, *)) { - UIEdgeInsets insets = UIEdgeInsetsZero; - UIView *view = AppDelegate.viewController.godotView; - if ([view respondsToSelector:@selector(safeAreaInsets)]) { - insets = [view safeAreaInsets]; - } - float scale = screen_get_scale(); - Size2i insets_position = Size2i(insets.left, insets.top) * scale; - Size2i insets_size = Size2i(insets.left + insets.right, insets.top + insets.bottom) * scale; - return Rect2i(screen_get_position() + insets_position, screen_get_size() - insets_size); - } else { - return Rect2i(screen_get_position(), screen_get_size()); + UIEdgeInsets insets = UIEdgeInsetsZero; + UIView *view = AppDelegate.viewController.godotView; + if ([view respondsToSelector:@selector(safeAreaInsets)]) { + insets = [view safeAreaInsets]; } + float scale = screen_get_scale(); + Size2i insets_position = Size2i(insets.left, insets.top) * scale; + Size2i insets_size = Size2i(insets.left + insets.right, insets.top + insets.bottom) * scale; + return Rect2i(screen_get_position() + insets_position, screen_get_size() - insets_size); } int DisplayServerIOS::get_screen_count() const { diff --git a/platform/ios/godot_view.mm b/platform/ios/godot_view.mm index 4c9a75fdc0b..ff8a4f89213 100644 --- a/platform/ios/godot_view.mm +++ b/platform/ios/godot_view.mm @@ -82,10 +82,10 @@ static const float earth_gravity = 9.80665; layer = [GodotMetalLayer layer]; #endif } else if ([driverName isEqualToString:@"opengl3"]) { - if (@available(iOS 13, *)) { - NSLog(@"OpenGL ES is deprecated on iOS 13"); - } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" // OpenGL is deprecated in iOS 12.0 layer = [GodotOpenGLLayer layer]; +#pragma clang diagnostic pop } else { return nil; } diff --git a/platform/ios/view_controller.mm b/platform/ios/view_controller.mm index 0ef61da6465..1f55670b683 100644 --- a/platform/ios/view_controller.mm +++ b/platform/ios/view_controller.mm @@ -161,9 +161,7 @@ [self observeKeyboard]; [self displayLoadingOverlay]; - if (@available(iOS 11.0, *)) { - [self setNeedsUpdateOfScreenEdgesDeferringSystemGestures]; - } + [self setNeedsUpdateOfScreenEdgesDeferringSystemGestures]; } - (void)observeKeyboard {