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

Compilation of native code to WASM #156

Open
dcharkes opened this issue Oct 13, 2023 · 1 comment
Open

Compilation of native code to WASM #156

dcharkes opened this issue Oct 13, 2023 · 1 comment

Comments

@dcharkes
Copy link
Collaborator

dcharkes commented Oct 13, 2023

We should consider supporting compiling C code in build.dart to WASM and teaching dart2wasm & dart2js how to bundle/link the compiled libraries.

This feature likely needs to be owned by the dart2wasm team for dart2wasm integration. cc @eyebrowsoffire
I believe @eyebrowsoffire also had some ideas about dart2js interop with WASM.

This issue is to track what the CLI API should look like for this integration.

Currently the BuildOutput is tied to dynamic/static libraries that need to specify on what OS/Architecture they run.

class BuildOutput {
/// Time the build this output belongs to started.
///
/// Rounded down to whole seconds, because [File.lastModified] is rounded
/// to whole seconds and caching logic compares these timestamps.
final DateTime timestamp;
final List<Asset> assets;

We could relax the properties of Asset, but it might be better to start distinguishing different types of assets.

The BuildConfig also needs some modification to signal to to the build.dart script we're targeting the web.

Similar to #154, this also triggers the question of package:native_assets_cli.
We could try to only loosely couple the API by only providing the JSON/YAML format instead of a parser, but that just means build.dart script writers will need to write their own parser. So it's probably better to try to cover all types of assets in one protocol. So then the package should be renamed package:build_scripts or something.

Also, build.dart is currently not run in dart2wasm and dart2js. So that will need to be addressed as well.

Related issue:

@fzyzcjy
Copy link

fzyzcjy commented Nov 25, 2023

This looks super useful, looking forward to it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants