diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 0fc1d7b48d0..af09b4d2e3f 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -1224,6 +1224,8 @@ Error EditorExportPlatformIOS::_export_ios_plugins(const Ref Vector added_embedded_dependenciy_names; HashMap plist_values; + Set plugin_linker_flags; + Error err; for (int i = 0; i < enabled_plugins.size(); i++) { @@ -1290,6 +1292,13 @@ Error EditorExportPlatformIOS::_export_ios_plugins(const Ref p_config_data.capabilities.push_back(capability); } + // Linker flags + // Checking duplicates + for (int j = 0; j < plugin.linker_flags.size(); j++) { + String linker_flag = plugin.linker_flags[j]; + plugin_linker_flags.insert(linker_flag); + } + // Plist // Using hash map container to remove duplicates const String *K = nullptr; @@ -1370,6 +1379,27 @@ Error EditorExportPlatformIOS::_export_ios_plugins(const Ref p_config_data.cpp_code += plugin_cpp_code.format(plugin_format, "$_"); } + + // Update Linker Flag Values + { + String result_linker_flags = " "; + for (Set::Element *E = plugin_linker_flags.front(); E; E = E->next()) { + const String &flag = E->get(); + + if (flag.length() == 0) { + continue; + } + + if (result_linker_flags.length() > 0) { + result_linker_flags += ' '; + } + + result_linker_flags += flag; + } + result_linker_flags = result_linker_flags.replace("\"", "\\\""); + p_config_data.linker_flags += result_linker_flags; + } + return OK; } diff --git a/platform/iphone/plugin/godot_plugin_config.h b/platform/iphone/plugin/godot_plugin_config.h index 90ccbf41619..b2baa67b417 100644 --- a/platform/iphone/plugin/godot_plugin_config.h +++ b/platform/iphone/plugin/godot_plugin_config.h @@ -67,6 +67,7 @@ struct PluginConfigIOS { static const char *DEPENDENCIES_SYSTEM_KEY; static const char *DEPENDENCIES_CAPABILITIES_KEY; static const char *DEPENDENCIES_FILES_KEY; + static const char *DEPENDENCIES_LINKER_FLAGS; static const char *PLIST_SECTION; @@ -90,6 +91,8 @@ struct PluginConfigIOS { Vector files_to_copy; Vector capabilities; + Vector linker_flags; + // Optional plist section // Supports only string types for now HashMap plist; @@ -108,6 +111,7 @@ const char *PluginConfigIOS::DEPENDENCIES_LINKED_KEY = "linked"; const char *PluginConfigIOS::DEPENDENCIES_EMBEDDED_KEY = "embedded"; const char *PluginConfigIOS::DEPENDENCIES_SYSTEM_KEY = "system"; const char *PluginConfigIOS::DEPENDENCIES_CAPABILITIES_KEY = "capabilities"; +const char *PluginConfigIOS::DEPENDENCIES_LINKER_FLAGS = "linker_flags"; const char *PluginConfigIOS::DEPENDENCIES_FILES_KEY = "files"; const char *PluginConfigIOS::PLIST_SECTION = "plist"; @@ -278,6 +282,8 @@ static inline PluginConfigIOS load_plugin_config(Ref config_file, co plugin_config.files_to_copy = resolve_local_dependencies(config_base_dir, files); plugin_config.capabilities = config_file->get_value(PluginConfigIOS::DEPENDENCIES_SECTION, PluginConfigIOS::DEPENDENCIES_CAPABILITIES_KEY, Vector()); + + plugin_config.linker_flags = config_file->get_value(PluginConfigIOS::DEPENDENCIES_SECTION, PluginConfigIOS::DEPENDENCIES_LINKER_FLAGS, Vector()); } if (config_file->has_section(PluginConfigIOS::PLIST_SECTION)) {