[apple embedded] Replace individual iOS/visionOS Xcode templates by Apple embedded template

This commit is contained in:
Ricardo Sanchez-Saez
2025-06-30 20:02:21 -07:00
parent 3defc856b0
commit 6d9983e958
55 changed files with 609 additions and 1197 deletions

View File

@ -7,7 +7,7 @@ This platform derives from the Apple embedded abstract platform ([`drivers/apple
This platform uses shared Apple code ([`drivers/apple`](/drivers/apple)).
See also [`misc/dist/ios_xcode`](/misc/dist/ios_xcode) folder for the Xcode
See also [`misc/dist/apple_embedded_xcode`](/misc/dist/apple_embedded_xcode) folder for the Xcode
project template used for packaging the iOS export templates.
## Documentation

View File

@ -355,3 +355,105 @@ Error EditorExportPlatformIOS::_export_icons(const Ref<EditorExportPreset> &p_pr
return OK;
}
String EditorExportPlatformIOS::_process_config_file_line(const Ref<EditorExportPreset> &p_preset, const String &p_line, const AppleEmbeddedConfigData &p_config, bool p_debug, const CodeSigningDetails &p_code_signing) {
// Do iOS specific processing first, and call super implementation if there are no matches
String strnew;
// Supported Destinations
if (p_line.contains("$targeted_device_family")) {
String xcode_value;
switch ((int)p_preset->get("application/targeted_device_family")) {
case 0: // iPhone
xcode_value = "1";
break;
case 1: // iPad
xcode_value = "2";
break;
case 2: // iPhone & iPad
xcode_value = "1,2";
break;
}
strnew += p_line.replace("$targeted_device_family", xcode_value) + "\n";
// MoltenVK Framework
} else if (p_line.contains("$moltenvk_buildfile")) {
String value = "9039D3BE24C093AC0020482C /* MoltenVK.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9039D3BD24C093AC0020482C /* MoltenVK.xcframework */; };";
strnew += p_line.replace("$moltenvk_buildfile", value) + "\n";
} else if (p_line.contains("$moltenvk_fileref")) {
String value = "9039D3BD24C093AC0020482C /* MoltenVK.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MoltenVK; path = MoltenVK.xcframework; sourceTree = \"<group>\"; };";
strnew += p_line.replace("$moltenvk_fileref", value) + "\n";
} else if (p_line.contains("$moltenvk_buildphase")) {
String value = "9039D3BE24C093AC0020482C /* MoltenVK.xcframework in Frameworks */,";
strnew += p_line.replace("$moltenvk_buildphase", value) + "\n";
} else if (p_line.contains("$moltenvk_buildgrp")) {
String value = "9039D3BD24C093AC0020482C /* MoltenVK.xcframework */,";
strnew += p_line.replace("$moltenvk_buildgrp", value) + "\n";
// Launch Storyboard
} else if (p_line.contains("$plist_launch_screen_name")) {
String value = "<key>UILaunchStoryboardName</key>\n<string>Launch Screen</string>";
strnew += p_line.replace("$plist_launch_screen_name", value) + "\n";
} else if (p_line.contains("$pbx_launch_screen_file_reference")) {
String value = "90DD2D9D24B36E8000717FE1 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = \"Launch Screen.storyboard\"; sourceTree = \"<group>\"; };";
strnew += p_line.replace("$pbx_launch_screen_file_reference", value) + "\n";
} else if (p_line.contains("$pbx_launch_screen_copy_files")) {
String value = "90DD2D9D24B36E8000717FE1 /* Launch Screen.storyboard */,";
strnew += p_line.replace("$pbx_launch_screen_copy_files", value) + "\n";
} else if (p_line.contains("$pbx_launch_screen_build_phase")) {
String value = "90DD2D9E24B36E8000717FE1 /* Launch Screen.storyboard in Resources */,";
strnew += p_line.replace("$pbx_launch_screen_build_phase", value) + "\n";
} else if (p_line.contains("$pbx_launch_screen_build_reference")) {
String value = "90DD2D9E24B36E8000717FE1 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 90DD2D9D24B36E8000717FE1 /* Launch Screen.storyboard */; };";
strnew += p_line.replace("$pbx_launch_screen_build_reference", value) + "\n";
// Launch Storyboard customization
} else if (p_line.contains("$launch_screen_image_mode")) {
int image_scale_mode = p_preset->get("storyboard/image_scale_mode");
String value;
switch (image_scale_mode) {
case 0: {
String logo_path = get_project_setting(p_preset, "application/boot_splash/image");
bool is_on = get_project_setting(p_preset, "application/boot_splash/fullsize");
// If custom logo is not specified, Godot does not scale default one, so we should do the same.
value = (is_on && logo_path.length() > 0) ? "scaleAspectFit" : "center";
} break;
default: {
value = storyboard_image_scale_mode[image_scale_mode - 1];
}
}
strnew += p_line.replace("$launch_screen_image_mode", value) + "\n";
} else if (p_line.contains("$launch_screen_background_color")) {
bool use_custom = p_preset->get("storyboard/use_custom_bg_color");
Color color = use_custom ? p_preset->get("storyboard/custom_bg_color") : get_project_setting(p_preset, "application/boot_splash/bg_color");
const String value_format = "red=\"$red\" green=\"$green\" blue=\"$blue\" alpha=\"$alpha\"";
Dictionary value_dictionary;
value_dictionary["red"] = color.r;
value_dictionary["green"] = color.g;
value_dictionary["blue"] = color.b;
value_dictionary["alpha"] = color.a;
String value = value_format.format(value_dictionary, "$_");
strnew += p_line.replace("$launch_screen_background_color", value) + "\n";
// OS Deployment Target
} else if (p_line.contains("$os_deployment_target")) {
String min_version = p_preset->get("application/min_" + get_platform_name() + "_version");
String value = "IPHONEOS_DEPLOYMENT_TARGET = " + min_version + ";";
strnew += p_line.replace("$os_deployment_target", value) + "\n";
// Valid Archs
} else if (p_line.contains("$valid_archs")) {
strnew += p_line.replace("$valid_archs", "arm64 x86_64") + "\n";
// Apple Embedded common
} else {
strnew += EditorExportPlatformAppleEmbedded::_process_config_file_line(p_preset, p_line, p_config, p_debug, p_code_signing);
}
return strnew;
}

View File

@ -52,6 +52,8 @@ class EditorExportPlatformIOS : public EditorExportPlatformAppleEmbedded {
virtual Error _export_icons(const Ref<EditorExportPreset> &p_preset, const String &p_iconset_dir) override;
virtual HashMap<String, Variant> get_custom_project_settings(const Ref<EditorExportPreset> &p_preset) const override;
virtual String _process_config_file_line(const Ref<EditorExportPreset> &p_preset, const String &p_line, const AppleEmbeddedConfigData &p_config, bool p_debug, const CodeSigningDetails &p_code_signing) override;
public:
virtual String get_name() const override { return "iOS"; }
virtual String get_os_name() const override { return "iOS"; }

View File

@ -7,7 +7,7 @@ This platform derives from the Apple Embedded abstract platform ([`drivers/apple
This platform uses shared Apple code ([`drivers/apple`](drivers/apple)).
See also [`misc/dist/ios_xcode`](/misc/dist/ios_xcode) folder for the Xcode
See also [`misc/dist/apple_embedded_xcode`](/misc/dist/apple_embedded_xcode) folder for the Xcode
project template used for packaging the iOS export templates.
## Documentation

View File

@ -54,3 +54,51 @@ void EditorExportPlatformVisionOS::get_export_options(List<ExportOption> *r_opti
Vector<EditorExportPlatformAppleEmbedded::IconInfo> EditorExportPlatformVisionOS::get_icon_infos() const {
return Vector<EditorExportPlatformAppleEmbedded::IconInfo>();
}
String EditorExportPlatformVisionOS::_process_config_file_line(const Ref<EditorExportPreset> &p_preset, const String &p_line, const AppleEmbeddedConfigData &p_config, bool p_debug, const CodeSigningDetails &p_code_signing) {
// Do visionOS specific processing first, and call super implementation if there are no matches
String strnew;
// Supported Destinations
if (p_line.contains("$targeted_device_family")) {
strnew += p_line.replace("$targeted_device_family", "7") + "\n";
// MoltenVK Framework not used on visionOS
} else if (p_line.contains("$moltenvk_buildfile")) {
strnew += p_line.replace("$moltenvk_buildfile", "") + "\n";
} else if (p_line.contains("$moltenvk_fileref")) {
strnew += p_line.replace("$moltenvk_fileref", "") + "\n";
} else if (p_line.contains("$moltenvk_buildphase")) {
strnew += p_line.replace("$moltenvk_buildphase", "") + "\n";
} else if (p_line.contains("$moltenvk_buildgrp")) {
strnew += p_line.replace("$moltenvk_buildgrp", "") + "\n";
// Launch Storyboard
} else if (p_line.contains("$plist_launch_screen_name")) {
strnew += p_line.replace("$plist_launch_screen_name", "") + "\n";
} else if (p_line.contains("$pbx_launch_screen_file_reference")) {
strnew += p_line.replace("$pbx_launch_screen_file_reference", "") + "\n";
} else if (p_line.contains("$pbx_launch_screen_copy_files")) {
strnew += p_line.replace("$pbx_launch_screen_copy_files", "") + "\n";
} else if (p_line.contains("$pbx_launch_screen_build_phase")) {
strnew += p_line.replace("$pbx_launch_screen_build_phase", "") + "\n";
} else if (p_line.contains("$pbx_launch_screen_build_reference")) {
strnew += p_line.replace("$pbx_launch_screen_build_reference", "") + "\n";
// OS Deployment Target
} else if (p_line.contains("$os_deployment_target")) {
String min_version = p_preset->get("application/min_" + get_platform_name() + "_version");
String value = "XROS_DEPLOYMENT_TARGET = " + min_version + ";";
strnew += p_line.replace("$os_deployment_target", value) + "\n";
// Valid Archs
} else if (p_line.contains("$valid_archs")) {
strnew += p_line.replace("$valid_archs", "arm64") + "\n";
// Apple Embedded common
} else {
strnew += EditorExportPlatformAppleEmbedded::_process_config_file_line(p_preset, p_line, p_config, p_debug, p_code_signing);
}
return strnew;
}

View File

@ -47,6 +47,8 @@ class EditorExportPlatformVisionOS : public EditorExportPlatformAppleEmbedded {
virtual void get_export_options(List<ExportOption> *r_options) const override;
virtual String _process_config_file_line(const Ref<EditorExportPreset> &p_preset, const String &p_line, const AppleEmbeddedConfigData &p_config, bool p_debug, const CodeSigningDetails &p_code_signing) override;
public:
virtual String get_name() const override { return "visionOS"; }
virtual String get_os_name() const override { return "visionOS"; }