mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Merge pull request #109974 from rsanchezsaez/apple/swiftui-lifecycle
SwiftUI lifecycle for Apple embedded platforms
This commit is contained in:
commit
cf3c00056c
29 changed files with 346 additions and 196 deletions
|
|
@ -25,8 +25,8 @@ def get_opts():
|
|||
|
||||
return [
|
||||
# APPLE_TOOLCHAIN_PATH Example: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
|
||||
(("APPLE_TOOLCHAIN_PATH", "IOS_TOOLCHAIN_PATH"), "Path to the Apple toolchain", ""),
|
||||
("VISIONOS_SDK_PATH", "Path to the visionOS SDK", ""),
|
||||
("APPLE_TOOLCHAIN_PATH", "Path to the Apple toolchain", ""),
|
||||
(("APPLE_SDK_PATH", "VISIONOS_SDK_PATH"), "Path to the visionOS SDK", ""),
|
||||
("apple_target_triple", "Triple for corresponding target Apple platform toolchain", ""),
|
||||
BoolVariable("simulator", "Build for Simulator", False),
|
||||
BoolVariable("generate_bundle", "Generate an APP bundle after building visionOS/macOS binaries", False),
|
||||
|
|
@ -102,15 +102,16 @@ def configure(env: "SConsEnvironment"):
|
|||
## Compile flags
|
||||
|
||||
if env["simulator"]:
|
||||
detect_darwin_sdk_path("visionossimulator", env)
|
||||
env.Append(ASFLAGS=["-mtargetos=xros2.0-simulator"])
|
||||
env.Append(CCFLAGS=["-mtargetos=xros2.0-simulator"])
|
||||
env["APPLE_PLATFORM"] = "visionossimulator"
|
||||
env.Append(ASFLAGS=["-mtargetos=xros26.0-simulator"])
|
||||
env.Append(CCFLAGS=["-mtargetos=xros26.0-simulator"])
|
||||
env.Append(CPPDEFINES=["VISIONOS_SIMULATOR"])
|
||||
env.extra_suffix = ".simulator" + env.extra_suffix
|
||||
else:
|
||||
detect_darwin_sdk_path("visionos", env)
|
||||
env.Append(ASFLAGS=["-mtargetos=xros2.0"])
|
||||
env.Append(CCFLAGS=["-mtargetos=xros2.0"])
|
||||
env["APPLE_PLATFORM"] = "visionos"
|
||||
env.Append(ASFLAGS=["-mtargetos=xros26.0"])
|
||||
env.Append(CCFLAGS=["-mtargetos=xros26.0"])
|
||||
detect_darwin_sdk_path(env["APPLE_PLATFORM"], env)
|
||||
|
||||
if env["arch"] == "arm64":
|
||||
env.Append(
|
||||
|
|
@ -118,7 +119,7 @@ def configure(env: "SConsEnvironment"):
|
|||
"-fobjc-arc -arch arm64 -fmessage-length=0"
|
||||
" -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits"
|
||||
" -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies"
|
||||
" -isysroot $VISIONOS_SDK_PATH".split()
|
||||
" -isysroot $APPLE_SDK_PATH".split()
|
||||
)
|
||||
)
|
||||
env.Append(ASFLAGS=["-arch", "arm64"])
|
||||
|
|
@ -128,8 +129,8 @@ def configure(env: "SConsEnvironment"):
|
|||
|
||||
env.Prepend(
|
||||
CPPPATH=[
|
||||
"$VISIONOS_SDK_PATH/usr/include",
|
||||
"$VISIONOS_SDK_PATH/System/Library/Frameworks/AudioUnit.framework/Headers",
|
||||
"$APPLE_SDK_PATH/usr/include",
|
||||
"$APPLE_SDK_PATH/System/Library/Frameworks/AudioUnit.framework/Headers",
|
||||
]
|
||||
)
|
||||
|
||||
|
|
@ -148,9 +149,9 @@ def configure(env: "SConsEnvironment"):
|
|||
env.AppendUnique(CPPDEFINES=["METAL_ENABLED", "RD_ENABLED"])
|
||||
env.Prepend(
|
||||
CPPPATH=[
|
||||
"$VISIONOS_SDK_PATH/System/Library/Frameworks/Metal.framework/Headers",
|
||||
"$VISIONOS_SDK_PATH/System/Library/Frameworks/MetalFX.framework/Headers",
|
||||
"$VISIONOS_SDK_PATH/System/Library/Frameworks/QuartzCore.framework/Headers",
|
||||
"$APPLE_SDK_PATH/System/Library/Frameworks/Metal.framework/Headers",
|
||||
"$APPLE_SDK_PATH/System/Library/Frameworks/MetalFX.framework/Headers",
|
||||
"$APPLE_SDK_PATH/System/Library/Frameworks/QuartzCore.framework/Headers",
|
||||
]
|
||||
)
|
||||
env.Prepend(CPPPATH=["#thirdparty/spirv-cross"])
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class EditorExportPlatformVisionOS : public EditorExportPlatformAppleEmbedded {
|
|||
virtual String get_sdk_name() const override { return "xros"; }
|
||||
virtual const Vector<String> get_device_types() const override { return device_types; }
|
||||
|
||||
virtual String get_minimum_deployment_target() const override { return "2.0"; }
|
||||
virtual String get_minimum_deployment_target() const override { return "26.0"; }
|
||||
|
||||
virtual Vector<EditorExportPlatformAppleEmbedded::IconInfo> get_icon_infos() const override;
|
||||
|
||||
|
|
|
|||
|
|
@ -76,5 +76,7 @@ GODOT_CLANG_WARNING_POP
|
|||
@end
|
||||
|
||||
GDTView *GDTViewCreate() {
|
||||
return [GDTViewVisionOS new];
|
||||
GDTViewVisionOS *view = [GDTViewVisionOS new];
|
||||
view.preferredFrameRate = 90;
|
||||
return view;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,27 +37,8 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
#include <cstdio>
|
||||
|
||||
int gargc;
|
||||
char **gargv;
|
||||
|
||||
static OS_VisionOS *os = nullptr;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
#if defined(VULKAN_ENABLED)
|
||||
//MoltenVK - enable full component swizzling support
|
||||
setenv("MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE", "1", 1);
|
||||
#endif
|
||||
|
||||
gargc = argc;
|
||||
gargv = argv;
|
||||
|
||||
@autoreleasepool {
|
||||
NSString *className = NSStringFromClass([GDTApplicationDelegate class]);
|
||||
UIApplicationMain(argc, argv, nil, className);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int apple_embedded_main(int argc, char **argv) {
|
||||
change_to_launch_dir(argv);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue