-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wasm of ocaml support #10695
Wasm of ocaml support #10695
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
9fd5335
to
c333f4d
Compare
Nix would be a good option |
This comment was marked as resolved.
This comment was marked as resolved.
d8b957b
to
025ef50
Compare
@hhugo Can you have a look? |
e598946
to
5905f8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made some suggestions throughout. Mostly formatting stuff for consistency, but there is one area where the sentence was confusing, so I suggested an alternative. If it doesn't work for you, let me know and we'll work on a solution together.
I'm not able to make suggetsions on anything other than the changes made in this PR, as I don't have edit access.
gentle ping @hhugo |
5905f8a
to
505cc5f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have the proper knowledge to review this PR. However, wouldn't it be easier to review / merge it if the PR was split in two: one with the documentation and one with the code itself?
e81884f
to
87eb637
Compare
Signed-off-by: Jérôme Vouillon <[email protected]>
Signed-off-by: Jérôme Vouillon <[email protected]>
Signed-off-by: Jérôme Vouillon <[email protected]>
Signed-off-by: Jérôme Vouillon <[email protected]>
Signed-off-by: Jérôme Vouillon <[email protected]>
Signed-off-by: Jérôme Vouillon <[email protected]>
Signed-off-by: Jérôme Vouillon <[email protected]>
87eb637
to
fb09911
Compare
- ``(js_of_ocaml (submodes <submodes>))`` controls whether to generate | ||
JavaScript, Wasm code, or both. Each submode is either ``js`` or ``wasm``. | ||
The default is to generate JavaScript code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having this, which controls JS vs WASM generation globally, couldn't we add a wasm
constructor to the (modes)
field in executable
stanzas (similar to how there is a js
constructor)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been unhappy about submodes but never had enough time to think about it.
I wonder if we could do something with modes of the form (<compilation-mode> <binary-kind>)
.
We could have (jsoo js)
and (jsoo wasm)
, or something.
IIRC, you want to be able to compile both js and wasm without touching all dune files. We could imagine a new env
field that define the semantic of the 'js' mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This directive can also be included in executable
stanzas.
I'm not completely happy with the design either. It might be better to have a separate wasm_of_ocaml
field, for instance, to be able to pass different flags to the compilers.
Still, I think we need a global way to specify whether we want to generate JavaScript and/or Wasm code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could have these in env
stanzas:
(js_of_ocaml (by_default_if <blang expression>))
(wasm_of_ocaml (by_default_if <blang expression>))
and a (jsoo default)
executable mode.
And the mode (jsoo js)
and (jsoo wasm)
could be used to generate explicitly some Wasm or JavaScript code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed that this submodes stuff doesn't seem satisfactory. Making it more similar to regular modes would be preferable.
Continued the PR here #11029 since I'm unable to push here |
CI is failing @vouillon
|
This add the following:
(js_of_ocaml (wasm_files (<files-list>))
option inlibrary
andexecutable
stanzas to specifywasm_of_ocaml
JavaScript and Wasm runtime files.(js_of_ocaml (submodes <submodes>))
option where each submode is eitherjs
orwasm
in the environment and inlibrary
andexecutable
stanzas 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 directoryname.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 thebc.wasm.js
file.