Wasm of ocaml support
This add the following:
- a
(js_of_ocaml (wasm_files (<files-list>))option inlibraryandexecutablestanzas to specifywasm_of_ocamlJavaScript and Wasm runtime files. - a
(js_of_ocaml (submodes <submodes>))option where each submode is eitherjsorwasmin the environment and inlibraryandexecutablestanzas to specify whether to generate JavaScript or Wasm code.
When compiling with wasm_of_ocaml, the output is a launcher file name.bc.wasm.js as well as a directory name.bc.wasm.asset containing the Wasm code and possibly some source maps.
When compiling to Wasm but not to JavaScript, a .bc.js file can also be produced for compatibility. It is just a copy of the
bc.wasm.js file.
I'm not sure how to add tests since they would require wasm_of_ocaml, which is a bit complicated to install at the moment...
I'm not sure how to add tests since they would require wasm_of_ocaml, which is a bit complicated to install at the moment...
Nix would be a good option
I'm not sure how to add tests since they would require wasm_of_ocaml, which is a bit complicated to install at the moment...
Oh, I can just use a new alias runtest-wasm and not run them on the CI for now.
@hhugo Can you have a look?
gentle ping @hhugo
Continued the PR here https://github.com/ocaml/dune/pull/11029 since I'm unable to push here
CI is failing @vouillon
--- a/_build/.sandbox/6975479b7ea39eedbfcff9056c4b3b15/default/test/blackbox-tests/test-cases/wasmoo/inline-tests.t/run.t
+++ b/_build/.sandbox/6975479b7ea39eedbfcff9056c4b3b15/default/test/blackbox-tests/test-cases/wasmoo/inline-tests.t/run.t.corrected
@@ -15,8 +15,17 @@ Run inline tests using Node.js
$ dune runtest --profile release
inline tests (Native)
inline tests (Native)
- inline tests (Wasm)
- inline tests (Wasm)
+ File "wasm/dune", lines 1-6, characters 0-142:
+ 1 | (library
+ 2 | (name inline_tests_wasm)
+ 3 | (js_of_ocaml (wasm_files wasm.wat) (submodes wasm))
+ 4 | (inline_tests
+ 5 | (modes js)
+ 6 | (backend fake_backend)))
+ wasm_of_ocaml: unknown option '--linkall'.
m Usage: wasm_of_ocaml [COMMAND] …
+ Try 'wasm_of_ocaml --help' for more information.
+ [1]