-
Notifications
You must be signed in to change notification settings - Fork 1
/
SCsub
116 lines (109 loc) · 5.56 KB
/
SCsub
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
108
109
110
111
112
113
114
115
116
# SCsub
Import('env')
module_env = env.Clone()
# add include files
module_env.Prepend( CPPPATH = [
"./thirdparty/wasm-micro-runtime/core/iwasm/interpreter",
"./thirdparty/wasm-micro-runtime/core/iwasm/aot",
"./thirdparty/wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/include",
"./thirdparty/wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src",
"./thirdparty/wasm-micro-runtime/build-scripts/../core/iwasm/include",
"./thirdparty/wasm-micro-runtime/core/shared/mem-alloc",
"./thirdparty/wasm-micro-runtime/core/iwasm/common",
"./thirdparty/wasm-micro-runtime/core/shared/utils",
# "./thirdparty/wasm-micro-runtime/core/shared/utils/uncommon",
])
sdk = [
"./thirdparty/wasm-micro-runtime/core/shared/mem-alloc/ems/ems_alloc.c",
"./thirdparty/wasm-micro-runtime/core/shared/mem-alloc/ems/ems_hmu.c",
"./thirdparty/wasm-micro-runtime/core/shared/mem-alloc/ems/ems_kfc.c",
"./thirdparty/wasm-micro-runtime/core/shared/mem-alloc/mem_alloc.c",
"./thirdparty/wasm-micro-runtime/core/shared/utils/bh_assert.c",
"./thirdparty/wasm-micro-runtime/core/shared/utils/bh_common.c",
"./thirdparty/wasm-micro-runtime/core/shared/utils/bh_hashmap.c",
"./thirdparty/wasm-micro-runtime/core/shared/utils/bh_list.c",
"./thirdparty/wasm-micro-runtime/core/shared/utils/bh_log.c",
"./thirdparty/wasm-micro-runtime/core/shared/utils/bh_queue.c",
"./thirdparty/wasm-micro-runtime/core/shared/utils/bh_vector.c",
"./thirdparty/wasm-micro-runtime/core/shared/utils/runtime_timer.c",
"./thirdparty/wasm-micro-runtime/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c",
# "./thirdparty/wasm-micro-runtime/core/iwasm/libraries/libc-wasi/libc_wasi_wrapper.c",
# "./thirdparty/wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c",
# "./thirdparty/wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/random.c",
# "./thirdparty/wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/str.c",
"./thirdparty/wasm-micro-runtime/core/iwasm/common/wasm_c_api.c",
"./thirdparty/wasm-micro-runtime/core/iwasm/common/wasm_exec_env.c",
"./thirdparty/wasm-micro-runtime/core/iwasm/common/wasm_memory.c",
"./thirdparty/wasm-micro-runtime/core/iwasm/common/wasm_native.c",
"./thirdparty/wasm-micro-runtime/core/iwasm/common/wasm_runtime_common.c",
"./thirdparty/wasm-micro-runtime/core/iwasm/common/wasm_shared_memory.c",
"./thirdparty/wasm-micro-runtime/core/iwasm/interpreter/wasm_interp_classic.c",
"./thirdparty/wasm-micro-runtime/core/iwasm/interpreter/wasm_loader.c",
"./thirdparty/wasm-micro-runtime/core/iwasm/interpreter/wasm_runtime.c",
"./thirdparty/wasm-micro-runtime/core/iwasm/aot/aot_loader.c",
"./thirdparty/wasm-micro-runtime/core/iwasm/aot/aot_runtime.c",
"./thirdparty/wasm-micro-runtime/core/iwasm/aot/arch/aot_reloc_x86_64.c",
]
if module_env.msvc:
sdk.append("./thirdparty/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.asm")
module_env["AS"] ="ml64"
# module_env.Append(CFLAGS=['/std:c99'])
else:
sdk.append("./thirdparty/wasm-micro-runtime/core/iwasm/common/arch/invokeNative_em64.s")
# module_env.Append(CFLAGS=['-std=c11'])
if module_env["platform"] == "windows":
sdk += [
"./thirdparty/wasm-micro-runtime/core/shared/platform/windows/platform_init.c",
"./thirdparty/wasm-micro-runtime/core/shared/platform/windows/posix_malloc.c",
"./thirdparty/wasm-micro-runtime/core/shared/platform/windows/win_memmap.c",
"./thirdparty/wasm-micro-runtime/core/shared/platform/windows/win_thread.c",
"./thirdparty/wasm-micro-runtime/core/shared/platform/windows/win_time.c",
]
module_env.Prepend( CPPPATH = [
"./thirdparty/wasm-micro-runtime/core/shared/platform/windows",
"./thirdparty/wasm-micro-runtime/core/shared/platform/windows/../include",
"./thirdparty/wasm-micro-runtime/core/iwasm/include",
])
else:
module_env.Prepend( CPPPATH = [
"./thirdparty/wasm-micro-runtime/core/shared/platform/linux",
"./thirdparty/wasm-micro-runtime/core/shared/platform/linux/../include",
])
posix = [
"./thirdparty/wasm-micro-runtime/core/shared/platform/common/posix/posix_malloc.c",
"./thirdparty/wasm-micro-runtime/core/shared/platform/common/posix/posix_memmap.c",
"./thirdparty/wasm-micro-runtime/core/shared/platform/common/posix/posix_thread.c",
"./thirdparty/wasm-micro-runtime/core/shared/platform/common/posix/posix_time.c",
]
sdk = sdk + posix
sdk.append("./thirdparty/wasm-micro-runtime/core/shared/platform/linux/platform_init.c")
module_env.Prepend( CPPPATH = [
"./include",
])
module_env.add_source_files(env.modules_sources, sdk)
module_env.add_source_files(env.modules_sources, "src/*.cpp")
module_env.add_source_files(env.modules_sources, "api/*.cpp")
module_env.add_source_files(env.modules_sources, "*.cpp")
# module_env.Append(CCFLAGS=['-O2']) # Flags for C and C++ code
# module_env.Append(CXXFLAGS=['-std=c++11']) # Flags for C++ code only
module_env.Append(CPPDEFINES=[
("BH_FREE", "wasm_runtime_free"),
("BH_MALLOC", "wasm_runtime_malloc"),
"BH_PLATFORM_WINDOWS",
"HAVE_STRUCT_TIMESPEC",
"BUILD_TARGET_X86_64",
"WIN32",
"_WINDOWS",
("WASM_API_EXTERN", ""),
("WASM_RUNTIME_API_EXTERN", ""),
("WASM_ENABLE_AOT", 1),
("WASM_ENABLE_BULK_MEMORY", 0),
("WASM_ENABLE_FAST_INTERP", 0),
("WASM_ENABLE_INTERP", 1),
# ("WASM_ENABLE_LIBC_WASI", 1),
("WASM_ENABLE_LIBC_BUILTIN", 1),
("WASM_ENABLE_MINI_LOADER", 0),
("WASM_ENABLE_MULTI_MODULE", 0),
("WASM_ENABLE_SHARED_MEMORY", 0),
# ("WASGO_API_GENERATION", "wasgo_api.json"), # will default to wasgo_api.json if no filename is provided
])