Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Allow compiling with min macOS version up to 14

Aaron Franke2fcdd51521d9
diff --git a/modules/camera/camera_apple.mm b/modules/camera/camera_apple.mm
index 9acb93ce4c0..409cf8ff2da 100644
--- a/modules/camera/camera_apple.mm
+++ b/modules/camera/camera_apple.mm
@@ -483,7 +483,9 @@ void CameraApple::update_feeds() {
if (@available(macOS 14.0, *)) {
session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:[NSArray arrayWithObjects:AVCaptureDeviceTypeExternal, AVCaptureDeviceTypeBuiltInWideAngleCamera, AVCaptureDeviceTypeContinuityCamera, nil] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];
} else {
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 140000
session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:[NSArray arrayWithObjects:AVCaptureDeviceTypeExternalUnknown, AVCaptureDeviceTypeBuiltInWideAngleCamera, nil] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];
+#endif
}
devices = session.devices;
#endif // APPLE_EMBEDDED_ENABLED
diff --git a/platform/macos/godot_application.mm b/platform/macos/godot_application.mm
index 9d30313d778..91e372697e3 100644
--- a/platform/macos/godot_application.mm
+++ b/platform/macos/godot_application.mm
@@ -169,6 +169,11 @@ GodotApplication *GodotApp = nil;
}
}
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000
+// This option was deprecated in macOS 14.0, replace it with 0 (no options) when min version is 14.0 or higher.
+#define NSApplicationActivateIgnoringOtherApps 0
+#endif
+
- (void)forceUnbundledWindowActivationHackStep1 {
// Step 1: Switch focus to macOS SystemUIServer process.
// Required to perform step 2, TransformProcessType will fail if app is already the in focus.
@@ -193,4 +198,8 @@ GodotApplication *GodotApp = nil;
[[NSRunningApplication currentApplication] activateWithOptions:NSApplicationActivateIgnoringOtherApps];
}
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000
+#undef NSApplicationActivateIgnoringOtherApps
+#endif
+
@end
diff --git a/platform/macos/os_macos.mm b/platform/macos/os_macos.mm
index e8997cc418e..120a14408cf 100644
--- a/platform/macos/os_macos.mm
+++ b/platform/macos/os_macos.mm
@@ -933,7 +933,7 @@ String OS_MacOS::get_unique_id() const {
static String serial_number;
if (serial_number.is_empty()) {
-#if defined(__x86_64) || defined(__x86_64__)
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 120000
io_service_t platform_expert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
#else
io_service_t platform_expert = IOServiceGetMatchingService(kIOMainPortDefault, IOServiceMatching("IOPlatformExpertDevice"));