48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
#!/usr/bin/env python
|
|
import os
|
|
|
|
|
|
libname = "EXTENSION-NAME"
|
|
projectdir = "demo"
|
|
|
|
localEnv = Environment(tools=["default"], PLATFORM="")
|
|
|
|
customs = ["custom.py"]
|
|
customs = [os.path.abspath(path) for path in customs]
|
|
|
|
opts = Variables(customs, ARGUMENTS)
|
|
opts.Update(localEnv)
|
|
|
|
Help(opts.GenerateHelpText(localEnv))
|
|
|
|
env = localEnv.Clone()
|
|
|
|
env = SConscript("godot-cpp/SConstruct", {"env": env, "customs": customs})
|
|
|
|
env.Append(CPPPATH=["src/"])
|
|
sources = Glob("src/*.cpp")
|
|
|
|
if env["target"] in ["editor", "template_debug"]:
|
|
try:
|
|
doc_data = env.GodotCPPDocData("src/gen/doc_data.gen.cpp", source=Glob("doc_classes/*.xml"))
|
|
sources.append(doc_data)
|
|
except AttributeError:
|
|
print("Not including class reference as we're targeting a pre-4.3 baseline.")
|
|
|
|
file = "{}{}{}".format(libname, env["suffix"], env["SHLIBSUFFIX"])
|
|
|
|
if env["platform"] == "macos" or env["platform"] == "ios":
|
|
platlibname = "{}.{}.{}".format(libname, env["platform"], env["target"])
|
|
file = "{}.framework/{}".format(env["platform"], platlibname, platlibname)
|
|
|
|
libraryfile = "bin/{}/{}".format(env["platform"], file)
|
|
library = env.SharedLibrary(
|
|
libraryfile,
|
|
source=sources,
|
|
)
|
|
|
|
copy = env.InstallAs("{}/bin/{}/lib{}".format(projectdir, env["platform"], file), library)
|
|
|
|
default_args = [library, copy]
|
|
Default(*default_args)
|