1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-04 17:04:49 +00:00

[iOS, GDExtension] Fix loading and exporting static libraries and xcframeworks.

This commit is contained in:
bruvzg
2023-11-05 22:59:36 +02:00
parent c2246a5a6f
commit d4d5d68eda
5 changed files with 18 additions and 2 deletions

View File

@@ -88,14 +88,20 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
archs.insert("unknown_arch"); // Not archs specified, still try to match.
}
HashSet<String> libs_added;
for (const String &arch_tag : archs) {
PackedStringArray tags;
String library_path = GDExtension::find_extension_library(
p_path, config, [features_wo_arch, arch_tag](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.
}
if (!library_path.is_empty()) {
libs_added.insert(library_path);
add_shared_object(library_path, tags);
if (p_features.has("iOS") && (library_path.ends_with(".a") || library_path.ends_with(".xcframework"))) {
if (p_features.has("ios") && (library_path.ends_with(".a") || library_path.ends_with(".xcframework"))) {
String additional_code = "extern void register_dynamic_symbol(char *name, void *address);\n"
"extern void add_ios_init_callback(void (*cb)());\n"
"\n"