@@ -24,15 +24,25 @@ def build(ctx, clean=False, native=False):
24
24
25
25
run (cargo_cmd , shell = True , check = True , cwd = rabe_dir )
26
26
27
+ lib_dir = "/usr/local/lib/rabe"
28
+ header_dir = "/usr/include/rabe"
27
29
if not native :
28
- # Install it in the WASM sysroot
29
30
build_env = get_faasm_build_env_dict ()
31
+ lib_dir = build_env ["FAASM_WASM_LIB_INSTALL_DIR" ]
32
+ header_dir = build_env ["FAASM_WASM_HEADER_INSTALL_DIR" ]
33
+ else :
34
+ if not exists (lib_dir ):
35
+ makedirs (lib_dir )
36
+ if not exists (header_dir ):
37
+ makedirs (header_dir )
30
38
39
+ if not native :
40
+ src_lib = join (rabe_dir , "target" , "wasm32-wasip1" , "release" , "librabe.a" )
41
+ else :
31
42
src_lib = join (rabe_dir , "target" , "wasm32-wasip1" , "release" , "librabe.a" )
32
- dst_lib = join (build_env ["FAASM_WASM_LIB_INSTALL_DIR" ], "librabe.a" )
33
43
34
- # TODO: move down
35
- copy (src_lib , dst_lib )
44
+ dst_lib = join ( lib_dir , "librabe.a" )
45
+ copy (src_lib , dst_lib )
36
46
37
47
# Build the CPP bindings library, and cross-compile it to WASM
38
48
rabe_cpp_dir = join (rabe_dir , "cpp-bindings" )
@@ -59,26 +69,18 @@ def build(ctx, clean=False, native=False):
59
69
60
70
work_env = environ .copy ()
61
71
work_env .update (get_faasm_build_env_dict ())
62
- print (build_dir )
63
72
run (cmake_cmd , shell = True , check = True , cwd = build_dir , env = work_env )
64
73
run ("ninja" , shell = True , check = True , cwd = build_dir )
65
74
66
- if not native :
67
- build_env = get_faasm_build_env_dict ()
68
-
69
- # Install the library in the WASM sysroot
70
- src_lib = join (build_dir , "librabe-cpp.a" )
71
- dst_lib = join (build_env ["FAASM_WASM_LIB_INSTALL_DIR" ], "librabe-cpp.a" )
72
- copy (src_lib , dst_lib )
73
-
74
- # Install the header in the WASM sysroot too
75
- src_header = join (rabe_cpp_dir , "rabe_bindings.hpp" )
76
- dst_header = join (
77
- build_env ["FAASM_WASM_HEADER_INSTALL_DIR" ], "tless_abe.h"
78
- )
79
- copy (src_header , dst_header )
80
- src_header = join (rabe_cpp_dir , "tless_aes.h" )
81
- dst_header = join (
82
- build_env ["FAASM_WASM_HEADER_INSTALL_DIR" ], "tless_aes.h"
83
- )
84
- copy (src_header , dst_header )
75
+ # Install the CPP bindings library
76
+ src_lib = join (build_dir , "librabe-cpp.a" )
77
+ dst_lib = join (lib_dir , "librabe-cpp.a" )
78
+ copy (src_lib , dst_lib )
79
+
80
+ # Install the headers
81
+ src_header = join (rabe_cpp_dir , "rabe_bindings.hpp" )
82
+ dst_header = join (header_dir , "tless_abe.h" )
83
+ copy (src_header , dst_header )
84
+ src_header = join (rabe_cpp_dir , "tless_aes.h" )
85
+ dst_header = join (header_dir , "tless_aes.h" )
86
+ copy (src_header , dst_header )
0 commit comments