Skip to content

Commit

Permalink
feature cfg away singlepass and llvm backends in cli
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlansneff committed Apr 11, 2019
1 parent 8180771 commit a100b2a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ members = ["lib/clif-backend", "lib/singlepass-backend", "lib/runtime", "lib/run
[build-dependencies]
wabt = "0.7.2"
glob = "0.2.11"
rustc_version = "0.2.3"

[features]
default = ["fast-tests", "wasi", "singlepass", "llvm"]
default = ["fast-tests", "wasi"]
debug = ["wasmer-clif-backend/debug", "wasmer-runtime-core/debug"]
# This feature will allow cargo test to run much faster
fast-tests = []
llvm = ["wasmer-llvm-backend"]
singlepass = ["wasmer-singlepass-backend"]
"backend:llvm" = ["wasmer-llvm-backend"]
"backend:singlepass" = ["wasmer-singlepass-backend"]
wasi = ["wasmer-wasi"]
vfs = ["wasmer-runtime-abi"]
8 changes: 8 additions & 0 deletions src/bin/wasmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ use structopt::StructOpt;
use wasmer::webassembly::InstanceABI;
use wasmer::*;
use wasmer_clif_backend::CraneliftCompiler;
#[cfg(feature = "backend:llvm")]
use wasmer_llvm_backend::LLVMCompiler;
use wasmer_runtime::cache::{Cache as BaseCache, FileSystemCache, WasmHash, WASMER_VERSION_HASH};
use wasmer_runtime_core::{
self,
backend::{Compiler, CompilerConfig},
};
#[cfg(feature = "backend:singlepass")]
use wasmer_singlepass_backend::SinglePassCompiler;
#[cfg(feature = "wasi")]
use wasmer_wasi;
Expand Down Expand Up @@ -223,9 +225,15 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
}

let compiler: Box<dyn Compiler> = match options.backend {
#[cfg(feature = "backend:singlepass")]
Backend::Singlepass => Box::new(SinglePassCompiler::new()),
#[cfg(not(feature = "backend:singlepass"))]
Backend::Singlepass => return Err("The singlepass backend is not enabled".to_string()),
Backend::Cranelift => Box::new(CraneliftCompiler::new()),
#[cfg(feature = "backend:llvm")]
Backend::LLVM => Box::new(LLVMCompiler::new()),
#[cfg(not(feature = "backend:llvm"))]
Backend::LLVM => return Err("the llvm backend is not enabled".to_string()),
};

let module = if !disable_cache {
Expand Down
1 change: 0 additions & 1 deletion src/webassembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use wasmer_runtime::{
error::{CallResult, Result},
ImportObject, Instance, Module,
};
use wasmer_runtime_core::backend::CompilerConfig;
use wasmer_runtime_core::types::Value;

use wasmer_emscripten::run_emscripten_instance;
Expand Down

0 comments on commit a100b2a

Please sign in to comment.