summaryrefslogtreecommitdiff
path: root/plugins/hello_gdextension/demo/addons
diff options
context:
space:
mode:
authorFredia Huya-Kouadio <fhuya@meta.com>2023-11-26 20:52:54 -0800
committerFredia Huya-Kouadio <fhuya@meta.com>2023-11-26 21:25:41 -0800
commitf32f5b0022629454e135e3dae3c88d5f2a022466 (patch)
treee26fca3a65bf4ce1b2ed76e6814b3c7419388868 /plugins/hello_gdextension/demo/addons
parent09386ad9c0070fcaa47262ea6a73542cf8fa2d57 (diff)
downloadgodot-android-samples-f32f5b0022629454e135e3dae3c88d5f2a022466.tar.gz
godot-android-samples-f32f5b0022629454e135e3dae3c88d5f2a022466.tar.bz2
godot-android-samples-f32f5b0022629454e135e3dae3c88d5f2a022466.zip
Fix the plugins packaging to address https://github.com/godotengine/godot/issues/85395
Diffstat (limited to 'plugins/hello_gdextension/demo/addons')
-rw-r--r--plugins/hello_gdextension/demo/addons/.gitignore2
-rw-r--r--plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/hello_gdextension.gdextension14
-rw-r--r--plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/hello_gdextension_export_plugin.gd33
-rw-r--r--plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/interface/android_icon.svg2
-rw-r--r--plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/interface/hello_gdextension_plugin.gd26
-rw-r--r--plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/plugin.cfg7
6 files changed, 83 insertions, 1 deletions
diff --git a/plugins/hello_gdextension/demo/addons/.gitignore b/plugins/hello_gdextension/demo/addons/.gitignore
index d6b7ef3..f448769 100644
--- a/plugins/hello_gdextension/demo/addons/.gitignore
+++ b/plugins/hello_gdextension/demo/addons/.gitignore
@@ -1,2 +1,2 @@
-*
+bin
!.gitignore
diff --git a/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/hello_gdextension.gdextension b/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/hello_gdextension.gdextension
new file mode 100644
index 0000000..9beae14
--- /dev/null
+++ b/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/hello_gdextension.gdextension
@@ -0,0 +1,14 @@
+[configuration]
+
+entry_symbol = "example_library_init"
+compatibility_minimum = "4.2"
+android_aar_plugin = true
+
+[libraries]
+
+android.debug.arm64 = "res://addons/hello_gdextension_plugin/bin/debug/arm64-v8a/libhello_gdextension.so"
+android.release.arm64 = "res://addons/hello_gdextension_plugin/bin/release/arm64-v8a/libhello_gdextension.so"
+linux.debug.x86_64 = "res://addons/hello_gdextension_plugin/bin/libhello_gdextension.linux.template_debug.x86_64.so"
+linux.release.x86_64 = "res://addons/hello_gdextension_plugin/bin/libhello_gdextension.linux.template_release.x86_64.so"
+macos.debug = "res://addons/hello_gdextension_plugin/bin/libhello_gdextension.macos.template_debug.framework"
+macos.release = "res://addons/hello_gdextension_plugin/bin/libhello_gdextension.macos.template_release.framework" \ No newline at end of file
diff --git a/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/hello_gdextension_export_plugin.gd b/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/hello_gdextension_export_plugin.gd
new file mode 100644
index 0000000..7829c24
--- /dev/null
+++ b/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/hello_gdextension_export_plugin.gd
@@ -0,0 +1,33 @@
+@tool
+extends EditorPlugin
+
+# A class member to hold the export plugin during its lifecycle
+var export_plugin : AndroidExportPlugin
+
+func _enter_tree():
+ # Initialization of the plugin goes here.
+ export_plugin = AndroidExportPlugin.new()
+ add_export_plugin(export_plugin)
+
+
+func _exit_tree():
+ # Clean up of the plugin goes here.
+ remove_export_plugin(export_plugin)
+ export_plugin = null
+
+
+class AndroidExportPlugin extends EditorExportPlugin:
+
+ func _supports_platform(platform):
+ if platform is EditorExportPlatformAndroid:
+ return true
+ return false
+
+ func _get_android_libraries(platform, debug):
+ if debug:
+ return PackedStringArray(["hello_gdextension_plugin/bin/debug/HelloGDExtension.debug.aar"])
+ else:
+ return PackedStringArray(["hello_gdextension_plugin/bin/release/HelloGDExtension.release.aar"])
+
+ func _get_name():
+ return "Hello GDExtension plugin"
diff --git a/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/interface/android_icon.svg b/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/interface/android_icon.svg
new file mode 100644
index 0000000..29c0fde
--- /dev/null
+++ b/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/interface/android_icon.svg
@@ -0,0 +1,2 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="128" viewBox="0 -960 960 960" width="128"><path
+ d="M40-239q8-106 65-196.5T256-579l-75-129q-3-9-.5-18t10.5-14q9-5 19.5-2t15.5 12l74 127q86-37 180-37t180 37l75-127q5-9 15.5-12t19.5 2q8 5 11.5 14.5T780-708l-76 129q94 53 151 143.5T920-239H40Zm240-110q20 0 35-15t15-35q0-20-15-35t-35-15q-20 0-35 15t-15 35q0 20 15 35t35 15Zm400 0q20 0 35-15t15-35q0-20-15-35t-35-15q-20 0-35 15t-15 35q0 20 15 35t35 15Z"/></svg>
diff --git a/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/interface/hello_gdextension_plugin.gd b/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/interface/hello_gdextension_plugin.gd
new file mode 100644
index 0000000..b46fb27
--- /dev/null
+++ b/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/interface/hello_gdextension_plugin.gd
@@ -0,0 +1,26 @@
+class_name HelloGDExtensionPlugin extends Object
+
+## Interface used to access the functionality provided by the HelloGDExtension plugin
+
+var _hello_gdextension_singleton
+
+func _init():
+ if Engine.has_singleton("HelloGDExtension"):
+ _hello_gdextension_singleton = Engine.get_singleton("HelloGDExtension")
+ else:
+ printerr("Couldn't find HelloGDExtension singleton")
+
+
+## Add a GDExample node
+func add_gdexample_node(parent_node_path: NodePath):
+ if _hello_gdextension_singleton:
+ _hello_gdextension_singleton.addGDExampleNode(parent_node_path)
+ else:
+ printerr("Unable to add gdexample node")
+
+## Update the visibility of the gdexample node
+func set_gdexample_visible(visible: bool):
+ if _hello_gdextension_singleton:
+ _hello_gdextension_singleton.setGDExampleVisible(visible)
+ else:
+ printerr("Unable to update gdexample visibility")
diff --git a/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/plugin.cfg b/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/plugin.cfg
new file mode 100644
index 0000000..c9f51e0
--- /dev/null
+++ b/plugins/hello_gdextension/demo/addons/hello_gdextension_plugin/plugin.cfg
@@ -0,0 +1,7 @@
+[plugin]
+
+name="Hello GDExtension plugin"
+description="Showcases how to package an Android GDExtension plugin"
+author="Fredia Huya-Kouadio"
+version=""
+script="hello_gdextension_export_plugin.gd"