-
Notifications
You must be signed in to change notification settings - Fork 5
/
SCSub_bindgen.py
38 lines (28 loc) · 1.06 KB
/
SCSub_bindgen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
import os
from luau_binding_generator import scons_emit_files, scons_generate_bindings
Import("env")
env_gen = env.Clone()
env_gen.Append(BUILDERS={"GenerateLuauBindings": Builder(
action=scons_generate_bindings, emitter=scons_emit_files)})
luau_bindings = env_gen.GenerateLuauBindings(
Dir("."),
[
os.path.join(
os.getcwd(), "extern/godot-cpp/gdextension/extension_api.json"),
os.path.join(
os.getcwd(), "bindgen/class_settings.toml"),
os.path.join(
os.getcwd(), "definitions/luauLibTypes.part.d.lua"),
os.path.join(
os.getcwd(), "definitions/godotTypes.part.d.lua")
]
)
if env["generate_luau_bindings"]:
AlwaysBuild(luau_bindings)
sources = [f for f in luau_bindings if str(f).endswith(".cpp")]
env.Append(CPPPATH=["gen/include/"])
env_gen.Append(CPPPATH=["src/", "gen/include/"])
lib = env_gen.Library("gdluau_gen", source=sources)
# Prepend important! This library depends on godot-cpp, so it should be linked *after* this.
env.Prepend(LIBS=[lib])