Skip to content

Commit f7bcada

Browse files
authored
Merge pull request #49137 from RandomShaper/ios_targeted_family
Add iOS export option for device family
2 parents 544bbc9 + 19ae819 commit f7bcada

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@
255255
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
256256
OTHER_LDFLAGS = "$linker_flags";
257257
SDKROOT = iphoneos;
258-
TARGETED_DEVICE_FAMILY = "1,2";
258+
TARGETED_DEVICE_FAMILY = "$targeted_device_family";
259259
};
260260
name = Debug;
261261
};
@@ -294,7 +294,7 @@
294294
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
295295
OTHER_LDFLAGS = "$linker_flags";
296296
SDKROOT = iphoneos;
297-
TARGETED_DEVICE_FAMILY = "1,2";
297+
TARGETED_DEVICE_FAMILY = "$targeted_device_family";
298298
VALIDATE_PRODUCT = YES;
299299
};
300300
name = Release;
@@ -323,7 +323,7 @@
323323
PRODUCT_BUNDLE_IDENTIFIER = $bundle_identifier;
324324
PRODUCT_NAME = "$(TARGET_NAME)";
325325
PROVISIONING_PROFILE = "$provisioning_profile_uuid_debug";
326-
TARGETED_DEVICE_FAMILY = "1,2";
326+
TARGETED_DEVICE_FAMILY = "$targeted_device_family";
327327
VALID_ARCHS = "armv7 armv7s arm64 i386 x86_64";
328328
WRAPPER_EXTENSION = app;
329329
};
@@ -353,7 +353,7 @@
353353
PRODUCT_BUNDLE_IDENTIFIER = $bundle_identifier;
354354
PRODUCT_NAME = "$(TARGET_NAME)";
355355
PROVISIONING_PROFILE = "$provisioning_profile_uuid_release";
356-
TARGETED_DEVICE_FAMILY = "1,2";
356+
TARGETED_DEVICE_FAMILY = "$targeted_device_family";
357357
VALID_ARCHS = "armv7 armv7s arm64 i386 x86_64";
358358
WRAPPER_EXTENSION = app;
359359
};

platform/iphone/export/export.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options)
353353
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/code_sign_identity_release", PROPERTY_HINT_PLACEHOLDER_TEXT, "iPhone Distribution"), ""));
354354
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/export_method_release", PROPERTY_HINT_ENUM, "App Store,Development,Ad-Hoc,Enterprise"), 0));
355355

356+
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/targeted_device_family", PROPERTY_HINT_ENUM, "iPhone,iPad,iPhone & iPad"), 2));
357+
356358
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Game Name"), ""));
357359
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/info"), "Made with Godot Engine"));
358360
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/bundle_identifier", PROPERTY_HINT_PLACEHOLDER_TEXT, "com.example.game"), ""));
@@ -470,6 +472,20 @@ void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_
470472
strnew += lines[i].replace("$godot_archs", p_config.architectures) + "\n";
471473
} else if (lines[i].find("$linker_flags") != -1) {
472474
strnew += lines[i].replace("$linker_flags", p_config.linker_flags) + "\n";
475+
} else if (lines[i].find("$targeted_device_family") != -1) {
476+
String xcode_value;
477+
switch ((int)p_preset->get("application/targeted_device_family")) {
478+
case 0: // iPhone
479+
xcode_value = "1";
480+
break;
481+
case 1: // iPad
482+
xcode_value = "2";
483+
break;
484+
case 2: // iPhone & iPad
485+
xcode_value = "1,2";
486+
break;
487+
}
488+
strnew += lines[i].replace("$targeted_device_family", xcode_value) + "\n";
473489
} else if (lines[i].find("$cpp_code") != -1) {
474490
strnew += lines[i].replace("$cpp_code", p_config.cpp_code) + "\n";
475491
} else if (lines[i].find("$docs_in_place") != -1) {

0 commit comments

Comments
 (0)