Skip to content
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

Inline wasm file for easier cross-platform setup #65

Merged
merged 1 commit into from
Oct 30, 2020

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented Oct 28, 2020

Should be merged with herumi/bls-eth-wasm#5


With MODULARIZE=1 set, we instead emit
the code wrapped in a function that returns a promise. The promise is
resolved with the module instance when it is safe to run the compiled code,
similar to the onRuntimeInitialized callback. You do not need to use the
onRuntimeInitialized callback when using MODULARIZE.

EMCC_OPT+=-s MODULARIZE=1

The default name of the function is Module, but can be changed using the EXPORT_NAME
The factory function accepts 1 parameter, an object with default values the instance

EMCC_OPT+=-s EXPORT_NAME='createBlsModule'

STRICT_JS = 1, adds "use strict;" to generated JS

EMCC_OPT+=-s STRICT_JS=1

SINGLE_FILE=1, embeds all subresources in the emitted file as base64 string
literals. Embedded subresources may include (but aren't limited to) wasm,
asm.js, and static memory initialization code.

EMCC_OPT+=-s SINGLE_FILE=1

Pass -s MINIFY_HTML=0 to explicitly choose to disable HTML minification altogether

EMCC_OPT+=-s MINIFY_HTML=0

Do not minify target javascript file (only a +0.8% size increase)

EMCC_OPT+=--minify 0

With `MODULARIZE=1` set, we instead emit
the code wrapped in a function that returns a promise. The promise is
resolved with the module instance when it is safe to run the compiled code,
similar to the `onRuntimeInitialized` callback. You do not need to use the
`onRuntimeInitialized` callback when using `MODULARIZE`.
```
EMCC_OPT+=-s MODULARIZE=1
```
The default name of the function is `Module`, but can be changed using the `EXPORT_NAME`
The factory function accepts 1 parameter, an object with default values the instance
```
EMCC_OPT+=-s EXPORT_NAME='createBlsModule'
```
Export using an ES6 Module export rather than a UMD export
Disable import feature 'import.meta.url', not supported on old browsers / toolchains
```
EMCC_OPT+=-s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0
```
STRICT_JS = 1, adds "use strict;" to generated JS
```
EMCC_OPT+=-s STRICT_JS=1
```
SINGLE_FILE=1, embeds all subresources in the emitted file as base64 string
literals. Embedded subresources may include (but aren't limited to) wasm,
asm.js, and static memory initialization code.
```
EMCC_OPT+=-s SINGLE_FILE=1
```
Pass -s MINIFY_HTML=0 to explicitly choose to disable HTML minification altogether
```
EMCC_OPT+=-s MINIFY_HTML=0
```
Do not minify target javascript file (only a +0.8% size increase)
```
EMCC_OPT+=--minify 0
```
@herumi
Copy link
Owner

herumi commented Oct 30, 2020

Thank you for the useful patch. I've merged it.

@dapplion dapplion deleted the setup branch October 30, 2020 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants