-
Notifications
You must be signed in to change notification settings - Fork 5
/
SConstruct
85 lines (65 loc) · 2.38 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
#!/usr/bin/env python
import os
env = Environment(tools=["default"], PLATFORM="")
env["disable_exceptions"] = False
# clang terminal colors
if "TERM" in os.environ:
env["ENV"]["TERM"] = os.environ["TERM"]
Export("env")
SConscript("extern/godot-cpp/SConstruct")
if env["platform"] == "macos":
env.Append(RANLIBFLGS="-no_warning_for_no_symbols")
# Using this option makes a warning. Too bad!
opts = Variables([], ARGUMENTS)
opts.Add(BoolVariable("generate_luau_bindings",
"Force generation of Luau bindings", False))
opts.Add(BoolVariable("tests", "Build tests", False))
opts.Add(BoolVariable("iwyu", "Run include-what-you-use on main source", False))
opts.Update(env)
env_base = env.Clone()
env_base["CPPDEFINES"] = [] # irrelevant to externs
Export("env_base")
SConscript("extern/SCSub_Luau.py")
SConscript("SCSub_bindgen.py")
env_main = env.Clone()
if env["iwyu"]:
env_main["CC"] = "include-what-you-use"
env_main["CXX"] = "include-what-you-use "
env_main.Prepend(CXXFLAGS=["-Xiwyu", "--transitive_includes_only"])
sources = Glob("src/*.cpp")
sources += Glob("src/*/*.cpp")
env_main.Append(CPPPATH=["src/"])
# Catch2
if env["tests"]:
if env["target"] != "editor":
raise ValueError("Tests can only be enabled on the editor target")
env_main.Append(CPPDEFINES="TESTS_ENABLED", CPPPATH=["extern/Catch2/extras/"])
sources.append(File("extern/Catch2/extras/catch_amalgamated.cpp"))
sources += Glob("tests/*.cpp")
sources += Glob("tests/*/*.cpp")
env_main.Append(CPPPATH=["tests/"])
if env["platform"] == "macos":
library = env_main.SharedLibrary(
"bin/luau-script/libluau-script.{}.{}.framework/libluau-script.{}.{}".format(
env["platform"], env["target"], env["platform"], env["target"]
),
source=sources,
)
elif env["platform"] == "ios":
if env["ios_simulator"]:
library = env.StaticLibrary(
"bin/luau-script/libluau-script.{}.{}.simulator.a".format(env["platform"], env["target"]),
source=sources,
)
else:
library = env.StaticLibrary(
"bin/luau-script/libluau-script.{}.{}.a".format(env["platform"], env["target"]),
source=sources,
)
else:
library = env_main.SharedLibrary(
"bin/luau-script/libluau-script{}{}".format(
env["suffix"], env["SHLIBSUFFIX"]),
source=sources,
)
Default(library)