|
|
|
@ -6,20 +6,27 @@ from pathlib import Path
|
|
|
|
# TODO: Do not copy environment after godot-cpp/test is updated <https://github.com/godotengine/godot-cpp/blob/master/test/SConstruct>.
|
|
|
|
# TODO: Do not copy environment after godot-cpp/test is updated <https://github.com/godotengine/godot-cpp/blob/master/test/SConstruct>.
|
|
|
|
env = SConscript("godot-cpp/SConstruct")
|
|
|
|
env = SConscript("godot-cpp/SConstruct")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add source files.
|
|
|
|
env.Append(CPPPATH=["src/"])
|
|
|
|
env.Append(CPPPATH=["src/"])
|
|
|
|
sources = Glob("src/*.cpp")
|
|
|
|
sources = Glob("src/*.cpp")
|
|
|
|
|
|
|
|
|
|
|
|
# Find correct addons path even if the directory or extension is renamed.
|
|
|
|
# Find gdextension path even if the directory or extension is renamed.
|
|
|
|
|
|
|
|
# Example: project/addons/example/example.gdextension
|
|
|
|
(extension_path,) = glob("project/addons/*/*.gdextension")
|
|
|
|
(extension_path,) = glob("project/addons/*/*.gdextension")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Find the addon path (e.g. project/addons/example).
|
|
|
|
addon_path = Path(extension_path).parent
|
|
|
|
addon_path = Path(extension_path).parent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Find the extension name from the gdextension file (e.g. example).
|
|
|
|
extension_name = Path(extension_path).stem
|
|
|
|
extension_name = Path(extension_path).stem
|
|
|
|
|
|
|
|
|
|
|
|
scons_cache_path = os.environ.get("SCONS_CACHE")
|
|
|
|
# TODO: Cache is disabled currently.
|
|
|
|
if scons_cache_path != None:
|
|
|
|
# scons_cache_path = os.environ.get("SCONS_CACHE")
|
|
|
|
CacheDir(scons_cache_path)
|
|
|
|
# if scons_cache_path != None:
|
|
|
|
print("Scons cache enabled... (path: '" + scons_cache_path + "')")
|
|
|
|
# CacheDir(scons_cache_path)
|
|
|
|
|
|
|
|
# print("Scons cache enabled... (path: '" + scons_cache_path + "')")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Create the library target (e.g. libexample.linux.debug.x86_64.so).
|
|
|
|
if env["platform"] == "osx":
|
|
|
|
if env["platform"] == "osx":
|
|
|
|
library = env.SharedLibrary(
|
|
|
|
library = env.SharedLibrary(
|
|
|
|
"{}/bin/lib{}.{}.{}.framework/{1}.{2}.{3}".format(
|
|
|
|
"{}/bin/lib{}.{}.{}.framework/{1}.{2}.{3}".format(
|
|
|
|
|