forked from GodotVR/godot_openxr_vendors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConstruct
86 lines (73 loc) · 2.31 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
#!/usr/bin/env python
from glob import glob
from pathlib import Path
env = SConscript("thirdparty/godot-cpp/SConstruct")
opts = Variables('custom.py')
opts.Update(env)
# Add common includes
env.Append(CPPPATH=[
"#plugin/src/main/cpp/include/",
"#thirdparty/openxr/include/",
])
sources = []
sources += Glob("#plugin/src/main/cpp/*.cpp")
sources += Glob("#plugin/src/main/cpp/export/*.cpp")
sources += Glob("#plugin/src/main/cpp/extensions/*.cpp")
sources += Glob("#plugin/src/main/cpp/classes/*.cpp")
if env["target"] in ["editor", "template_debug"]:
doc_data = env.GodotCPPDocData("#plugin/src/gen/doc_data.gen.cpp", source=Glob("doc_classes/*.xml"))
sources.append(doc_data)
binary_path = '#demo/addons/godotopenxrvendors/.bin'
android_src_path = '#plugin/src'
project_name = 'godotopenxrvendors'
# Statically link with libgcc and libstdc++ for more Linux compatibility.
if env["platform"] == "linux":
env.Append(
LINKFLAGS=[
"-Wl,--no-undefined",
"-static-libgcc",
"-static-libstdc++",
]
)
# Create the library target
if env["platform"] == "macos":
library = env.SharedLibrary(
"{0}/{1}/{2}/lib{3}.{1}.framework/{3}.{1}".format(
binary_path,
env["platform"],
env["target"],
project_name,
),
source=sources,
)
else:
library = env.SharedLibrary(
"{}/{}/{}/{}/lib{}{}".format(
binary_path,
env["platform"],
env["target"],
env["arch"],
project_name,
env["SHLIBSUFFIX"],
),
source=sources,
)
Default(library)
if env["platform"] == "android":
android_target = "release" if env["target"] == "template_release" else "debug"
android_arch = ""
if env["arch"] == "arm64":
android_arch = "arm64-v8a"
elif env["arch"] == "x86_64":
android_arch = "x86_64"
else:
raise Exception("Unable to map %s to Android architecture name" % env["arch"])
library_copy_path = "{}/main/libs/{}/{}/{}/lib{}{}".format(
android_src_path,
android_target,
android_arch,
android_arch,
project_name,
env["SHLIBSUFFIX"])
library_copy = env.Command(library_copy_path, library, Copy('$TARGET', '$SOURCE'))
Default(library_copy)