Fix GDExtensions library export when multiple architectures are set.

This commit is contained in:
bruvzg 2023-02-27 17:00:38 +02:00
parent 8208060c21
commit c2d678a924
No known key found for this signature in database
GPG key ID: 7960FCF39844EC38

View file

@ -54,9 +54,35 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
String entry_symbol = config->get_value("configuration", "entry_symbol"); String entry_symbol = config->get_value("configuration", "entry_symbol");
HashSet<String> all_archs;
all_archs.insert("x86_32");
all_archs.insert("x86_64");
all_archs.insert("arm32");
all_archs.insert("arm64");
all_archs.insert("rv64");
all_archs.insert("ppc32");
all_archs.insert("ppc64");
all_archs.insert("wasm32");
all_archs.insert("universal");
HashSet<String> archs;
HashSet<String> features_wo_arch;
for (const String &tag : p_features) {
if (all_archs.has(tag)) {
archs.insert(tag);
} else {
features_wo_arch.insert(tag);
}
}
if (archs.is_empty()) {
archs.insert("unknown_arch"); // Not archs specified, still try to match.
}
for (const String &arch_tag : archs) {
PackedStringArray tags; PackedStringArray tags;
String library_path = GDExtension::find_extension_library( String library_path = GDExtension::find_extension_library(
p_path, config, [p_features](String p_feature) { return p_features.has(p_feature); }, &tags); p_path, config, [features_wo_arch, arch_tag](String p_feature) { return features_wo_arch.has(p_feature) || (p_feature == arch_tag); }, &tags);
if (!library_path.is_empty()) { if (!library_path.is_empty()) {
add_shared_object(library_path, tags); add_shared_object(library_path, tags);
@ -117,6 +143,7 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
break; break;
} }
} }
}
} }
#endif // GDEXTENSION_EXPORT_PLUGIN_H #endif // GDEXTENSION_EXPORT_PLUGIN_H