From bd91b80b2ca344ad1efefd39b49243a19a6ce7b6 Mon Sep 17 00:00:00 2001 From: Nathan Franke Date: Wed, 20 Jul 2022 05:39:23 -0500 Subject: [PATCH] use gdextension config name as library name makes extension library more readable after export --- SConstruct | 16 ++++++++++------ project/addons/example/example.gdextension | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/SConstruct b/SConstruct index bffff29..fd268be 100644 --- a/SConstruct +++ b/SConstruct @@ -1,6 +1,7 @@ #!/usr/bin/env python import os from glob import glob +from pathlib import Path # TODO: Do not copy environment after godot-cpp/test is updated . env = SConscript("godot-cpp/SConstruct") @@ -8,8 +9,11 @@ env = SConscript("godot-cpp/SConstruct") env.Append(CPPPATH=["src/"]) sources = Glob("src/*.cpp") -# Find correct addons path even if the directory is renamed. -(addon_path,) = glob("project/addons/*/") +# Find correct addons path even if the directory or extension is renamed. +(extension_path,) = glob("project/addons/*/*.gdextension") + +addon_path = Path(extension_path).parent +extension_name = Path(extension_path).stem scons_cache_path = os.environ.get("SCONS_CACHE") if scons_cache_path != None: @@ -18,10 +22,9 @@ if scons_cache_path != None: if env["platform"] == "osx": library = env.SharedLibrary( - "{}/bin/libgdextension.{}.{}.framework/libgdextension.{}.{}".format( + "{}/bin/lib{}.{}.{}.framework/{1}.{2}.{3}".format( addon_path, - env["platform"], - env["target"], + extension_name, env["platform"], env["target"], ), @@ -29,8 +32,9 @@ if env["platform"] == "osx": ) else: library = env.SharedLibrary( - "{}/bin/libgdextension.{}.{}.{}{}".format( + "{}/bin/lib{}.{}.{}.{}{}".format( addon_path, + extension_name, env["platform"], env["target"], env["arch_suffix"], diff --git a/project/addons/example/example.gdextension b/project/addons/example/example.gdextension index b14e365..38039f3 100644 --- a/project/addons/example/example.gdextension +++ b/project/addons/example/example.gdextension @@ -4,13 +4,13 @@ entry_symbol = "gdextension_init" [libraries] -macos.debug = "bin/libgdextension.osx.debug.framework" -macos.release = "bin/libgdextension.osx.release.framework" -windows.debug.x86_64 = "bin/libgdextension.windows.debug.x86_64.dll" -windows.release.x86_64 = "bin/libgdextension.windows.release.x86_64.dll" -linux.debug.x86_64 = "bin/libgdextension.linux.debug.x86_64.so" -linux.release.x86_64 = "bin/libgdextension.linux.release.x86_64.so" -linux.debug.arm64 = "bin/libgdextension.linux.debug.arm64.so" -linux.release.arm64 = "bin/libgdextension.linux.release.arm64.so" -linux.debug.rv64 = "bin/libgdextension.linux.debug.rv64.so" -linux.release.rv64 = "bin/libgdextension.linux.release.rv64.so" +macos.debug = "bin/libexample.osx.debug.framework" +macos.release = "bin/libexample.osx.release.framework" +windows.debug.x86_64 = "bin/libexample.windows.debug.x86_64.dll" +windows.release.x86_64 = "bin/libexample.windows.release.x86_64.dll" +linux.debug.x86_64 = "bin/libexample.linux.debug.x86_64.so" +linux.release.x86_64 = "bin/libexample.linux.release.x86_64.so" +linux.debug.arm64 = "bin/libexample.linux.debug.arm64.so" +linux.release.arm64 = "bin/libexample.linux.release.arm64.so" +linux.debug.rv64 = "bin/libexample.linux.debug.rv64.so" +linux.release.rv64 = "bin/libexample.linux.release.rv64.so"