From a009ff69f2b1c9791f386c74f5520aaeb178a90f Mon Sep 17 00:00:00 2001 From: Lukas Tenbrink Date: Thu, 10 Apr 2025 00:03:06 +0200 Subject: [PATCH] Rename windows libraries to drop the `lib` prefix, as this is not customary on Windows. Drop `universal.` suffix on macOS, as this is implied if there is no distinction between arches. Add more targets for the .gdextension file, including web, more linux targets, and separate single and double builds. --- SConstruct | 11 +++--- demo/bin/example.gdextension | 67 ++++++++++++++++++++++++++---------- 2 files changed, 56 insertions(+), 22 deletions(-) diff --git a/SConstruct b/SConstruct index 5ed3e7d..d3bb2fc 100644 --- a/SConstruct +++ b/SConstruct @@ -53,15 +53,18 @@ if env["target"] in ["editor", "template_debug"]: except AttributeError: print("Not including class reference as we're targeting a pre-4.3 baseline.") -file = "{}{}{}".format(libname, env["suffix"], env["SHLIBSUFFIX"]) +# .dev doesn't inhibit compatibility, so we don't need to key it. +# .universal just means "compatible with all relevant arches" so we don't need to key it. +suffix = env['suffix'].replace(".dev", "").replace(".universal", "") + +lib_filename = "{}{}{}{}".format(env.subst('$SHLIBPREFIX'), libname, suffix, env.subst('$SHLIBSUFFIX')) -libraryfile = "bin/{}/{}".format(env["platform"], file) library = env.SharedLibrary( - libraryfile, + "bin/{}/{}".format(env['platform'], lib_filename), source=sources, ) -copy = env.InstallAs("{}/bin/{}/lib{}".format(projectdir, env["platform"], file), library) +copy = env.Install("{}/bin/{}/".format(projectdir, env["platform"]), library) default_args = [library, copy] Default(*default_args) diff --git a/demo/bin/example.gdextension b/demo/bin/example.gdextension index 4333fba..9672a4b 100644 --- a/demo/bin/example.gdextension +++ b/demo/bin/example.gdextension @@ -5,21 +5,52 @@ compatibility_minimum = "4.1" [libraries] ; Relative paths ensure that our GDExtension can be placed anywhere in the project directory. -macos.debug = "./macos/libEXTENSION-NAME.macos.template_debug.universal.dylib" -macos.release = "./macos/libEXTENSION-NAME.macos.template_release.universal.dylib" -ios.debug = "./ios/libEXTENSION-NAME.ios.template_debug.arm64.dylib" -ios.release = "./ios/libEXTENSION-NAME.ios.template_release.arm64.dylib" -windows.debug.x86_32 = "./windows/libEXTENSION-NAME.windows.template_debug.x86_32.dll" -windows.release.x86_32 = "./windows/libEXTENSION-NAME.windows.template_release.x86_32.dll" -windows.debug.x86_64 = "./windows/libEXTENSION-NAME.windows.template_debug.x86_64.dll" -windows.release.x86_64 = "./windows/libEXTENSION-NAME.windows.template_release.x86_64.dll" -linux.debug.x86_64 = "./linux/libEXTENSION-NAME.linux.template_debug.x86_64.so" -linux.release.x86_64 = "./linux/libEXTENSION-NAME.linux.template_release.x86_64.so" -linux.debug.arm64 = "./linux/libEXTENSION-NAME.linux.template_debug.arm64.so" -linux.release.arm64 = "./linux/libEXTENSION-NAME.linux.template_release.arm64.so" -linux.debug.rv64 = "./linux/libEXTENSION-NAME.linux.template_debug.rv64.so" -linux.release.rv64 = "./linux/libEXTENSION-NAME.linux.template_release.rv64.so" -android.debug.x86_64 = "./android/libEXTENSION-NAME.android.template_debug.x86_64.so" -android.release.x86_64 = "./android/libEXTENSION-NAME.android.template_release.x86_64.so" -android.debug.arm64 = "./android/libEXTENSION-NAME.android.template_debug.arm64.so" -android.release.arm64 = "./android/libEXTENSION-NAME.android.template_release.arm64.so" +macos.single.debug = "./macos/libEXTENSION-NAME.macos.template_debug.dylib" +macos.double.debug = "./macos/libEXTENSION-NAME.macos.template_debug.double.dylib" +macos.single.release = "./macos/libEXTENSION-NAME.macos.template_release.dylib" +macos.double.release = "./macos/libEXTENSION-NAME.macos.template_debug.double.dylib" + +ios.arm64.single.debug = "./ios/libEXTENSION-NAME.ios.template_debug.arm64.dylib" +ios.arm64.double.debug = "./ios/libEXTENSION-NAME.ios.template_debug.arm64.double.dylib" +ios.arm64.single.release = "./ios/libEXTENSION-NAME.ios.template_release.arm64.dylib" +ios.arm64.double.release = "./ios/libEXTENSION-NAME.ios.template_release.arm64.double.dylib" + +windows.x86_32.single.debug = "./windows/EXTENSION-NAME.windows.template_debug.x86_32.dll" +windows.x86_32.double.debug = "./windows/EXTENSION-NAME.windows.template_debug.x86_32.double.dll" +windows.x86_32.single.release = "./windows/EXTENSION-NAME.windows.template_release.x86_32.dll" +windows.x86_32.double.release = "./windows/EXTENSION-NAME.windows.template_release.x86_32.double.dll" + +windows.x86_64.single.debug = "./windows/EXTENSION-NAME.windows.template_debug.x86_64.dll" +windows.x86_64.double.debug = "./windows/EXTENSION-NAME.windows.template_debug.x86_64.double.dll" +windows.x86_64.single.release = "./windows/EXTENSION-NAME.windows.template_release.x86_64.dll" +windows.x86_64.double.release = "./windows/EXTENSION-NAME.windows.template_release.x86_64.double.dll" + +linux.x86_64.single.debug = "./linux/libEXTENSION-NAME.linux.template_debug.x86_64.so" +linux.x86_64.double.debug = "./linux/libEXTENSION-NAME.linux.template_debug.x86_64.double.so" +linux.x86_64.single.release = "./linux/libEXTENSION-NAME.linux.template_release.x86_64.so" +linux.x86_64.double.release = "./linux/libEXTENSION-NAME.linux.template_release.x86_64.double.so" + +linux.arm64.single.debug = "./linux/libEXTENSION-NAME.linux.template_debug.arm64.so" +linux.arm64.double.debug = "./linux/libEXTENSION-NAME.linux.template_debug.arm64.double.so" +linux.arm64.single.release = "./linux/libEXTENSION-NAME.linux.template_release.arm64.so" +linux.arm64.double.release = "./linux/libEXTENSION-NAME.linux.template_release.arm64.double.so" + +linux.rv64.single.debug = "./linux/libEXTENSION-NAME.linux.template_debug.rv64.so" +linux.rv64.double.debug = "./linux/libEXTENSION-NAME.linux.template_debug.rv64.double.so" +linux.rv64.single.release = "./linux/libEXTENSION-NAME.linux.template_release.rv64.so" +linux.rv64.double.release = "./linux/libEXTENSION-NAME.linux.template_release.rv64.double.so" + +android.x86_64.single.debug = "./android/libEXTENSION-NAME.android.template_debug.x86_64.so" +android.x86_64.double.debug = "./android/libEXTENSION-NAME.android.template_debug.x86_64.double.so" +android.x86_64.single.release = "./android/libEXTENSION-NAME.android.template_release.x86_64.so" +android.x86_64.double.release = "./android/libEXTENSION-NAME.android.template_release.x86_64.double.so" + +android.arm64.single.debug = "./android/libEXTENSION-NAME.android.template_debug.arm64.so" +android.arm64.double.debug = "./android/libEXTENSION-NAME.android.template_debug.arm64.double.so" +android.arm64.single.release = "./android/libEXTENSION-NAME.android.template_release.arm64.so" +android.arm64.double.release = "./android/libEXTENSION-NAME.android.template_release.arm64.double.so" + +web.wasm32.single.debug = "./web/libEXTENSION-NAME.web.template_debug.wasm32.nothreads.wasm" +web.wasm32.double.debug = "./web/libEXTENSION-NAME.web.template_release.wasm32.double.nothreads.wasm" +web.wasm32.single.release = "./web/libEXTENSION-NAME.web.template_release.wasm32.nothreads.wasm" +web.wasm32.double.release = "./web/libEXTENSION-NAME.web.template_release.wasm32.double.nothreads.wasm"