-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConstruct
63 lines (53 loc) · 1.71 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
#!/usr/bin/env python
import os
import sys
from SCons.Script import ARGUMENTS
target_path = ARGUMENTS.pop("target_path", "demo/addons/hexmap/lib")
target_name = ARGUMENTS.pop("target_name", "libgdhexmap")
env = SConscript("godot-cpp/SConstruct")
env.Append(CPPPATH=["src/"])
sources = [
Glob("src/*.cpp"),
Glob("src/hex_map/*.cpp"),
Glob("src/hex_map/editor/*.cpp"),
]
if env["platform"] == "macos":
target = "{}/{}.{}.{}.framework/{}.{}.{}".format(
target_path,
target_name,
env["platform"],
env["target"],
target_name,
env["platform"],
env["target"],
)
else:
target = "{}/{}{}{}".format(
target_path,
target_name,
env["suffix"],
env["SHLIBSUFFIX"],
)
library = env.SharedLibrary(target=target, source=sources)
Default(library)
# ANNOYING
# * by default, godot-cpp scons makes shared library symbol visibility to hidden
# * by default linking allows for undefined symbols that just panic
#
# So when we built the dll, the symbols we're testing were hidden. When we
# linked the binary, the linker couldn't find the symbols in the shared library,
# but instead of erroring, it redirects those to an __abort_with_payload() call.
# So the binary links, you execut it and it crashes.
#
# This shitty workaround, just recompile the sources and link them directly into
# the test binary.
godot_cpp = File(f"godot-cpp/bin/libgodot-cpp{env["suffix"]}.a")
tests = env.Program(
target='tests/tests',
source=Glob("tests/*cpp") + sources,
LIBS=[godot_cpp]
)
# import pdb
# pdb.set_trace()
run_tests = Command("run_tests", None, "tests/tests" )
Depends(run_tests, tests)