KVDC7QI5DWVMAAX7F5BTB7WIZO2T7FCN4DSDCN3SG2LNROB6WQ7AC
: foreach *.c |> clang -cc1 -Ofast -emit-llvm-bc -triple=wasm32-unknown-unknown-wasm -std=c17 -o %o %f |> %B.bc
: foreach *.bc |> llc -O3 -filetype=obj %f -o %o |> %B.o
: foreach *.o |> wasm-ld --lto-O3 --no-entry %f -o %o --initial-memory=0 |> %B.wasm
: *.o |> wasm-ld --lto-O3 --no-entry %f -o %o --initial-memory=0 |> 9_all.wasm
: foreach *.wasm |> wasm-opt -Oz -o %o %f |> %B.opt.wasm
int return_0() {
return 0;
}
{ pkgs ? import <nixpkgs> { }, }:
with pkgs;
(mkShell.override { stdenv = llvmPackages.stdenv; }) {
buildInputs = [ binaryen elixir llvmPackages.bintools tup wabt ];
ERL_INCLUDE_PATH = "${erlang}/lib/erlang/usr/include";
}
defmodule WaEmbedder.MixProject do
use Mix.Project
def project do
[
app: :wa_embedder,
version: "0.1.0",
elixir: "~> 1.12",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
# {:dep_from_hexpm, "~> 0.3.0"},
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
]
end
end
defmodule WaEmbedder do
@moduledoc """
Documentation for `WaEmbedder`.
"""
@doc """
Hello world.
## Examples
iex> WaEmbedder.hello()
:world
"""
def hello do
:world
end
end
{
description = "WASM Embedder";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.simpleFlake {
inherit self nixpkgs;
name = "WASM Embedder";
shell = ./shell.nix;
};
}
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1623875721,
"narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1625944718,
"narHash": "sha256-eU/PsfR9/PIQFyBOFTE4Z5XgJP7bht7FHjxIa1FqB3w=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "336494e19f4110a9024f994a5628743f77fbade2",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
# WaEmbedder
**TODO: Add description**
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `wa_embedder` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:wa_embedder, "~> 0.1.0"}
]
end
```
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/wa_embedder](https://hexdocs.pm/wa_embedder).
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]