mirror of
https://github.com/godotengine/godot-cpp.git
synced 2025-12-31 01:48:45 +03:00
Generate GDExtension interface header and loader from JSON
This commit is contained in:
@@ -149,6 +149,11 @@ def scons_emit_files(target, source, env):
|
||||
env.Depends(file, profile_filepath)
|
||||
files.append(file)
|
||||
env["godot_cpp_gen_dir"] = target[0].abspath
|
||||
|
||||
# gdextension_interface.h shouldn't depend on extension_api.json or the build_profile.json.
|
||||
gdextension_interface_header = os.path.join(str(target[0]), "gen", "include", "gdextension_interface.h")
|
||||
env.Ignore(gdextension_interface_header, [source[0], profile_filepath])
|
||||
|
||||
return files, source
|
||||
|
||||
|
||||
@@ -162,6 +167,7 @@ def scons_generate_bindings(target, source, env):
|
||||
_generate_bindings(
|
||||
api,
|
||||
str(source[0]),
|
||||
str(source[1]),
|
||||
env["generate_template_get_node"],
|
||||
"32" if "32" in env["arch"] else "64",
|
||||
env["precision"],
|
||||
@@ -376,6 +382,7 @@ def options(opts, env):
|
||||
)
|
||||
)
|
||||
opts.Add(BoolVariable("debug_symbols", "Build with debugging symbols", True))
|
||||
opts.Add(BoolVariable("deprecated", "Enable compatibility code for deprecated and removed features", True))
|
||||
opts.Add(BoolVariable("dev_build", "Developer build with dev-only debugging code (DEV_ENABLED)", False))
|
||||
opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False))
|
||||
|
||||
@@ -488,6 +495,9 @@ def generate(env):
|
||||
if env["precision"] == "double":
|
||||
env.Append(CPPDEFINES=["REAL_T_IS_DOUBLE"])
|
||||
|
||||
if not env["deprecated"]:
|
||||
env.Append(CPPDEFINES=["DISABLE_DEPRECATED"])
|
||||
|
||||
# Allow detecting when building as a GDExtension.
|
||||
env.Append(CPPDEFINES=["GDEXTENSION"])
|
||||
|
||||
@@ -538,8 +548,9 @@ def _godot_cpp(env):
|
||||
env.Dir("."),
|
||||
[
|
||||
api_file,
|
||||
os.path.join(extension_dir, "gdextension_interface.h"),
|
||||
os.path.join(extension_dir, "gdextension_interface.json"),
|
||||
"binding_generator.py",
|
||||
"make_interface_header.py",
|
||||
],
|
||||
)
|
||||
# Forces bindings regeneration.
|
||||
@@ -559,7 +570,6 @@ def _godot_cpp(env):
|
||||
# Includes
|
||||
env.AppendUnique(
|
||||
CPPPATH=[
|
||||
env.Dir(extension_dir),
|
||||
env.Dir("include").srcnode(),
|
||||
env.Dir("gen/include"),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user