Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ xcuserdata/
*.xcscmblueprint
*.xccheckout
*.xcodeproj/*
!misc/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
!misc/misc/dist/apple_embedded_xcode/godot.xcodeproj/project.pbxproj

# Zed
.zed/
Expand Down
786 changes: 364 additions & 422 deletions editor/export/editor_export_platform_apple_embedded.cpp

Large diffs are not rendered by default.

79 changes: 56 additions & 23 deletions editor/export/editor_export_platform_apple_embedded.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,29 @@ class EditorExportPlatformAppleEmbedded : public EditorExportPlatform {
static Error _walk_dir_recursive(Ref<DirAccess> &p_da, FileHandler p_handler, void *p_userdata);
static Error _codesign(String p_file, void *p_userdata);

struct ExportArchitecture {
String name;
bool is_default = false;

ExportArchitecture() {}

ExportArchitecture(String p_name, bool p_is_default) {
name = p_name;
is_default = p_is_default;
}
};

struct AppleEmbeddedExportAsset {
String exported_path;
bool is_framework = false; // framework is anything linked to the binary, otherwise it's a resource
bool should_embed = false;
};

String _get_additional_plist_content();
String _get_linker_flags();
String _get_cpp_code();

protected:
struct AppleEmbeddedConfigData {
String pkg_name;
String binary_name;
Expand All @@ -122,27 +145,45 @@ class EditorExportPlatformAppleEmbedded : public EditorExportPlatform {
bool use_swift_runtime;
};

struct ExportArchitecture {
String name;
bool is_default = false;
struct CodeSigningDetails {
String debug_signing_identity;
String release_signing_identity;
String debug_provisioning_profile_uuid;
String release_provisioning_profile_uuid;
String debug_provisioning_profile_specifier;
String release_provisioning_profile_specifier;
bool debug_manual_signing = false;
bool release_manual_signing = false;

ExportArchitecture() {}
CodeSigningDetails(const Ref<EditorExportPreset> &p_preset) {
debug_signing_identity = p_preset->get("application/code_sign_identity_debug").operator String().is_empty() ? "Apple Development" : p_preset->get("application/code_sign_identity_debug");
release_signing_identity = p_preset->get("application/code_sign_identity_release").operator String().is_empty() ? "Apple Distribution" : p_preset->get("application/code_sign_identity_release");

ExportArchitecture(String p_name, bool p_is_default) {
name = p_name;
is_default = p_is_default;
debug_provisioning_profile_uuid = p_preset->get_or_env("application/provisioning_profile_uuid_debug", ENV_APPLE_PLATFORM_PROFILE_UUID_DEBUG).operator String();
release_provisioning_profile_uuid = p_preset->get_or_env("application/provisioning_profile_uuid_release", ENV_APPLE_PLATFORM_PROFILE_UUID_DEBUG).operator String();

debug_manual_signing = !debug_provisioning_profile_uuid.is_empty() || (debug_signing_identity != "Apple Development" && debug_signing_identity != "Apple Distribution");
release_manual_signing = !release_provisioning_profile_uuid.is_empty() || (release_signing_identity != "Apple Development" && release_signing_identity != "Apple Distribution");

debug_provisioning_profile_specifier = p_preset->get_or_env("application/provisioning_profile_specifier_debug", ENV_APPLE_PLATFORM_PROFILE_SPECIFIER_DEBUG).operator String();
debug_manual_signing |= !debug_provisioning_profile_specifier.is_empty();

release_provisioning_profile_specifier = p_preset->get_or_env("application/provisioning_profile_specifier_release", ENV_APPLE_PLATFORM_PROFILE_SPECIFIER_RELEASE).operator String();
release_manual_signing |= !release_provisioning_profile_specifier.is_empty();
}
};

struct AppleEmbeddedExportAsset {
String exported_path;
bool is_framework = false; // framework is anything linked to the binary, otherwise it's a resource
bool should_embed = false;
struct IconInfo {
const char *preset_key;
const char *idiom;
const char *export_name;
const char *actual_size_side;
const char *scale;
const char *unscaled_size;
bool force_opaque;
};

String _get_additional_plist_content();
String _get_linker_flags();
String _get_cpp_code();
private:
void _fix_config_file(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &pfile, const AppleEmbeddedConfigData &p_config, bool p_debug);

Vector<ExportArchitecture> _get_supported_architectures() const;
Expand All @@ -162,15 +203,7 @@ class EditorExportPlatformAppleEmbedded : public EditorExportPlatform {
bool is_package_name_valid(const String &p_package, String *r_error = nullptr) const;

protected:
struct IconInfo {
const char *preset_key;
const char *idiom;
const char *export_name;
const char *actual_size_side;
const char *scale;
const char *unscaled_size;
bool force_opaque;
};
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);

void _blend_and_rotate(Ref<Image> &p_dst, Ref<Image> &p_src, bool p_rot);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
$swift_runtime_buildfile
1FF8DBB11FBA9DE1009DE660 /* dummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1FF8DBB01FBA9DE1009DE660 /* dummy.cpp */; };
D07CD44E1C5D589C00B7FB28 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D07CD44D1C5D589C00B7FB28 /* Images.xcassets */; };
$moltenvk_buildfile
D0BCFE4618AEBDA2004A7AAE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE4418AEBDA2004A7AAE /* InfoPlist.strings */; };
D0BCFE7818AEBFEB004A7AAE /* $binary.pck in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE7718AEBFEB004A7AAE /* $binary.pck */; };
F965960D2BC2C3A800579C7E /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = F965960C2BC2C3A800579C7E /* PrivacyInfo.xcprivacy */; };
$pbx_launch_screen_build_reference
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -39,13 +41,15 @@
$swift_runtime_fileref
1FF4C1881F584E6300A41E41 /* $binary.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "$binary.entitlements"; sourceTree = "<group>"; };
1FF8DBB01FBA9DE1009DE660 /* dummy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = dummy.cpp; sourceTree = "<group>"; };
$moltenvk_fileref
D07CD44D1C5D589C00B7FB28 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
D0BCFE3418AEBDA2004A7AAE /* $binary.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "$binary.app"; sourceTree = BUILT_PRODUCTS_DIR; };
D0BCFE4318AEBDA2004A7AAE /* $binary-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "$binary-Info.plist"; sourceTree = "<group>"; };
D0BCFE4518AEBDA2004A7AAE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
$pbx_locale_file_reference
D0BCFE7718AEBFEB004A7AAE /* $binary.pck */ = {isa = PBXFileReference; lastKnownFileType = file; path = "$binary.pck"; sourceTree = "<group>"; };
F965960C2BC2C3A800579C7E /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
$pbx_launch_screen_file_reference
/* End PBXFileReference section */

$additional_pbx_files
Expand All @@ -55,6 +59,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
$moltenvk_buildphase
DEADBEEF2F582BE20003B888 /* $binary.xcframework */,
$modules_buildphase
$additional_pbx_frameworks_build
Expand Down Expand Up @@ -88,6 +93,7 @@
D0BCFE3618AEBDA2004A7AAE /* Frameworks */ = {
isa = PBXGroup;
children = (
$moltenvk_buildgrp
DEADBEEF1F582BE20003B888 /* $binary.xcframework */,
$modules_buildgrp
$additional_pbx_frameworks_refs
Expand All @@ -98,6 +104,7 @@
D0BCFE4118AEBDA2004A7AAE /* $binary */ = {
isa = PBXGroup;
children = (
$pbx_launch_screen_copy_files
1FF4C1881F584E6300A41E41 /* $binary.entitlements */,
D07CD44D1C5D589C00B7FB28 /* Images.xcassets */,
D0BCFE4218AEBDA2004A7AAE /* Supporting Files */,
Expand Down Expand Up @@ -180,6 +187,7 @@
files = (
D07CD44E1C5D589C00B7FB28 /* Images.xcassets in Resources */,
D0BCFE7818AEBFEB004A7AAE /* $binary.pck in Resources */,
$pbx_launch_screen_build_phase
D0BCFE4618AEBDA2004A7AAE /* InfoPlist.strings in Resources */,
F965960D2BC2C3A800579C7E /* PrivacyInfo.xcprivacy in Resources */,
$additional_pbx_resources_build
Expand Down Expand Up @@ -231,7 +239,6 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "$code_sign_identity_debug";
"CODE_SIGN_IDENTITY[sdk=xros*]" = "$code_sign_identity_debug";
COPY_PHASE_STRIP = NO;
ENABLE_BITCODE = NO;
"FRAMEWORK_SEARCH_PATHS[arch=*]" = (
Expand All @@ -250,13 +257,13 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
XROS_DEPLOYMENT_TARGET = $min_version;
$os_deployment_target
"LD_CLASSIC_1500" = "-ld_classic";
"LD_CLASSIC_1501" = "-ld_classic";
"LD_CLASSIC_1510" = "-ld_classic";
OTHER_LDFLAGS = "$(LD_CLASSIC_$(XCODE_VERSION_ACTUAL)) $linker_flags";
SDKROOT = xros;
TARGETED_DEVICE_FAMILY = 7;
SDKROOT = $sdkroot;
TARGETED_DEVICE_FAMILY = "$targeted_device_family";
};
name = Debug;
};
Expand All @@ -278,7 +285,6 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "$code_sign_identity_release";
"CODE_SIGN_IDENTITY[sdk=xros*]" = "$code_sign_identity_release";
COPY_PHASE_STRIP = YES;
ENABLE_BITCODE = NO;
"FRAMEWORK_SEARCH_PATHS[arch=*]" = (
Expand All @@ -292,13 +298,13 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
XROS_DEPLOYMENT_TARGET = $min_version;
$os_deployment_target
"LD_CLASSIC_1500" = "-ld_classic";
"LD_CLASSIC_1501" = "-ld_classic";
"LD_CLASSIC_1510" = "-ld_classic";
OTHER_LDFLAGS = "$(LD_CLASSIC_$(XCODE_VERSION_ACTUAL)) $linker_flags";
SDKROOT = xros;
TARGETED_DEVICE_FAMILY = 7;
SDKROOT = $sdkroot;
TARGETED_DEVICE_FAMILY = "$targeted_device_family";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -310,12 +316,11 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "$binary/$binary.entitlements";
CODE_SIGN_IDENTITY = "$code_sign_identity_debug";
"CODE_SIGN_IDENTITY[sdk=xros*]" = "$code_sign_identity_debug";
CODE_SIGN_STYLE = "$code_sign_style_debug";
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";
DEVELOPMENT_TEAM = $team_id;
INFOPLIST_FILE = "$binary/$binary-Info.plist";
XROS_DEPLOYMENT_TARGET = $min_version;
$os_deployment_target
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -332,8 +337,8 @@
CURRENT_PROJECT_VERSION = $version;
PROVISIONING_PROFILE = "$provisioning_profile_uuid_debug";
PROVISIONING_PROFILE_SPECIFIER = "$provisioning_profile_specifier_debug";
TARGETED_DEVICE_FAMILY = 7;
VALID_ARCHS = "arm64 x86_64";
TARGETED_DEVICE_FAMILY = "$targeted_device_family";
VALID_ARCHS = "$valid_archs";
WRAPPER_EXTENSION = app;
$swift_runtime_build_settings
};
Expand All @@ -346,12 +351,11 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "$binary/$binary.entitlements";
CODE_SIGN_IDENTITY = "$code_sign_identity_release";
"CODE_SIGN_IDENTITY[sdk=xros*]" = "$code_sign_identity_release";
CODE_SIGN_STYLE = "$code_sign_style_release";
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";
DEVELOPMENT_TEAM = $team_id;
INFOPLIST_FILE = "$binary/$binary-Info.plist";
XROS_DEPLOYMENT_TARGET = $min_version;
$os_deployment_target
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -368,8 +372,8 @@
CURRENT_PROJECT_VERSION = $version;
PROVISIONING_PROFILE = "$provisioning_profile_uuid_release";
PROVISIONING_PROFILE_SPECIFIER = "$provisioning_profile_specifier_release";
TARGETED_DEVICE_FAMILY = 7;
VALID_ARCHS = "arm64";
TARGETED_DEVICE_FAMILY = "$targeted_device_family";
VALID_ARCHS = "$valid_archs";
WRAPPER_EXTENSION = app;
$swift_runtime_build_settings
};
Expand Down
Loading
Loading