forked from 2shady4u/godot-sqlite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSConstruct
More file actions
105 lines (94 loc) · 3.05 KB
/
Copy pathSConstruct
File metadata and controls
105 lines (94 loc) · 3.05 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env python
from misc.utility.classes import CompileTimeOption
options: list = [
CompileTimeOption(
key="enable_fts5",
name="FTS5",
help="Enable SQLite's FTS5 extension which provides full-test search functionality to database applications",
define="SQLITE_ENABLE_FTS5",
),
CompileTimeOption(
key="enable_math_functions",
name="MATH_FUNCTIONS",
help="Enable SQLite's Built-in Mathematical SQL Functions",
define="SQLITE_ENABLE_MATH_FUNCTIONS",
),
CompileTimeOption(
key="enable_rtree",
name="RTREE",
help="Enable SQLite's R*Tree Module",
define="SQLITE_ENABLE_RTREE",
),
]
target_path = ARGUMENTS.pop("target_path", "demo/addons/godot-sqlite/bin/")
target_name = ARGUMENTS.pop("target_name", "libgdsqlite")
parsed_options = {x.key: ARGUMENTS.pop(x.key) for x in options if x.key in ARGUMENTS}
env = SConscript("godot-cpp/SConstruct")
ARGUMENTS.update(parsed_options)
env_vars = Variables()
option: CompileTimeOption
[env_vars.Add(BoolVariable(x.key, x.help, False)) for x in options]
env_vars.Update(env)
Help(env_vars.GenerateHelpText(env))
target = "{}{}".format(
target_path, target_name
)
# For the reference:
# - CCFLAGS are compilation flags shared between C and C++
# - CFLAGS are for C-specific compilation flags
# - CXXFLAGS are for C++-specific compilation flags
# - CPPFLAGS are for pre-processor flags
# - CPPDEFINES are for pre-processor defines
# - LINKFLAGS are for linking flags
# tweak this if you want to use different folders, or more folders, to store your source code in.
env.Append(CPPPATH=["src/"])
sources = [Glob("src/*.cpp"), Glob("src/vfs/*.cpp"), "src/sqlite/sqlite3.c"]
if env["target"] in ["editor", "template_debug"]:
doc_data = env.GodotCPPDocData("src/gen/doc_data.gen.cpp", source=Glob("doc_classes/*.xml"))
sources.append(doc_data)
option: CompileTimeOption
for option in options:
if env[option.key]:
print(f"{option.name} is enabled.")
env.Append(CPPDEFINES=[option.define])
else:
print(f"{option.name} is disabled.")
if env["platform"] == "macos":
library = env.SharedLibrary(
"{}.{}.{}.framework/{}.{}.{}".format(
target,
env["platform"],
env["target"],
target_name,
env["platform"],
env["target"]
),
source=sources,
)
elif env["platform"] == "ios":
if env["ios_simulator"]:
library = env.StaticLibrary(
"{}.{}.{}.simulator.a".format(
target,
env["platform"],
env["target"]),
source=sources,
)
else:
library = env.StaticLibrary(
"{}.{}.{}.a".format(
target,
env["platform"],
env["target"]),
source=sources,
)
else:
library = env.SharedLibrary(
"{}{}{}".format(
target,
env["suffix"],
env["SHLIBSUFFIX"]
),
source=sources,
)
Default(library)