|
@@ -77,12 +77,14 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
|
|
|
|
|
|
HashSet<String> archs;
|
|
|
HashSet<String> features_wo_arch;
|
|
|
+ Vector<String> features_vector;
|
|
|
for (const String &tag : p_features) {
|
|
|
if (all_archs.has(tag)) {
|
|
|
archs.insert(tag);
|
|
|
} else {
|
|
|
features_wo_arch.insert(tag);
|
|
|
}
|
|
|
+ features_vector.append(tag);
|
|
|
}
|
|
|
|
|
|
if (archs.is_empty()) {
|
|
@@ -90,11 +92,22 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
|
|
|
}
|
|
|
|
|
|
HashSet<String> libs_added;
|
|
|
+ struct FoundLibInfo {
|
|
|
+ int count = 0;
|
|
|
+ Vector<String> libs;
|
|
|
+ };
|
|
|
+ HashMap<String, FoundLibInfo> libs_found;
|
|
|
+ for (const String &arch_tag : archs) {
|
|
|
+ if (arch_tag != "universal") {
|
|
|
+ libs_found[arch_tag] = FoundLibInfo();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
for (const String &arch_tag : archs) {
|
|
|
PackedStringArray tags;
|
|
|
String library_path = GDExtensionLibraryLoader::find_extension_library(
|
|
|
p_path, config, [features_wo_arch, arch_tag](const String &p_feature) { return features_wo_arch.has(p_feature) || (p_feature == arch_tag); }, &tags);
|
|
|
+
|
|
|
if (libs_added.has(library_path)) {
|
|
|
continue; // Universal library, already added for another arch, do not duplicate.
|
|
|
}
|
|
@@ -122,15 +135,19 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
|
|
|
String linker_flags = "-Wl,-U,_" + entry_symbol;
|
|
|
add_ios_linker_flags(linker_flags);
|
|
|
}
|
|
|
- } else {
|
|
|
- Vector<String> features_vector;
|
|
|
- for (const String &E : p_features) {
|
|
|
- features_vector.append(E);
|
|
|
- }
|
|
|
- if (get_export_platform().is_valid()) {
|
|
|
- get_export_platform()->add_message(EditorExportPlatform::EXPORT_MESSAGE_WARNING, TTR("GDExtension"), vformat(TTR("No suitable library found for GDExtension: \"%s\". Possible feature flags for your platform: %s"), p_path, String(", ").join(features_vector)));
|
|
|
+
|
|
|
+ // Update found library info.
|
|
|
+ if (arch_tag == "universal") {
|
|
|
+ for (const String &sub_arch_tag : archs) {
|
|
|
+ if (sub_arch_tag != "universal") {
|
|
|
+ libs_found[sub_arch_tag].count++;
|
|
|
+ libs_found[sub_arch_tag].libs.push_back(library_path);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ libs_found[arch_tag].count++;
|
|
|
+ libs_found[arch_tag].libs.push_back(library_path);
|
|
|
}
|
|
|
- return;
|
|
|
}
|
|
|
|
|
|
Vector<SharedObject> dependencies_shared_objects = GDExtensionLibraryLoader::find_extension_dependencies(p_path, config, [p_features](String p_feature) { return p_features.has(p_feature); });
|
|
@@ -138,6 +155,18 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
|
|
|
_add_shared_object(shared_object);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ for (const KeyValue<String, FoundLibInfo> &E : libs_found) {
|
|
|
+ if (E.value.count == 0) {
|
|
|
+ if (get_export_platform().is_valid()) {
|
|
|
+ get_export_platform()->add_message(EditorExportPlatform::EXPORT_MESSAGE_WARNING, TTR("GDExtension"), vformat(TTR("No \"%s\" library found for GDExtension: \"%s\". Possible feature flags for your platform: %s"), E.key, p_path, String(", ").join(features_vector)));
|
|
|
+ }
|
|
|
+ } else if (E.value.count > 1) {
|
|
|
+ if (get_export_platform().is_valid()) {
|
|
|
+ get_export_platform()->add_message(EditorExportPlatform::EXPORT_MESSAGE_WARNING, TTR("GDExtension"), vformat(TTR("Multiple \"%s\" libraries found for GDExtension: \"%s\": \"%s\"."), E.key, p_path, String(", ").join(E.value.libs)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#endif // GDEXTENSION_EXPORT_PLUGIN_H
|