[macOS] Add support for the Apple Silicon (ARM64) build target.
This commit is contained in:
parent
9fc65fd1f1
commit
00299f15b4
8 changed files with 52 additions and 14 deletions
10
misc/dist/osx_template.app/Contents/Info.plist
vendored
10
misc/dist/osx_template.app/Contents/Info.plist
vendored
|
@ -30,12 +30,18 @@
|
||||||
<string>$camera_usage_description</string>
|
<string>$camera_usage_description</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>$copyright</string>
|
<string>$copyright</string>
|
||||||
|
<key>CFBundleSupportedPlatforms</key>
|
||||||
|
<array>
|
||||||
|
<string>MacOSX</string>
|
||||||
|
</array>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>10.12.0</string>
|
<string>10.12</string>
|
||||||
<key>LSMinimumSystemVersionByArchitecture</key>
|
<key>LSMinimumSystemVersionByArchitecture</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>x86_64</key>
|
<key>x86_64</key>
|
||||||
<string>10.12.0</string>
|
<string>10.12</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>NSHighResolutionCapable</key>
|
<key>NSHighResolutionCapable</key>
|
||||||
$highres
|
$highres
|
||||||
|
|
12
misc/dist/osx_tools.app/Contents/Info.plist
vendored
12
misc/dist/osx_tools.app/Contents/Info.plist
vendored
|
@ -29,15 +29,21 @@
|
||||||
<key>NSCameraUsageDescription</key>
|
<key>NSCameraUsageDescription</key>
|
||||||
<string>Camera access is required to capture video.</string>
|
<string>Camera access is required to capture video.</string>
|
||||||
<key>NSRequiresAquaSystemAppearance</key>
|
<key>NSRequiresAquaSystemAppearance</key>
|
||||||
<false />
|
<false/>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>© 2007-2020 Juan Linietsky, Ariel Manzur & Godot Engine contributors</string>
|
<string>© 2007-2020 Juan Linietsky, Ariel Manzur & Godot Engine contributors</string>
|
||||||
|
<key>CFBundleSupportedPlatforms</key>
|
||||||
|
<array>
|
||||||
|
<string>MacOSX</string>
|
||||||
|
</array>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>10.12.0</string>
|
<string>10.12</string>
|
||||||
<key>LSMinimumSystemVersionByArchitecture</key>
|
<key>LSMinimumSystemVersionByArchitecture</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>x86_64</key>
|
<key>x86_64</key>
|
||||||
<string>10.12.0</string>
|
<string>10.12</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>NSHighResolutionCapable</key>
|
<key>NSHighResolutionCapable</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
|
|
@ -313,7 +313,12 @@ MyDeviceNotifications *device_notifications = nil;
|
||||||
// CameraOSX - Subclass for our camera server on OSX
|
// CameraOSX - Subclass for our camera server on OSX
|
||||||
|
|
||||||
void CameraOSX::update_feeds() {
|
void CameraOSX::update_feeds() {
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
|
||||||
|
AVCaptureDeviceDiscoverySession *session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:[NSArray arrayWithObjects:AVCaptureDeviceTypeExternalUnknown, AVCaptureDeviceTypeBuiltInWideAngleCamera, nil] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];
|
||||||
|
NSArray *devices = session.devices;
|
||||||
|
#else
|
||||||
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
|
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
|
||||||
|
#endif
|
||||||
|
|
||||||
// remove devices that are gone..
|
// remove devices that are gone..
|
||||||
for (int i = feeds.size() - 1; i >= 0; i--) {
|
for (int i = feeds.size() - 1; i >= 0; i--) {
|
||||||
|
@ -325,7 +330,6 @@ void CameraOSX::update_feeds() {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// add new devices..
|
|
||||||
for (AVCaptureDevice *device in devices) {
|
for (AVCaptureDevice *device in devices) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (int i = 0; i < feeds.size() && !found; i++) {
|
for (int i = 0; i < feeds.size() && !found; i++) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ def can_build(env, platform):
|
||||||
# as doing lightmap generation and denoising on Android or HTML5
|
# as doing lightmap generation and denoising on Android or HTML5
|
||||||
# would be a bit far-fetched.
|
# would be a bit far-fetched.
|
||||||
desktop_platforms = ["linuxbsd", "osx", "windows"]
|
desktop_platforms = ["linuxbsd", "osx", "windows"]
|
||||||
return env["tools"] and platform in desktop_platforms and env["bits"] == "64"
|
return env["tools"] and platform in desktop_platforms and env["bits"] == "64" and env["arch"] != "arm64"
|
||||||
|
|
||||||
|
|
||||||
def configure(env):
|
def configure(env):
|
||||||
|
|
|
@ -227,6 +227,9 @@ if env["builtin_opus"]:
|
||||||
env_opus.Append(CPPDEFINES=["OPUS_ARM_OPT"])
|
env_opus.Append(CPPDEFINES=["OPUS_ARM_OPT"])
|
||||||
elif "arch" in env and env["arch"] == "arm64":
|
elif "arch" in env and env["arch"] == "arm64":
|
||||||
env_opus.Append(CPPDEFINES=["OPUS_ARM64_OPT"])
|
env_opus.Append(CPPDEFINES=["OPUS_ARM64_OPT"])
|
||||||
|
elif env["platform"] == "osx":
|
||||||
|
if "arch" in env and env["arch"] == "arm64":
|
||||||
|
env_opus.Append(CPPDEFINES=["OPUS_ARM64_OPT"])
|
||||||
|
|
||||||
env_thirdparty = env_opus.Clone()
|
env_thirdparty = env_opus.Clone()
|
||||||
env_thirdparty.disable_warnings()
|
env_thirdparty.disable_warnings()
|
||||||
|
|
|
@ -238,6 +238,7 @@ else:
|
||||||
is_x11_or_server_arm = (env["platform"] == "linuxbsd" or env["platform"] == "server") and (
|
is_x11_or_server_arm = (env["platform"] == "linuxbsd" or env["platform"] == "server") and (
|
||||||
platform.machine().startswith("arm") or platform.machine().startswith("aarch")
|
platform.machine().startswith("arm") or platform.machine().startswith("aarch")
|
||||||
)
|
)
|
||||||
|
is_macos_x86 = env["platform"] == "osx" and ("arch" in env and (env["arch"] != "arm64"))
|
||||||
is_ios_x86 = env["platform"] == "iphone" and ("arch" in env and env["arch"].startswith("x86"))
|
is_ios_x86 = env["platform"] == "iphone" and ("arch" in env and env["arch"].startswith("x86"))
|
||||||
is_android_x86 = env["platform"] == "android" and env["android_arch"].startswith("x86")
|
is_android_x86 = env["platform"] == "android" and env["android_arch"].startswith("x86")
|
||||||
if is_android_x86:
|
if is_android_x86:
|
||||||
|
@ -248,14 +249,15 @@ else:
|
||||||
and (
|
and (
|
||||||
env["platform"] == "windows"
|
env["platform"] == "windows"
|
||||||
or env["platform"] == "linuxbsd"
|
or env["platform"] == "linuxbsd"
|
||||||
or env["platform"] == "osx"
|
|
||||||
or env["platform"] == "haiku"
|
or env["platform"] == "haiku"
|
||||||
|
or is_macos_x86
|
||||||
or is_android_x86
|
or is_android_x86
|
||||||
or is_ios_x86
|
or is_ios_x86
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
webm_cpu_arm = (
|
webm_cpu_arm = (
|
||||||
is_x11_or_server_arm
|
is_x11_or_server_arm
|
||||||
|
or (not is_macos_x86 and env["platform"] == "osx")
|
||||||
or (not is_ios_x86 and env["platform"] == "iphone")
|
or (not is_ios_x86 and env["platform"] == "iphone")
|
||||||
or (not is_android_x86 and env["platform"] == "android")
|
or (not is_android_x86 and env["platform"] == "android")
|
||||||
)
|
)
|
||||||
|
|
|
@ -87,8 +87,15 @@ def configure(env):
|
||||||
env["osxcross"] = True
|
env["osxcross"] = True
|
||||||
|
|
||||||
if not "osxcross" in env: # regular native build
|
if not "osxcross" in env: # regular native build
|
||||||
env.Append(CCFLAGS=["-arch", "x86_64"])
|
if env["arch"] == "arm64":
|
||||||
env.Append(LINKFLAGS=["-arch", "x86_64"])
|
print("Building for macOS 10.15+, platform arm64.")
|
||||||
|
env.Append(CCFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15", "-target", "arm64-apple-macos10.15"])
|
||||||
|
env.Append(LINKFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15", "-target", "arm64-apple-macos10.15"])
|
||||||
|
else:
|
||||||
|
print("Building for macOS 10.12+, platform x86-64.")
|
||||||
|
env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"])
|
||||||
|
env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"])
|
||||||
|
|
||||||
if env["macports_clang"] != "no":
|
if env["macports_clang"] != "no":
|
||||||
mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local")
|
mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local")
|
||||||
mpclangver = env["macports_clang"]
|
mpclangver = env["macports_clang"]
|
||||||
|
@ -148,7 +155,8 @@ def configure(env):
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
if env["builtin_libtheora"]:
|
if env["builtin_libtheora"]:
|
||||||
env["x86_libtheora_opt_gcc"] = True
|
if env["arch"] != "arm64":
|
||||||
|
env["x86_libtheora_opt_gcc"] = True
|
||||||
|
|
||||||
## Flags
|
## Flags
|
||||||
|
|
||||||
|
@ -189,6 +197,3 @@ def configure(env):
|
||||||
env.Append(LIBS=["vulkan"])
|
env.Append(LIBS=["vulkan"])
|
||||||
|
|
||||||
# env.Append(CPPDEFINES=['GLES_ENABLED', 'OPENGL_ENABLED'])
|
# env.Append(CPPDEFINES=['GLES_ENABLED', 'OPENGL_ENABLED'])
|
||||||
|
|
||||||
env.Append(CCFLAGS=["-mmacosx-version-min=10.12"])
|
|
||||||
env.Append(LINKFLAGS=["-mmacosx-version-min=10.12"])
|
|
||||||
|
|
|
@ -566,7 +566,11 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
|
||||||
trackingArea = nil;
|
trackingArea = nil;
|
||||||
imeInputEventInProgress = false;
|
imeInputEventInProgress = false;
|
||||||
[self updateTrackingAreas];
|
[self updateTrackingAreas];
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
|
||||||
|
[self registerForDraggedTypes:[NSArray arrayWithObject:NSPasteboardTypeFileURL]];
|
||||||
|
#else
|
||||||
[self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
|
[self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
|
||||||
|
#endif
|
||||||
markedText = [[NSMutableAttributedString alloc] init];
|
markedText = [[NSMutableAttributedString alloc] init];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -723,11 +727,19 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
||||||
DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id];
|
DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id];
|
||||||
|
|
||||||
NSPasteboard *pboard = [sender draggingPasteboard];
|
NSPasteboard *pboard = [sender draggingPasteboard];
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
|
||||||
|
NSArray<NSURL *> *filenames = [pboard propertyListForType:NSPasteboardTypeFileURL];
|
||||||
|
#else
|
||||||
NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType];
|
NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType];
|
||||||
|
#endif
|
||||||
|
|
||||||
Vector<String> files;
|
Vector<String> files;
|
||||||
for (NSUInteger i = 0; i < filenames.count; i++) {
|
for (NSUInteger i = 0; i < filenames.count; i++) {
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
|
||||||
|
NSString *ns = [[filenames objectAtIndex:i] path];
|
||||||
|
#else
|
||||||
NSString *ns = [filenames objectAtIndex:i];
|
NSString *ns = [filenames objectAtIndex:i];
|
||||||
|
#endif
|
||||||
char *utfs = strdup([ns UTF8String]);
|
char *utfs = strdup([ns UTF8String]);
|
||||||
String ret;
|
String ret;
|
||||||
ret.parse_utf8(utfs);
|
ret.parse_utf8(utfs);
|
||||||
|
|
Loading…
Reference in a new issue