mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
Make wasmer optional for cli
This commit is contained in:
parent
69f6ffadab
commit
0b3c95ca97
2 changed files with 10 additions and 3 deletions
|
@ -17,7 +17,7 @@ bench = false
|
||||||
[features]
|
[features]
|
||||||
default = ["target-aarch64", "target-x86_64", "target-wasm32", "llvm", "editor"]
|
default = ["target-aarch64", "target-x86_64", "target-wasm32", "llvm", "editor"]
|
||||||
|
|
||||||
wasm32-cli-run = ["target-wasm32"]
|
wasm32-cli-run = ["target-wasm32", "run-wasm32"]
|
||||||
i386-cli-run = ["target-x86"]
|
i386-cli-run = ["target-x86"]
|
||||||
|
|
||||||
# This is a separate feature because when we generate docs on Netlify,
|
# This is a separate feature because when we generate docs on Netlify,
|
||||||
|
@ -25,6 +25,7 @@ i386-cli-run = ["target-x86"]
|
||||||
llvm = ["inkwell", "roc_gen_llvm", "roc_build/llvm"]
|
llvm = ["inkwell", "roc_gen_llvm", "roc_build/llvm"]
|
||||||
editor = ["roc_editor"]
|
editor = ["roc_editor"]
|
||||||
|
|
||||||
|
run-wasm32 = ["wasmer", "wasmer-wasi"]
|
||||||
|
|
||||||
# Compiling for a different platform than the host can cause linker errors.
|
# Compiling for a different platform than the host can cause linker errors.
|
||||||
target-arm = ["roc_build/target-arm"]
|
target-arm = ["roc_build/target-arm"]
|
||||||
|
@ -77,8 +78,8 @@ inkwell = { path = "../vendor/inkwell", optional = true }
|
||||||
target-lexicon = "0.12.2"
|
target-lexicon = "0.12.2"
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
|
|
||||||
wasmer = { version = "2.0.0", default-features = false, features = ["default-singlepass", "default-universal"]}
|
wasmer = { version = "2.0.0", optional = true, default-features = false, features = ["default-singlepass", "default-universal"]}
|
||||||
wasmer-wasi = "2.0.0"
|
wasmer-wasi = { version = "2.0.0", optional = true}
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
pretty_assertions = "1.0"
|
pretty_assertions = "1.0"
|
||||||
|
|
|
@ -411,6 +411,7 @@ fn roc_run(cmd: &mut Command) -> io::Result<i32> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "run-wasm32")]
|
||||||
fn run_with_wasmer(wasm_path: &std::path::Path, args: &[String]) {
|
fn run_with_wasmer(wasm_path: &std::path::Path, args: &[String]) {
|
||||||
use wasmer::{Instance, Module, Store};
|
use wasmer::{Instance, Module, Store};
|
||||||
|
|
||||||
|
@ -441,6 +442,11 @@ fn run_with_wasmer(wasm_path: &std::path::Path, args: &[String]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "run-wasm32"))]
|
||||||
|
fn run_with_wasmer(_wasm_path: &std::path::Path, _args: &[String]) {
|
||||||
|
println!("Running wasm files not support");
|
||||||
|
}
|
||||||
|
|
||||||
enum Backend {
|
enum Backend {
|
||||||
Host,
|
Host,
|
||||||
X86_32,
|
X86_32,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue