-
Notifications
You must be signed in to change notification settings - Fork 2
/
SConstruct
89 lines (69 loc) · 2.64 KB
/
SConstruct
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env python
import os
import sys
env = SConscript("godot-cpp/SConstruct")
lua_env = env.Clone()
module_env = env.Clone()
if env["target"] == "template_debug":
lua_env.Append(CCFLAGS=["-g"])
module_env.Append(CCFLAGS=["-g"])
if lua_env["platform"] == "linux":
lua_env.Append(CPPDEFINES=["LUA_USE_POSIX"])
elif lua_env["platform"] == "ios":
lua_env.Append(CPPDEFINES=["LUA_USE_IOS"])
lua_env.Append(CPPDEFINES = ["MAKE_LIB"])
lua_env.Append(CXXFLAGS = ["-std=c++17"])
lua_env.Append(CFLAGS = ["-std=c99"])
module_env.Append(CXXFLAGS = ["-Wno-non-pod-varargs"])
cpp_paths = [Dir("src").abspath, Dir("/").abspath, Dir("src/classes/roblox").abspath]
lua_cpp_paths = []
luau_paths = [
"Common",
"Ast",
"Compiler",
"CodeGen",
"Analysis",
"VM",
#"extern/isocline",
]
luau_include_paths = [os.path.join("luau", x, "include") for x in luau_paths]
luau_source_paths = [os.path.join("luau", x, "src") for x in luau_paths]
lua_cpp_paths.extend(luau_include_paths)
lua_cpp_paths.extend(luau_source_paths)
cpp_paths.extend(luau_include_paths)
lua_env.AppendUnique(CPPPATH=lua_cpp_paths, delete_existing=True)
module_env.Append(CPPPATH=cpp_paths)
lua_sources = []
for path in luau_include_paths:
lua_sources.extend(Glob(path + "/*.hpp"))
lua_sources.extend(Glob(path + "/*.h"))
lua_sources.extend(Glob(path + "/*.cpp"))
lua_sources.extend(Glob(path + "/*.c"))
for path in luau_source_paths:
lua_sources.extend(Glob(path + "/*.hpp"))
lua_sources.extend(Glob(path + "/*.h"))
lua_sources.extend(Glob(path + "/*.cpp"))
lua_sources.extend(Glob(path + "/*.c"))
library_name = "RobloxToGodotProject{}{}".format(env['suffix'], env["LIBSUFFIX"])
library = lua_env.StaticLibrary("bin/{}".format(library_name), source=lua_sources)
module_env.Default(library)
module_env.Append(LIBPATH=[Dir("bin").abspath])
module_env.Append(LIBS=[library_name])
sources = Glob("*.cpp")
sources.append(Glob("src/*.cpp"))
sources.append(Glob("src/classes/*.cpp"))
sources.append(Glob("src/classes/roblox/core/*.cpp"))
env["suffix"] = env["suffix"].replace(".dev", "").replace(".double", "").replace(".simulator", "")
if env["platform"] == "macos":
library = module_env.SharedLibrary(
"demo/addons/RobloxToGodotProject/bin/libRobloxToGodotProject.{}.{}.framework/libRobloxToGodotProject.{}.{}".format(
env["platform"], env["target"], env["platform"], env["target"]
),
source=sources,
)
else:
library = module_env.SharedLibrary(
"demo/addons/RobloxToGodotProject/bin/libRobloxToGodotProject{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),
source=sources,
)
env.Default(library)