File tree 4 files changed +21
-11
lines changed 4 files changed +21
-11
lines changed Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ function(configure_native_kernel kernel)
148
148
endfunction ()
149
149
150
150
function (configure_wasm_kernel kernel)
151
- set (XEUS_CPP_RESOURCE_DIR "/lib/clang/${CPPINTEROP_LLVM_VERSION_MAJOR} " )
151
+ set (XEUS_CPP_RESOURCE_DIR "/lib/clang/${CPPINTEROP_LLVM_VERSION_MAJOR} " PARENT_SCOPE )
152
152
153
153
configure_file (
154
154
"${CMAKE_CURRENT_SOURCE_DIR}${kernel} wasm_kernel.json.in"
@@ -437,7 +437,7 @@ if(EMSCRIPTEN)
437
437
xeus_wasm_link_options(xcpp "web,worker" )
438
438
target_link_options (xcpp
439
439
PUBLIC "SHELL: --preload-file ${SYSROOT_PATH} /include@/include"
440
- # PUBLIC "SHELL: --preload-file ${CMAKE_INSTALL_PREFIX}${XEUS_CPP_RESOURCE_DIR}/include @${XEUS_CPP_RESOURCE_DIR}"
440
+ #PUBLIC "SHELL: --preload-file ${CMAKE_INSTALL_PREFIX}${XEUS_CPP_RESOURCE_DIR}@${XEUS_CPP_RESOURCE_DIR}"
441
441
PUBLIC "SHELL: --preload-file ${XEUS_CPP_DATA_DIR} @/share/xeus-cpp"
442
442
PUBLIC "SHELL: --preload-file ${XEUS_CPP_CONF_DIR} @/etc/xeus-cpp"
443
443
PUBLIC "SHELL: --post-js ${CMAKE_CURRENT_SOURCE_DIR} /wasm_patches/post.js"
Original file line number Diff line number Diff line change @@ -19,8 +19,7 @@ namespace xcpp
19
19
{
20
20
public:
21
21
22
- wasm_interpreter ();
23
- wasm_interpreter (int argc, char ** argv);
22
+ wasm_interpreter (int argc = 0 , char ** argv = nullptr );
24
23
virtual ~wasm_interpreter () = default ;
25
24
26
25
};
Original file line number Diff line number Diff line change 15
15
16
16
#include " xeus-cpp/xinterpreter_wasm.hpp"
17
17
18
+ template <class interpreter_type >
19
+ static interpreter_type* builder_with_args (emscripten::val js_args)
20
+ {
21
+ static std::vector<std::string> args = emscripten::vecFromJSArray<std::string>(js_args);
22
+ static std::vector<const char *> argv_vec;
23
+
24
+ for (const auto & s : args)
25
+ {
26
+ argv_vec.push_back (s.c_str ());
27
+ }
28
+
29
+ int argc = static_cast <int >(argv_vec.size ());
30
+ char ** argv = const_cast <char **>(argv_vec.data ());
31
+
32
+ return new interpreter_type (argc, argv);
33
+ }
34
+
18
35
EMSCRIPTEN_BINDINGS (my_module)
19
36
{
20
37
xeus::export_core ();
21
38
using interpreter_type = xcpp::wasm_interpreter;
22
- xeus::export_kernel<interpreter_type>(" xkernel" );
39
+ xeus::export_kernel<interpreter_type, &builder_with_args<interpreter_type> >(" xkernel" );
23
40
}
Original file line number Diff line number Diff line change 15
15
16
16
namespace xcpp
17
17
{
18
-
19
- wasm_interpreter::wasm_interpreter ()
20
- : interpreter(0 , nullptr )
21
- {
22
- }
23
-
24
18
wasm_interpreter::wasm_interpreter (int argc, char ** argv)
25
19
: interpreter(argc, argv)
26
20
{
You can’t perform that action at this time.
0 commit comments