From 2a71f14e766c89474469e93ea97c4dd4f5a78c4a Mon Sep 17 00:00:00 2001 From: Lukas Tenbrink Date: Tue, 17 Sep 2024 02:25:31 +0200 Subject: [PATCH 1/6] Fix macos demo build target in SConstruct --- SConstruct | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SConstruct b/SConstruct index 227e1d6..05dafd0 100644 --- a/SConstruct +++ b/SConstruct @@ -77,18 +77,19 @@ if env["target"] in ["editor", "template_debug"]: print("Not including class reference as we're targeting a pre-4.3 baseline.") file = "{}{}{}".format(libname, env["suffix"], env["SHLIBSUFFIX"]) +filepath = "" if env["platform"] == "macos" or env["platform"] == "ios": - platlibname = "{}.{}.{}".format(libname, env["platform"], env["target"]) - file = "{}.framework/{}".format(env["platform"], platlibname, platlibname) + filepath = "{}.framework/".format(env["platform"]) + file = "{}.{}.{}".format(libname, env["platform"], env["target"]) -libraryfile = "bin/{}/{}".format(env["platform"], file) +libraryfile = "bin/{}/{}{}".format(env["platform"], filepath, file) library = env.SharedLibrary( libraryfile, source=sources, ) -copy = env.InstallAs("{}/bin/{}/lib{}".format(projectdir, env["platform"], file), library) +copy = env.InstallAs("{}/bin/{}/{}lib{}".format(projectdir, env["platform"], filepath, file), library) default_args = [library, copy] if localEnv.get("compiledb", False): From df8b05b592690c5f31dd96c4aea3833e0308c7ad Mon Sep 17 00:00:00 2001 From: Lukas Tenbrink Date: Tue, 17 Sep 2024 02:29:35 +0200 Subject: [PATCH 2/6] Update example.gdextension to reflect the actual paths of the framework files. --- demo/bin/example.gdextension | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/demo/bin/example.gdextension b/demo/bin/example.gdextension index 679baf6..af7b18e 100644 --- a/demo/bin/example.gdextension +++ b/demo/bin/example.gdextension @@ -5,21 +5,21 @@ compatibility_minimum = "4.1" [libraries] -macos.debug = "res://bin/libgdexample.macos.template_debug.framework" -macos.release = "res://bin/libgdexample.macos.template_release.framework" -ios.debug = "res://bin/libgdexample.ios.template_debug.framework" -ios.release = "res://bin/libgdexample.ios.template_release.framework" -windows.debug.x86_32 = "res://bin/libgdexample.windows.template_debug.x86_32.dll" -windows.release.x86_32 = "res://bin/libgdexample.windows.template_release.x86_32.dll" -windows.debug.x86_64 = "res://bin/libgdexample.windows.template_debug.x86_64.dll" -windows.release.x86_64 = "res://bin/libgdexample.windows.template_release.x86_64.dll" -linux.debug.x86_64 = "res://bin/libgdexample.linux.template_debug.x86_64.so" -linux.release.x86_64 = "res://bin/libgdexample.linux.template_release.x86_64.so" -linux.debug.arm64 = "res://bin/libgdexample.linux.template_debug.arm64.so" -linux.release.arm64 = "res://bin/libgdexample.linux.template_release.arm64.so" -linux.debug.rv64 = "res://bin/libgdexample.linux.template_debug.rv64.so" -linux.release.rv64 = "res://bin/libgdexample.linux.template_release.rv64.so" -android.debug.x86_64 = "res://bin/libgdexample.android.template_debug.x86_64.so" -android.release.x86_64 = "res://bin/libgdexample.android.template_release.x86_64.so" -android.debug.arm64 = "res://bin/libgdexample.android.template_debug.arm64.so" -android.release.arm64 = "res://bin/libgdexample.android.template_release.arm64.so" +macos.debug = "res://bin/macos/macos.framework/libgdexample.macos.template_debug" +macos.release = "res://bin/macos/macos.framework/libgdexample.macos.template_release" +ios.debug = "res://bin/ios/ios.framework/libgdexample.ios.template_debug" +ios.release = "res://bin/ios/ios.framework/libgdexample.ios.template_release" +windows.debug.x86_32 = "res://bin/windows/libgdexample.windows.template_debug.x86_32.dll" +windows.release.x86_32 = "res://bin/windows/libgdexample.windows.template_release.x86_32.dll" +windows.debug.x86_64 = "res://bin/windows/libgdexample.windows.template_debug.x86_64.dll" +windows.release.x86_64 = "res://bin/windows/libgdexample.windows.template_release.x86_64.dll" +linux.debug.x86_64 = "res://bin/linux/libgdexample.linux.template_debug.x86_64.so" +linux.release.x86_64 = "res://bin/linux/libgdexample.linux.template_release.x86_64.so" +linux.debug.arm64 = "res://bin/linux/libgdexample.linux.template_debug.arm64.so" +linux.release.arm64 = "res://bin/linux/libgdexample.linux.template_release.arm64.so" +linux.debug.rv64 = "res://bin/linux/libgdexample.linux.template_debug.rv64.so" +linux.release.rv64 = "res://bin/linux/libgdexample.linux.template_release.rv64.so" +android.debug.x86_64 = "res://bin/android/libgdexample.android.template_debug.x86_64.so" +android.release.x86_64 = "res://bin/android/libgdexample.android.template_release.x86_64.so" +android.debug.arm64 = "res://bin/android/libgdexample.android.template_debug.arm64.so" +android.release.arm64 = "res://bin/android/libgdexample.android.template_release.arm64.so" From 921c6efd05bc853aa41492579b971202d9268bf3 Mon Sep 17 00:00:00 2001 From: Lukas Tenbrink Date: Fri, 20 Sep 2024 20:51:34 +0200 Subject: [PATCH 3/6] Remove invalid production=yes flag from github action --- .github/actions/build/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 99f8197..1430616 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -116,5 +116,5 @@ runs: env: SCONS_CACHE: ${{ github.workspace }}/${{ inputs.gdextension-location }}/${{ inputs.scons-cache }}/ run: | - scons target=${{ inputs.build-target-type }} platform=${{ inputs.platform }} arch=${{ inputs.arch }} precision=${{ inputs.float-precision }} production=yes + scons target=${{ inputs.build-target-type }} platform=${{ inputs.platform }} arch=${{ inputs.arch }} precision=${{ inputs.float-precision }} working-directory: ${{ inputs.gdextension-location }} From f2c6564c054f61ab0482b254b6a5b9d240ca3590 Mon Sep 17 00:00:00 2001 From: David Snopek Date: Sun, 29 Sep 2024 11:59:28 -0500 Subject: [PATCH 4/6] Ignore files generated for documentation --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index da0f870..de83b56 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,9 @@ custom.py # Ignore generated compile_commands.json compile_commands.json +# Ignore files generated for documentation +/src/gen + # Binaries *.o *.os From 14f4f5a8ad056c5ba829e8a446a18a5e45f7df2c Mon Sep 17 00:00:00 2001 From: David Snopek Date: Sun, 29 Sep 2024 12:14:57 -0500 Subject: [PATCH 5/6] Update example.gdextension to match default build artifacts --- demo/bin/example.gdextension | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/demo/bin/example.gdextension b/demo/bin/example.gdextension index af7b18e..f3b7df0 100644 --- a/demo/bin/example.gdextension +++ b/demo/bin/example.gdextension @@ -5,21 +5,21 @@ compatibility_minimum = "4.1" [libraries] -macos.debug = "res://bin/macos/macos.framework/libgdexample.macos.template_debug" -macos.release = "res://bin/macos/macos.framework/libgdexample.macos.template_release" -ios.debug = "res://bin/ios/ios.framework/libgdexample.ios.template_debug" -ios.release = "res://bin/ios/ios.framework/libgdexample.ios.template_release" -windows.debug.x86_32 = "res://bin/windows/libgdexample.windows.template_debug.x86_32.dll" -windows.release.x86_32 = "res://bin/windows/libgdexample.windows.template_release.x86_32.dll" -windows.debug.x86_64 = "res://bin/windows/libgdexample.windows.template_debug.x86_64.dll" -windows.release.x86_64 = "res://bin/windows/libgdexample.windows.template_release.x86_64.dll" -linux.debug.x86_64 = "res://bin/linux/libgdexample.linux.template_debug.x86_64.so" -linux.release.x86_64 = "res://bin/linux/libgdexample.linux.template_release.x86_64.so" -linux.debug.arm64 = "res://bin/linux/libgdexample.linux.template_debug.arm64.so" -linux.release.arm64 = "res://bin/linux/libgdexample.linux.template_release.arm64.so" -linux.debug.rv64 = "res://bin/linux/libgdexample.linux.template_debug.rv64.so" -linux.release.rv64 = "res://bin/linux/libgdexample.linux.template_release.rv64.so" -android.debug.x86_64 = "res://bin/android/libgdexample.android.template_debug.x86_64.so" -android.release.x86_64 = "res://bin/android/libgdexample.android.template_release.x86_64.so" -android.debug.arm64 = "res://bin/android/libgdexample.android.template_debug.arm64.so" -android.release.arm64 = "res://bin/android/libgdexample.android.template_release.arm64.so" +macos.debug = "res://bin/macos/macos.framework/libEXTENSION-NAME.macos.template_debug" +macos.release = "res://bin/macos/macos.framework/libEXTENSION-NAME.macos.template_release" +ios.debug = "res://bin/ios/ios.framework/libEXTENSION-NAME.ios.template_debug" +ios.release = "res://bin/ios/ios.framework/libEXTENSION-NAME.ios.template_release" +windows.debug.x86_32 = "res://bin/windows/libEXTENSION-NAME.windows.template_debug.x86_32.dll" +windows.release.x86_32 = "res://bin/windows/libEXTENSION-NAME.windows.template_release.x86_32.dll" +windows.debug.x86_64 = "res://bin/windows/libEXTENSION-NAME.windows.template_debug.x86_64.dll" +windows.release.x86_64 = "res://bin/windows/libEXTENSION-NAME.windows.template_release.x86_64.dll" +linux.debug.x86_64 = "res://bin/linux/libEXTENSION-NAME.linux.template_debug.x86_64.so" +linux.release.x86_64 = "res://bin/linux/libEXTENSION-NAME.linux.template_release.x86_64.so" +linux.debug.arm64 = "res://bin/linux/libEXTENSION-NAME.linux.template_debug.arm64.so" +linux.release.arm64 = "res://bin/linux/libEXTENSION-NAME.linux.template_release.arm64.so" +linux.debug.rv64 = "res://bin/linux/libEXTENSION-NAME.linux.template_debug.rv64.so" +linux.release.rv64 = "res://bin/linux/libEXTENSION-NAME.linux.template_release.rv64.so" +android.debug.x86_64 = "res://bin/android/libEXTENSION-NAME.android.template_debug.x86_64.so" +android.release.x86_64 = "res://bin/android/libEXTENSION-NAME.android.template_release.x86_64.so" +android.debug.arm64 = "res://bin/android/libEXTENSION-NAME.android.template_debug.arm64.so" +android.release.arm64 = "res://bin/android/libEXTENSION-NAME.android.template_release.arm64.so" From 39b718f7fc9026a5401dd62e69099c2331ffd6c0 Mon Sep 17 00:00:00 2001 From: David Snopek Date: Sun, 29 Sep 2024 12:42:26 -0500 Subject: [PATCH 6/6] Replace remaining references to `ClassDB::register_class()` with `GDREGISTER_CLASS()` --- README.md | 2 +- src/register_types.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 01de45a..673595a 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ For getting started after cloning your own copy to your local machine, you shoul * change the pathnames of the to be loaded library name inside the `demo/bin/example.gdextension` file. By replacing `libgdexample` to the name specified in your `SConstruct` file. * change the name of the `demo/bin/example.gdextension` file * change the `entry_symbol` string inside your `demo/bin/your-extension.gdextension` file to be configured for your GDExtension name. This should be the same as the `GDExtensionBool GDE_EXPORT` external C function. As the name suggests, this sets the entry function for your GDExtension to be loaded by the Godot editors C API. -* register the classes you want Godot to interact with inside the `register_types.cpp` file in the initialization method (here `initialize_gdextension_types`) in the syntax `ClassDB::register_class();`. +* register the classes you want Godot to interact with inside the `register_types.cpp` file in the initialization method (here `initialize_gdextension_types`) in the syntax `GDREGISTER_CLASS(CLASS-NAME);`. ## Usage - Actions diff --git a/src/register_types.cpp b/src/register_types.cpp index 2c86044..9f43623 100644 --- a/src/register_types.cpp +++ b/src/register_types.cpp @@ -11,7 +11,7 @@ void initialize_gdextension_types(ModuleInitializationLevel p_level) if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { return; } - //ClassDB::register_class(); + //GDREGISTER_CLASS(YourClass); } void uninitialize_gdextension_types(ModuleInitializationLevel p_level) {