id = "emscripten"
name = "Emscripten"
homepage = "https://emscripten.org"
description = "A complete compiler toolchain to WebAssembly, using LLVM, with a special focus on speed, size, and the Web platform."
executables = ["emcc", "em++", "emar", "emcmake", "emconfigure"]
[dotfiles]
paths = ["~/.emscripten"]
secret = []
[[dotfiles.machine_lines]]
file = "~/.emscripten"
match = { prefix = ["LLVM_ROOT", "BINARYEN_ROOT", "EMSDK_NODE"] }
scope = "platform"
[commands]
format = 1
label = "Compile with emcc"
description = "Compile C/C++ sources to WebAssembly and JavaScript with emcc (em++ takes the same options). Optimization levels are separate switches; pick at most one. Other -s settings and clang options are not covered."
quality = "ai-draft"
parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = true, short_bundles = false }
[[commands.source]]
id = "emcc"
kind = "manual"
url = "https://emscripten.org/docs/tools_reference/emcc.html"
revision = "2026-10-27"
evidence = """
emcc [options] file...
"-O2"
"-O3"
"-Oz"
"-g"
"--closure 0|1|2"
"--embed-file <file>"
"--preload-file <name>"
"--shell-file <path>"
"--bind"
"-o <target>"
"-c"
"""
[[commands.field]]
id = "inputs"
label = "Source files"
type = "path"
position = 0
multiple = true
min = 1
path = { kind = "file", role = "input", must_exist = true }
sources = ["emcc"]
[[commands.field]]
id = "output"
label = "Output file"
description = "The extension picks the output type, for example .html, .js or .wasm."
type = "path"
option = ["-o"]
path = { kind = "file", role = "output", must_exist = false }
effect = "overwrite"
sources = ["emcc"]
[[commands.field]]
id = "compile_only"
label = "Compile only"
description = "Produce an object file instead of linking."
type = "boolean"
option = ["-c"]
sources = ["emcc"]
[[commands.field]]
id = "o2"
label = "Optimize (-O2)"
type = "boolean"
option = ["-O2"]
sources = ["emcc"]
[[commands.field]]
id = "o3"
label = "Optimize more (-O3)"
type = "boolean"
option = ["-O3"]
sources = ["emcc"]
[[commands.field]]
id = "oz"
label = "Optimize for size (-Oz)"
type = "boolean"
option = ["-Oz"]
sources = ["emcc"]
[[commands.field]]
id = "debug"
label = "Debug info"
type = "boolean"
option = ["-g"]
sources = ["emcc"]
[[commands.field]]
id = "embed_file"
label = "Embed file"
description = "Embed a file or directory in the generated output."
type = "path"
option = ["--embed-file"]
multiple = true
path = { kind = "any", role = "input", must_exist = true }
sources = ["emcc"]
[[commands.field]]
id = "preload_file"
label = "Preload file"
description = "Package a file or directory to load before the program starts."
type = "path"
option = ["--preload-file"]
multiple = true
path = { kind = "any", role = "input", must_exist = true }
sources = ["emcc"]
[[commands.field]]
id = "shell_file"
label = "HTML shell file"
type = "path"
option = ["--shell-file"]
path = { kind = "file", role = "input", must_exist = true }
sources = ["emcc"]
[[commands.field]]
id = "bind"
label = "Embind bindings"
type = "boolean"
option = ["--bind"]
sources = ["emcc"]
[[commands.field]]
id = "closure"
label = "Closure compiler"
type = "enum"
option = ["--closure"]
choices = [{ value = "0", label = "Off" }, { value = "1", label = "On" }, { value = "2", label = "Aggressive" }]
sources = ["emcc"]
[[commands.task]]
id = "web"
label = "Build a web page"
fields = ["inputs", "output", "o2", "shell_file"]
required = ["inputs", "output"]
[[commands.task]]
id = "node"
label = "Build a JavaScript module"
fields = ["inputs", "output", "o2"]
required = ["inputs", "output"]
[[commands.group]]
id = "basic"
label = "Basic"
fields = ["inputs", "output", "compile_only", "o2", "o3", "oz", "debug"]
[[commands.group]]
id = "advanced"
label = "Advanced"
fields = ["embed_file", "preload_file", "shell_file", "bind", "closure"]