Skip to content

Commit 14bdf39

Browse files
committed
Merge pull request #107789 from rsanchezsaez/apple/apple-embedded-export-template
Replace iOS/visionOS Xcode templates by new Apple embedded template
2 parents 2a7e01e + 6d9983e commit 14bdf39

File tree

55 files changed

+606
-1194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+606
-1194
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ xcuserdata/
217217
*.xcscmblueprint
218218
*.xccheckout
219219
*.xcodeproj/*
220-
!misc/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
220+
!misc/misc/dist/apple_embedded_xcode/godot.xcodeproj/project.pbxproj
221221

222222
# Zed
223223
.zed/

editor/export/editor_export_platform_apple_embedded.cpp

Lines changed: 364 additions & 422 deletions
Large diffs are not rendered by default.

editor/export/editor_export_platform_apple_embedded.h

Lines changed: 56 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,29 @@ class EditorExportPlatformAppleEmbedded : public EditorExportPlatform {
107107
static Error _walk_dir_recursive(Ref<DirAccess> &p_da, FileHandler p_handler, void *p_userdata);
108108
static Error _codesign(String p_file, void *p_userdata);
109109

110+
struct ExportArchitecture {
111+
String name;
112+
bool is_default = false;
113+
114+
ExportArchitecture() {}
115+
116+
ExportArchitecture(String p_name, bool p_is_default) {
117+
name = p_name;
118+
is_default = p_is_default;
119+
}
120+
};
121+
122+
struct AppleEmbeddedExportAsset {
123+
String exported_path;
124+
bool is_framework = false; // framework is anything linked to the binary, otherwise it's a resource
125+
bool should_embed = false;
126+
};
127+
128+
String _get_additional_plist_content();
129+
String _get_linker_flags();
130+
String _get_cpp_code();
131+
132+
protected:
110133
struct AppleEmbeddedConfigData {
111134
String pkg_name;
112135
String binary_name;
@@ -122,27 +145,45 @@ class EditorExportPlatformAppleEmbedded : public EditorExportPlatform {
122145
bool use_swift_runtime;
123146
};
124147

125-
struct ExportArchitecture {
126-
String name;
127-
bool is_default = false;
148+
struct CodeSigningDetails {
149+
String debug_signing_identity;
150+
String release_signing_identity;
151+
String debug_provisioning_profile_uuid;
152+
String release_provisioning_profile_uuid;
153+
String debug_provisioning_profile_specifier;
154+
String release_provisioning_profile_specifier;
155+
bool debug_manual_signing = false;
156+
bool release_manual_signing = false;
128157

129-
ExportArchitecture() {}
158+
CodeSigningDetails(const Ref<EditorExportPreset> &p_preset) {
159+
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");
160+
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");
130161

131-
ExportArchitecture(String p_name, bool p_is_default) {
132-
name = p_name;
133-
is_default = p_is_default;
162+
debug_provisioning_profile_uuid = p_preset->get_or_env("application/provisioning_profile_uuid_debug", ENV_APPLE_PLATFORM_PROFILE_UUID_DEBUG).operator String();
163+
release_provisioning_profile_uuid = p_preset->get_or_env("application/provisioning_profile_uuid_release", ENV_APPLE_PLATFORM_PROFILE_UUID_DEBUG).operator String();
164+
165+
debug_manual_signing = !debug_provisioning_profile_uuid.is_empty() || (debug_signing_identity != "Apple Development" && debug_signing_identity != "Apple Distribution");
166+
release_manual_signing = !release_provisioning_profile_uuid.is_empty() || (release_signing_identity != "Apple Development" && release_signing_identity != "Apple Distribution");
167+
168+
debug_provisioning_profile_specifier = p_preset->get_or_env("application/provisioning_profile_specifier_debug", ENV_APPLE_PLATFORM_PROFILE_SPECIFIER_DEBUG).operator String();
169+
debug_manual_signing |= !debug_provisioning_profile_specifier.is_empty();
170+
171+
release_provisioning_profile_specifier = p_preset->get_or_env("application/provisioning_profile_specifier_release", ENV_APPLE_PLATFORM_PROFILE_SPECIFIER_RELEASE).operator String();
172+
release_manual_signing |= !release_provisioning_profile_specifier.is_empty();
134173
}
135174
};
136175

137-
struct AppleEmbeddedExportAsset {
138-
String exported_path;
139-
bool is_framework = false; // framework is anything linked to the binary, otherwise it's a resource
140-
bool should_embed = false;
176+
struct IconInfo {
177+
const char *preset_key;
178+
const char *idiom;
179+
const char *export_name;
180+
const char *actual_size_side;
181+
const char *scale;
182+
const char *unscaled_size;
183+
bool force_opaque;
141184
};
142185

143-
String _get_additional_plist_content();
144-
String _get_linker_flags();
145-
String _get_cpp_code();
186+
private:
146187
void _fix_config_file(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &pfile, const AppleEmbeddedConfigData &p_config, bool p_debug);
147188

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

164205
protected:
165-
struct IconInfo {
166-
const char *preset_key;
167-
const char *idiom;
168-
const char *export_name;
169-
const char *actual_size_side;
170-
const char *scale;
171-
const char *unscaled_size;
172-
bool force_opaque;
173-
};
206+
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);
174207

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

File renamed without changes.

misc/dist/visionos_xcode/godot_visionos.xcodeproj/project.pbxproj renamed to misc/dist/apple_embedded_xcode/godot_apple_embedded.xcodeproj/project.pbxproj

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
$swift_runtime_buildfile
1414
1FF8DBB11FBA9DE1009DE660 /* dummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1FF8DBB01FBA9DE1009DE660 /* dummy.cpp */; };
1515
D07CD44E1C5D589C00B7FB28 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D07CD44D1C5D589C00B7FB28 /* Images.xcassets */; };
16+
$moltenvk_buildfile
1617
D0BCFE4618AEBDA2004A7AAE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE4418AEBDA2004A7AAE /* InfoPlist.strings */; };
1718
D0BCFE7818AEBFEB004A7AAE /* $binary.pck in Resources */ = {isa = PBXBuildFile; fileRef = D0BCFE7718AEBFEB004A7AAE /* $binary.pck */; };
1819
F965960D2BC2C3A800579C7E /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = F965960C2BC2C3A800579C7E /* PrivacyInfo.xcprivacy */; };
20+
$pbx_launch_screen_build_reference
1921
/* End PBXBuildFile section */
2022

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

5155
$additional_pbx_files
@@ -55,6 +59,7 @@
5559
isa = PBXFrameworksBuildPhase;
5660
buildActionMask = 2147483647;
5761
files = (
62+
$moltenvk_buildphase
5863
DEADBEEF2F582BE20003B888 /* $binary.xcframework */,
5964
$modules_buildphase
6065
$additional_pbx_frameworks_build
@@ -88,6 +93,7 @@
8893
D0BCFE3618AEBDA2004A7AAE /* Frameworks */ = {
8994
isa = PBXGroup;
9095
children = (
96+
$moltenvk_buildgrp
9197
DEADBEEF1F582BE20003B888 /* $binary.xcframework */,
9298
$modules_buildgrp
9399
$additional_pbx_frameworks_refs
@@ -98,6 +104,7 @@
98104
D0BCFE4118AEBDA2004A7AAE /* $binary */ = {
99105
isa = PBXGroup;
100106
children = (
107+
$pbx_launch_screen_copy_files
101108
1FF4C1881F584E6300A41E41 /* $binary.entitlements */,
102109
D07CD44D1C5D589C00B7FB28 /* Images.xcassets */,
103110
D0BCFE4218AEBDA2004A7AAE /* Supporting Files */,
@@ -180,6 +187,7 @@
180187
files = (
181188
D07CD44E1C5D589C00B7FB28 /* Images.xcassets in Resources */,
182189
D0BCFE7818AEBFEB004A7AAE /* $binary.pck in Resources */,
190+
$pbx_launch_screen_build_phase
183191
D0BCFE4618AEBDA2004A7AAE /* InfoPlist.strings in Resources */,
184192
F965960D2BC2C3A800579C7E /* PrivacyInfo.xcprivacy in Resources */,
185193
$additional_pbx_resources_build
@@ -231,7 +239,6 @@
231239
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
232240
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
233241
CODE_SIGN_IDENTITY = "$code_sign_identity_debug";
234-
"CODE_SIGN_IDENTITY[sdk=xros*]" = "$code_sign_identity_debug";
235242
COPY_PHASE_STRIP = NO;
236243
ENABLE_BITCODE = NO;
237244
"FRAMEWORK_SEARCH_PATHS[arch=*]" = (
@@ -250,13 +257,13 @@
250257
GCC_WARN_UNINITIALIZED_AUTOS = YES;
251258
GCC_WARN_UNUSED_FUNCTION = YES;
252259
GCC_WARN_UNUSED_VARIABLE = YES;
253-
XROS_DEPLOYMENT_TARGET = $min_version;
260+
$os_deployment_target
254261
"LD_CLASSIC_1500" = "-ld_classic";
255262
"LD_CLASSIC_1501" = "-ld_classic";
256263
"LD_CLASSIC_1510" = "-ld_classic";
257264
OTHER_LDFLAGS = "$(LD_CLASSIC_$(XCODE_VERSION_ACTUAL)) $linker_flags";
258-
SDKROOT = xros;
259-
TARGETED_DEVICE_FAMILY = 7;
265+
SDKROOT = $sdkroot;
266+
TARGETED_DEVICE_FAMILY = "$targeted_device_family";
260267
};
261268
name = Debug;
262269
};
@@ -278,7 +285,6 @@
278285
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
279286
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
280287
CODE_SIGN_IDENTITY = "$code_sign_identity_release";
281-
"CODE_SIGN_IDENTITY[sdk=xros*]" = "$code_sign_identity_release";
282288
COPY_PHASE_STRIP = YES;
283289
ENABLE_BITCODE = NO;
284290
"FRAMEWORK_SEARCH_PATHS[arch=*]" = (
@@ -292,13 +298,13 @@
292298
GCC_WARN_UNINITIALIZED_AUTOS = YES;
293299
GCC_WARN_UNUSED_FUNCTION = YES;
294300
GCC_WARN_UNUSED_VARIABLE = YES;
295-
XROS_DEPLOYMENT_TARGET = $min_version;
301+
$os_deployment_target
296302
"LD_CLASSIC_1500" = "-ld_classic";
297303
"LD_CLASSIC_1501" = "-ld_classic";
298304
"LD_CLASSIC_1510" = "-ld_classic";
299305
OTHER_LDFLAGS = "$(LD_CLASSIC_$(XCODE_VERSION_ACTUAL)) $linker_flags";
300-
SDKROOT = xros;
301-
TARGETED_DEVICE_FAMILY = 7;
306+
SDKROOT = $sdkroot;
307+
TARGETED_DEVICE_FAMILY = "$targeted_device_family";
302308
VALIDATE_PRODUCT = YES;
303309
};
304310
name = Release;
@@ -310,12 +316,11 @@
310316
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
311317
CODE_SIGN_ENTITLEMENTS = "$binary/$binary.entitlements";
312318
CODE_SIGN_IDENTITY = "$code_sign_identity_debug";
313-
"CODE_SIGN_IDENTITY[sdk=xros*]" = "$code_sign_identity_debug";
314319
CODE_SIGN_STYLE = "$code_sign_style_debug";
315320
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";
316321
DEVELOPMENT_TEAM = $team_id;
317322
INFOPLIST_FILE = "$binary/$binary-Info.plist";
318-
XROS_DEPLOYMENT_TARGET = $min_version;
323+
$os_deployment_target
319324
LD_RUNPATH_SEARCH_PATHS = (
320325
"$(inherited)",
321326
"@executable_path/Frameworks",
@@ -332,8 +337,8 @@
332337
CURRENT_PROJECT_VERSION = $version;
333338
PROVISIONING_PROFILE = "$provisioning_profile_uuid_debug";
334339
PROVISIONING_PROFILE_SPECIFIER = "$provisioning_profile_specifier_debug";
335-
TARGETED_DEVICE_FAMILY = 7;
336-
VALID_ARCHS = "arm64 x86_64";
340+
TARGETED_DEVICE_FAMILY = "$targeted_device_family";
341+
VALID_ARCHS = "$valid_archs";
337342
WRAPPER_EXTENSION = app;
338343
$swift_runtime_build_settings
339344
};
@@ -346,12 +351,11 @@
346351
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
347352
CODE_SIGN_ENTITLEMENTS = "$binary/$binary.entitlements";
348353
CODE_SIGN_IDENTITY = "$code_sign_identity_release";
349-
"CODE_SIGN_IDENTITY[sdk=xros*]" = "$code_sign_identity_release";
350354
CODE_SIGN_STYLE = "$code_sign_style_release";
351355
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";
352356
DEVELOPMENT_TEAM = $team_id;
353357
INFOPLIST_FILE = "$binary/$binary-Info.plist";
354-
XROS_DEPLOYMENT_TARGET = $min_version;
358+
$os_deployment_target
355359
LD_RUNPATH_SEARCH_PATHS = (
356360
"$(inherited)",
357361
"@executable_path/Frameworks",
@@ -368,8 +372,8 @@
368372
CURRENT_PROJECT_VERSION = $version;
369373
PROVISIONING_PROFILE = "$provisioning_profile_uuid_release";
370374
PROVISIONING_PROFILE_SPECIFIER = "$provisioning_profile_specifier_release";
371-
TARGETED_DEVICE_FAMILY = 7;
372-
VALID_ARCHS = "arm64";
375+
TARGETED_DEVICE_FAMILY = "$targeted_device_family";
376+
VALID_ARCHS = "$valid_archs";
373377
WRAPPER_EXTENSION = app;
374378
$swift_runtime_build_settings
375379
};

0 commit comments

Comments
 (0)