mirror of
https://github.com/godotengine/godot-cpp.git
synced 2026-01-03 18:09:13 +03:00
[Bindings] Build profile now strips methods and skip files
This allows removing dependencies that are not explicitly unused by the
gdextension being built and is implemented using an intermediate json
API file with the methods and classes stripped (i.e. without touching
the file generators).
(cherry picked from commit c4f1abe3f9)
This commit is contained in:
committed by
David Snopek
parent
95a29550a7
commit
71b5b84fb1
@@ -10,7 +10,8 @@ from SCons.Tool import Tool
|
||||
from SCons.Variables import BoolVariable, EnumVariable, PathVariable
|
||||
from SCons.Variables.BoolVariable import _text2bool
|
||||
|
||||
from binding_generator import scons_emit_files, scons_generate_bindings
|
||||
from binding_generator import _generate_bindings, _get_file_list, get_file_list
|
||||
from build_profile import generate_trimmed_api
|
||||
|
||||
|
||||
def add_sources(sources, dir, extension):
|
||||
@@ -129,6 +130,37 @@ def no_verbose(env):
|
||||
env.Append(GENCOMSTR=[generated_file_message])
|
||||
|
||||
|
||||
def scons_emit_files(target, source, env):
|
||||
profile_filepath = env.get("build_profile", "")
|
||||
if profile_filepath:
|
||||
profile_filepath = normalize_path(profile_filepath, env)
|
||||
|
||||
# Always clean all files
|
||||
env.Clean(target, [env.File(f) for f in get_file_list(str(source[0]), target[0].abspath, True, True)])
|
||||
|
||||
api = generate_trimmed_api(str(source[0]), profile_filepath)
|
||||
files = [env.File(f) for f in _get_file_list(api, target[0].abspath, True, True)]
|
||||
env["godot_cpp_gen_dir"] = target[0].abspath
|
||||
return files, source
|
||||
|
||||
|
||||
def scons_generate_bindings(target, source, env):
|
||||
profile_filepath = env.get("build_profile", "")
|
||||
if profile_filepath:
|
||||
profile_filepath = normalize_path(profile_filepath, env)
|
||||
|
||||
api = generate_trimmed_api(str(source[0]), profile_filepath)
|
||||
|
||||
_generate_bindings(
|
||||
api,
|
||||
env["generate_template_get_node"],
|
||||
"32" if "32" in env["arch"] else "64",
|
||||
env["precision"],
|
||||
env["godot_cpp_gen_dir"],
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
platforms = ["linux", "macos", "windows", "android", "ios", "web"]
|
||||
|
||||
# CPU architecture options.
|
||||
|
||||
Reference in New Issue
Block a user