mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +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
|
|
@ -27,7 +27,7 @@ def get_opts():
|
|||
("vulkan_sdk_path", "Path to the Vulkan SDK", ""),
|
||||
# APPLE_TOOLCHAIN_PATH Example: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
|
||||
(("APPLE_TOOLCHAIN_PATH", "IOS_TOOLCHAIN_PATH"), "Path to the Apple toolchain", ""),
|
||||
("IOS_SDK_PATH", "Path to the iOS SDK", ""),
|
||||
(("APPLE_SDK_PATH", "IOS_SDK_PATH"), "Path to the iOS SDK", ""),
|
||||
(("apple_target_triple", "ios_triple"), "Triple for the corresponding target Apple platform toolchain", ""),
|
||||
BoolVariable(("simulator", "ios_simulator"), "Build for Simulator", False),
|
||||
BoolVariable("generate_bundle", "Generate an APP bundle after building iOS/macOS binaries", False),
|
||||
|
|
@ -101,15 +101,16 @@ def configure(env: "SConsEnvironment"):
|
|||
## Compile flags
|
||||
|
||||
if env["simulator"]:
|
||||
detect_darwin_sdk_path("iossimulator", env)
|
||||
env.Append(ASFLAGS=["-mios-simulator-version-min=12.0"])
|
||||
env.Append(CCFLAGS=["-mios-simulator-version-min=12.0"])
|
||||
env["APPLE_PLATFORM"] = "iossimulator"
|
||||
env.Append(ASFLAGS=["-mios-simulator-version-min=14.0"])
|
||||
env.Append(CCFLAGS=["-mios-simulator-version-min=14.0"])
|
||||
env.Append(CPPDEFINES=["IOS_SIMULATOR"])
|
||||
env.extra_suffix = ".simulator" + env.extra_suffix
|
||||
else:
|
||||
detect_darwin_sdk_path("ios", env)
|
||||
env.Append(ASFLAGS=["-miphoneos-version-min=12.0"])
|
||||
env.Append(CCFLAGS=["-miphoneos-version-min=12.0"])
|
||||
env["APPLE_PLATFORM"] = "ios"
|
||||
env.Append(ASFLAGS=["-miphoneos-version-min=14.0"])
|
||||
env.Append(CCFLAGS=["-miphoneos-version-min=14.0"])
|
||||
detect_darwin_sdk_path(env["APPLE_PLATFORM"], env)
|
||||
|
||||
if env["arch"] == "x86_64":
|
||||
if not env["simulator"]:
|
||||
|
|
@ -121,7 +122,7 @@ def configure(env: "SConsEnvironment"):
|
|||
CCFLAGS=(
|
||||
"-fobjc-arc -arch x86_64"
|
||||
" -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fblocks"
|
||||
" -fasm-blocks -isysroot $IOS_SDK_PATH"
|
||||
" -fasm-blocks -isysroot $APPLE_SDK_PATH"
|
||||
).split()
|
||||
)
|
||||
env.Append(ASFLAGS=["-arch", "x86_64"])
|
||||
|
|
@ -131,7 +132,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 $IOS_SDK_PATH".split()
|
||||
" -isysroot $APPLE_SDK_PATH".split()
|
||||
)
|
||||
)
|
||||
env.Append(ASFLAGS=["-arch", "arm64"])
|
||||
|
|
@ -141,8 +142,8 @@ def configure(env: "SConsEnvironment"):
|
|||
|
||||
env.Prepend(
|
||||
CPPPATH=[
|
||||
"$IOS_SDK_PATH/usr/include",
|
||||
"$IOS_SDK_PATH/System/Library/Frameworks/AudioUnit.framework/Headers",
|
||||
"$APPLE_SDK_PATH/usr/include",
|
||||
"$APPLE_SDK_PATH/System/Library/Frameworks/AudioUnit.framework/Headers",
|
||||
]
|
||||
)
|
||||
|
||||
|
|
@ -157,9 +158,9 @@ def configure(env: "SConsEnvironment"):
|
|||
env.AppendUnique(CPPDEFINES=["METAL_ENABLED", "RD_ENABLED"])
|
||||
env.Prepend(
|
||||
CPPPATH=[
|
||||
"$IOS_SDK_PATH/System/Library/Frameworks/Metal.framework/Headers",
|
||||
"$IOS_SDK_PATH/System/Library/Frameworks/MetalFX.framework/Headers",
|
||||
"$IOS_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(CPPEXTPATH=["#thirdparty/spirv-cross"])
|
||||
|
|
@ -176,6 +177,6 @@ def configure(env: "SConsEnvironment"):
|
|||
env.Append(CCFLAGS=["-Wno-module-import-in-extern-c"])
|
||||
env.Prepend(
|
||||
CPPPATH=[
|
||||
"$IOS_SDK_PATH/System/Library/Frameworks/OpenGLES.framework/Headers",
|
||||
"$APPLE_SDK_PATH/System/Library/Frameworks/OpenGLES.framework/Headers",
|
||||
]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#import "display_layer_ios.h"
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/error/error_macros.h"
|
||||
|
||||
@interface GDTViewIOS ()
|
||||
|
|
@ -83,5 +84,11 @@ GODOT_CLANG_WARNING_POP
|
|||
@end
|
||||
|
||||
GDTView *GDTViewCreate() {
|
||||
return [GDTViewIOS new];
|
||||
GDTViewIOS *view = [GDTViewIOS new];
|
||||
if (GLOBAL_GET("display/window/ios/allow_high_refresh_rate")) {
|
||||
view.preferredFrameRate = 120;
|
||||
} else {
|
||||
view.preferredFrameRate = 60;
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,28 +37,14 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
#include <cstdio>
|
||||
|
||||
int gargc;
|
||||
char **gargv;
|
||||
|
||||
static OS_IOS *os = nullptr;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int apple_embedded_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);
|
||||
|
||||
os = new OS_IOS();
|
||||
|
|
|
|||
|
|
@ -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