summaryrefslogtreecommitdiff
path: root/platform/iphone/export
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-06-30 12:14:23 +0200
committerGitHub <noreply@github.com>2019-06-30 12:14:23 +0200
commit96d3270c344c7fe9a463b87006b0c56004128f6d (patch)
tree3479aa293c44f92cb3ead64f38e5b4b4885bfe7f /platform/iphone/export
parentb4aba3ae7c89b7d236d3efab459fb89b33c91a3c (diff)
parentd9cefb34c1dd825fcceb76d430ee7410349b6a12 (diff)
Merge pull request #24227 from BastiaanOlij/arkit31
ARKit for Godot 3.2
Diffstat (limited to 'platform/iphone/export')
-rw-r--r--platform/iphone/export/export.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index b2064472e4..a9daa6ea5f 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -95,7 +95,7 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
Vector<ExportArchitecture> _get_supported_architectures();
Vector<String> _get_preset_architectures(const Ref<EditorExportPreset> &p_preset);
- void _add_assets_to_project(Vector<uint8_t> &p_project_data, const Vector<IOSExportAsset> &p_additional_assets);
+ void _add_assets_to_project(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &p_project_data, const Vector<IOSExportAsset> &p_additional_assets);
Error _export_additional_assets(const String &p_out_dir, const Vector<String> &p_assets, bool p_is_framework, Vector<IOSExportAsset> &r_exported_assets);
Error _export_additional_assets(const String &p_out_dir, const Vector<SharedObject> &p_libraries, Vector<IOSExportAsset> &r_exported_assets);
@@ -656,7 +656,7 @@ struct ExportLibsData {
String dest_dir;
};
-void EditorExportPlatformIOS::_add_assets_to_project(Vector<uint8_t> &p_project_data, const Vector<IOSExportAsset> &p_additional_assets) {
+void EditorExportPlatformIOS::_add_assets_to_project(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &p_project_data, const Vector<IOSExportAsset> &p_additional_assets) {
Vector<Ref<EditorExportPlugin> > export_plugins = EditorExport::get_singleton()->get_export_plugins();
Vector<String> frameworks;
for (int i = 0; i < export_plugins.size(); ++i) {
@@ -714,7 +714,28 @@ void EditorExportPlatformIOS::_add_assets_to_project(Vector<uint8_t> &p_project_
// Note, frameworks like gamekit are always included in our project.pbxprof file
// even if turned off in capabilities.
- // Frameworks that are used by modules (like arkit) we may need to optionally add here.
+
+ // We do need our ARKit framework
+ if ((bool)p_preset->get("capabilities/arkit")) {
+ String build_id = (++current_id).str();
+ String ref_id = (++current_id).str();
+
+ if (pbx_frameworks_build.length() > 0) {
+ pbx_frameworks_build += ",\n";
+ pbx_frameworks_refs += ",\n";
+ }
+
+ pbx_frameworks_build += build_id;
+ pbx_frameworks_refs += ref_id;
+
+ Dictionary format_dict;
+ format_dict["build_id"] = build_id;
+ format_dict["ref_id"] = ref_id;
+ format_dict["name"] = "ARKit.framework";
+ format_dict["file_path"] = "System/Library/Frameworks/ARKit.framework";
+ format_dict["file_type"] = "wrapper.framework";
+ pbx_files += file_info_format.format(format_dict, "$_");
+ }
String str = String::utf8((const char *)p_project_data.ptr(), p_project_data.size());
str = str.replace("$additional_pbx_files", pbx_files);
@@ -1045,7 +1066,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
print_line("Exporting additional assets");
Vector<IOSExportAsset> assets;
_export_additional_assets(dest_dir + binary_name, libraries, assets);
- _add_assets_to_project(project_file_data, assets);
+ _add_assets_to_project(p_preset, project_file_data, assets);
String project_file_name = dest_dir + binary_name + ".xcodeproj/project.pbxproj";
FileAccess *f = FileAccess::open(project_file_name, FileAccess::WRITE);
if (!f) {