-
Notifications
You must be signed in to change notification settings - Fork 1
/
SConstruct
52 lines (43 loc) · 1.59 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
#!/usr/bin/env python
import os
import sys
env = SConscript("godot-cpp/SConstruct")
# 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
env.Append(CPPPATH=["src/"])
env.Append(LIBS=["accesskit_godot_plugin"])
sources = Glob("src/*.cpp")
rust_target = "debug"
if env["target"] == "template_release":
rust_target = "release"
rust_arch_aliases = {
"x86_64": "x86_64",
"x86_32": "i686",
"arm64": "aarch64",
"rv64": "riscv64gc",
}
rust_arch = env["arch"]
if env["arch"] in rust_arch_aliases.keys():
rust_arch = rust_arch_aliases[env["arch"]]
if env["platform"] == "macos":
rust_platform = "apple-darwin"
elif env["platform"] == "windows":
env.Append(LIBS=["Ws2_32", "Ole32", "OleAut32", "Uiautomationcore", "Advapi32", "User32", "Bcrypt", "Userenv"])
if env.get("is_msvc", False):
rust_platform = "pc-windows-msvc"
else:
rust_platform = "pc-windows-gnu"
elif env["platform"] == "linux":
rust_platform = "unknown-linux-gnu"
else:
print("Unsupported platform")
Exit()
env.Append(LIBPATH=["./rust/target/" + rust_arch + "-" + rust_platform + "/" + rust_target]) # Try arch/platform specific path.
env.Append(LIBPATH=["./rust/target/" + rust_target]) # Also try default one.
library = env.SharedLibrary("demo/bin/libgdaccesskit{}{}".format(env["suffix"], env["SHLIBSUFFIX"]), source=sources)
Default(library)