mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
[Apple embedded] Adopt SwiftUI lifecycle for Apple embedded platforms
- Introduces a SCons builder for Swift files - Increases the minimum deployment targets to iOS 14.0, and visionOS 26.0. - Replaces manually UIWindow management by a SwiftUI instantiated app.
This commit is contained in:
parent
3bf0f771ee
commit
038f5934e7
29 changed files with 346 additions and 196 deletions
|
|
@ -638,35 +638,6 @@ String EditorExportPlatformAppleEmbedded::_process_config_file_line(const Ref<Ed
|
|||
}
|
||||
}
|
||||
strnew += p_line.replace("$pbx_locale_build_reference", locale_files);
|
||||
} else if (p_line.contains("$swift_runtime_migration")) {
|
||||
String value = !p_config.use_swift_runtime ? "" : "LastSwiftMigration = 1250;";
|
||||
strnew += p_line.replace("$swift_runtime_migration", value) + "\n";
|
||||
} else if (p_line.contains("$swift_runtime_build_settings")) {
|
||||
String value = !p_config.use_swift_runtime ? "" : R"(
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "$binary/dummy.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
)";
|
||||
value = value.replace("$binary", p_config.binary_name);
|
||||
strnew += p_line.replace("$swift_runtime_build_settings", value) + "\n";
|
||||
} else if (p_line.contains("$swift_runtime_fileref")) {
|
||||
String value = !p_config.use_swift_runtime ? "" : R"(
|
||||
90B4C2AA2680BC560039117A /* dummy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "dummy.h"; sourceTree = "<group>"; };
|
||||
90B4C2B52680C7E90039117A /* dummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "dummy.swift"; sourceTree = "<group>"; };
|
||||
)";
|
||||
strnew += p_line.replace("$swift_runtime_fileref", value) + "\n";
|
||||
} else if (p_line.contains("$swift_runtime_binary_files")) {
|
||||
String value = !p_config.use_swift_runtime ? "" : R"(
|
||||
90B4C2AA2680BC560039117A /* dummy.h */,
|
||||
90B4C2B52680C7E90039117A /* dummy.swift */,
|
||||
)";
|
||||
strnew += p_line.replace("$swift_runtime_binary_files", value) + "\n";
|
||||
} else if (p_line.contains("$swift_runtime_buildfile")) {
|
||||
String value = !p_config.use_swift_runtime ? "" : "90B4C2B62680C7E90039117A /* dummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90B4C2B52680C7E90039117A /* dummy.swift */; };";
|
||||
strnew += p_line.replace("$swift_runtime_buildfile", value) + "\n";
|
||||
} else if (p_line.contains("$swift_runtime_build_phase")) {
|
||||
String value = !p_config.use_swift_runtime ? "" : "90B4C2B62680C7E90039117A /* dummy.swift */,";
|
||||
strnew += p_line.replace("$swift_runtime_build_phase", value) + "\n";
|
||||
} else if (p_line.contains("$priv_collection")) {
|
||||
bool section_opened = false;
|
||||
for (uint64_t j = 0; j < std::size(data_collect_type_info); ++j) {
|
||||
|
|
@ -1566,10 +1537,6 @@ Error EditorExportPlatformAppleEmbedded::_export_apple_embedded_plugins(const Re
|
|||
|
||||
plugin_initialization_cpp_code += "\t" + initialization_method;
|
||||
plugin_deinitialization_cpp_code += "\t" + deinitialization_method;
|
||||
|
||||
if (plugin.use_swift_runtime) {
|
||||
p_config_data.use_swift_runtime = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Updating `Info.plist`
|
||||
|
|
@ -1819,7 +1786,6 @@ Error EditorExportPlatformAppleEmbedded::_export_project_helper(const Ref<Editor
|
|||
"",
|
||||
"",
|
||||
Vector<String>(),
|
||||
false
|
||||
};
|
||||
|
||||
config_data.plist_content += p_preset->get("application/additional_plist_content").operator String() + "\n";
|
||||
|
|
|
|||
|
|
@ -142,7 +142,6 @@ protected:
|
|||
String modules_buildphase;
|
||||
String modules_buildgrp;
|
||||
Vector<String> capabilities;
|
||||
bool use_swift_runtime;
|
||||
};
|
||||
|
||||
struct CodeSigningDetails {
|
||||
|
|
|
|||
|
|
@ -184,7 +184,6 @@ PluginConfigAppleEmbedded PluginConfigAppleEmbedded::load_plugin_config(Ref<Conf
|
|||
String config_base_dir = path.get_base_dir();
|
||||
|
||||
plugin_config.name = config_file->get_value(PluginConfigAppleEmbedded::CONFIG_SECTION, PluginConfigAppleEmbedded::CONFIG_NAME_KEY, String());
|
||||
plugin_config.use_swift_runtime = config_file->get_value(PluginConfigAppleEmbedded::CONFIG_SECTION, PluginConfigAppleEmbedded::CONFIG_USE_SWIFT_KEY, false);
|
||||
plugin_config.initialization_method = config_file->get_value(PluginConfigAppleEmbedded::CONFIG_SECTION, PluginConfigAppleEmbedded::CONFIG_INITIALIZE_KEY, String());
|
||||
plugin_config.deinitialization_method = config_file->get_value(PluginConfigAppleEmbedded::CONFIG_SECTION, PluginConfigAppleEmbedded::CONFIG_DEINITIALIZE_KEY, String());
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
The `config` section and fields are required and defined as follow:
|
||||
- **name**: name of the plugin
|
||||
- **binary**: path to static `.a` library
|
||||
- **use_swift_runtime**: optional boolean field used to determine if Swift runtime is used
|
||||
|
||||
The `dependencies` and fields are optional.
|
||||
- **linked**: dependencies that should only be linked.
|
||||
|
|
@ -56,7 +55,6 @@ struct PluginConfigAppleEmbedded {
|
|||
inline static const char *CONFIG_SECTION = "config";
|
||||
inline static const char *CONFIG_NAME_KEY = "name";
|
||||
inline static const char *CONFIG_BINARY_KEY = "binary";
|
||||
inline static const char *CONFIG_USE_SWIFT_KEY = "use_swift_runtime";
|
||||
inline static const char *CONFIG_INITIALIZE_KEY = "initialization";
|
||||
inline static const char *CONFIG_DEINITIALIZE_KEY = "deinitialization";
|
||||
|
||||
|
|
@ -93,7 +91,6 @@ struct PluginConfigAppleEmbedded {
|
|||
// Required config section
|
||||
String name;
|
||||
String binary;
|
||||
bool use_swift_runtime;
|
||||
String initialization_method;
|
||||
String deinitialization_method;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue