-
Notifications
You must be signed in to change notification settings - Fork 8
/
SConstruct
107 lines (93 loc) · 3.53 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env python
import os
import sys
ARGUMENTS["disable_exceptions"] = "0"
ARGUMENTS["use_mingw"] = "yes"
env = SConscript("ext/godot-cpp/SConstruct")
env.Append(CPPDEFINES = ['RISCV_SYSCALLS_MAX=600', 'RISCV_BRK_MEMORY_SIZE=0x100000'])
env.Prepend(CPPPATH=["ext/libriscv/lib"])
env.Append(CPPPATH=["src/", "."])
sources = [Glob("src/*.cpp"), Glob("src/cpp/*.cpp"), Glob("src/rust/*.cpp"), Glob("src/zig/*.cpp"), Glob("src/elf/*.cpp"), Glob("src/godot/*.cpp"), ["src/tests/dummy_assault.cpp"], Glob("src/bintr/*.cpp")]
librisc_sources = [
# threaded fast-path:
"ext/libriscv/lib/libriscv/threaded_dispatch.cpp",
"ext/libriscv/lib/libriscv/cpu.cpp",
"ext/libriscv/lib/libriscv/debug.cpp",
"ext/libriscv/lib/libriscv/decode_bytecodes.cpp",
"ext/libriscv/lib/libriscv/decoder_cache.cpp",
"ext/libriscv/lib/libriscv/machine.cpp",
"ext/libriscv/lib/libriscv/machine_defaults.cpp",
"ext/libriscv/lib/libriscv/memory.cpp",
"ext/libriscv/lib/libriscv/memory_elf.cpp",
"ext/libriscv/lib/libriscv/memory_mmap.cpp",
"ext/libriscv/lib/libriscv/memory_rw.cpp",
"ext/libriscv/lib/libriscv/multiprocessing.cpp",
"ext/libriscv/lib/libriscv/native_libc.cpp",
"ext/libriscv/lib/libriscv/native_threads.cpp",
#"ext/libriscv/lib/libriscv/rv32i.cpp",
"ext/libriscv/lib/libriscv/rv64i.cpp",
"ext/libriscv/lib/libriscv/serialize.cpp",
# POSIX
"ext/libriscv/lib/libriscv/posix/socket_calls.cpp",
"ext/libriscv/lib/libriscv/posix/minimal.cpp",
"ext/libriscv/lib/libriscv/posix/signals.cpp",
"ext/libriscv/lib/libriscv/posix/threads.cpp",
"ext/libriscv/lib/libriscv/util/crc32c.cpp",
# Binary translator
"ext/libriscv/lib/libriscv/tr_api.cpp",
"ext/libriscv/lib/libriscv/tr_emit.cpp",
"ext/libriscv/lib/libriscv/tr_translate.cpp",
]
if env["platform"] == "windows":
librisc_sources += [
"ext/libriscv/lib/libriscv/win32/dlfcn.cpp",
"ext/libriscv/lib/libriscv/win32/system_calls.cpp",
"ext/libriscv/lib/libriscv/win32/tr_msvc.cpp",
]
else:
librisc_sources += [
"ext/libriscv/lib/libriscv/linux/system_calls.cpp",
# Binary translator - TCC
#"ext/libriscv/lib/libriscv/tr_tcc.cpp"
# Binary translator - System compiler
"ext/libriscv/lib/libriscv/tr_compiler.cpp",
]
if env["platform"] != "windows" or env["use_mingw"]:
env.Append(CXXFLAGS=["-std=c++20"])
else:
env.Append(CXXFLAGS=["/std:c++20"])
sources.extend(librisc_sources)
if env["platform"] == "windows":
env.Prepend(CPPPATH=["ext/libriscv/lib/libriscv/lib/win32"])
env.Prepend(LIBS=['ws2_32']) # for socket calls
elif env["platform"] == "macos":
env.Prepend(CPPPATH=["ext/libriscv/lib/libriscv/lib/macos"])
elif env["platform"] == "linux" or env["platform"] == "android":
env.Prepend(CPPPATH=["ext/libriscv/lib/libriscv/lib/linux"])
if env["platform"] == "macos" or env["platform"] == "ios":
library = env.SharedLibrary(
"bin/addons/godot_sandbox/bin/libgodot_riscv{}.framework/libgodot_riscv{}".format(
env["suffix"], env["suffix"]
),
source=sources,
)
else:
library = env.SharedLibrary(
"bin/addons/godot_sandbox/bin/libgodot_riscv{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),
source=sources,
)
Default(library)
# Static lib
if env["platform"] == "macos" or env["platform"] == "ios":
library = env.StaticLibrary(
"bin/addons/godot_sandbox/bin/libgodot_riscv{}.framework/libgodot_riscv{}{}".format(
env["suffix"], env["suffix"], env["LIBSUFFIX"]
),
source=sources,
)
else:
library = env.StaticLibrary(
"bin/addons/godot_sandbox/bin/libgodot_riscv{}{}".format(env["suffix"], env["LIBSUFFIX"]),
source=sources,
)
Default(library)