mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-06 20:58:28 +00:00
Remove engine-dylib
This commit is contained in:
@@ -43,10 +43,6 @@ impl Compile {
|
||||
target_triple: &Triple,
|
||||
) -> Result<&'static str> {
|
||||
Ok(match engine_type {
|
||||
#[cfg(feature = "dylib")]
|
||||
EngineType::Dylib => {
|
||||
wasmer_engine_dylib::DylibArtifact::get_default_extension(target_triple)
|
||||
}
|
||||
#[cfg(feature = "universal")]
|
||||
EngineType::Universal => {
|
||||
wasmer_engine_universal::UniversalArtifact::get_default_extension(target_triple)
|
||||
@@ -55,7 +51,7 @@ impl Compile {
|
||||
EngineType::Staticlib => {
|
||||
wasmer_engine_staticlib::StaticlibArtifact::get_default_extension(target_triple)
|
||||
}
|
||||
#[cfg(not(all(feature = "dylib", feature = "universal", feature = "staticlib")))]
|
||||
#[cfg(not(all(feature = "universal", feature = "staticlib")))]
|
||||
_ => bail!("selected engine type is not compiled in"),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -223,15 +223,6 @@ impl Run {
|
||||
|
||||
fn get_module(&self) -> Result<Module> {
|
||||
let contents = std::fs::read(self.path.clone())?;
|
||||
#[cfg(feature = "dylib")]
|
||||
{
|
||||
if wasmer_engine_dylib::DylibArtifact::is_deserializable(&contents) {
|
||||
let engine = wasmer_engine_dylib::Dylib::headless().engine();
|
||||
let store = Store::new(&engine);
|
||||
let module = unsafe { Module::deserialize_from_file(&store, &self.path)? };
|
||||
return Ok(module);
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "universal")]
|
||||
{
|
||||
if wasmer_engine_universal::UniversalArtifact::is_deserializable(&contents) {
|
||||
@@ -314,16 +305,8 @@ impl Run {
|
||||
cache_dir_root.push(compiler_type.to_string());
|
||||
let mut cache = FileSystemCache::new(cache_dir_root)?;
|
||||
|
||||
// Important: Dylib files need to have a `.dll` extension on
|
||||
// Windows, otherwise they will not load, so we just add an
|
||||
// extension always to make it easier to recognize as well.
|
||||
#[allow(unreachable_patterns)]
|
||||
let extension = match *engine_type {
|
||||
#[cfg(feature = "dylib")]
|
||||
EngineType::Dylib => {
|
||||
wasmer_engine_dylib::DylibArtifact::get_default_extension(&Triple::host())
|
||||
.to_string()
|
||||
}
|
||||
#[cfg(feature = "universal")]
|
||||
EngineType::Universal => {
|
||||
wasmer_engine_universal::UniversalArtifact::get_default_extension(&Triple::host())
|
||||
|
||||
@@ -23,27 +23,19 @@ pub struct StoreOptions {
|
||||
compiler: CompilerOptions,
|
||||
|
||||
/// Use the Universal Engine.
|
||||
#[structopt(long, conflicts_with_all = &["dylib", "staticlib", "jit", "native", "object_file"])]
|
||||
#[structopt(long, conflicts_with_all = &["staticlib", "jit", "object_file"])]
|
||||
universal: bool,
|
||||
|
||||
/// Use the Dylib Engine.
|
||||
#[structopt(long, conflicts_with_all = &["universal", "staticlib", "jit", "native", "object_file"])]
|
||||
dylib: bool,
|
||||
|
||||
/// Use the Staticlib Engine.
|
||||
#[structopt(long, conflicts_with_all = &["universal", "dylib", "jit", "native", "object_file"])]
|
||||
#[structopt(long, conflicts_with_all = &["universal", "jit", "object_file"])]
|
||||
staticlib: bool,
|
||||
|
||||
/// Use the JIT (Universal) Engine.
|
||||
#[structopt(long, hidden = true, conflicts_with_all = &["universal", "dylib", "staticlib", "native", "object_file"])]
|
||||
#[structopt(long, hidden = true, conflicts_with_all = &["universal", "staticlib", "object_file"])]
|
||||
jit: bool,
|
||||
|
||||
/// Use the Native (Dylib) Engine.
|
||||
#[structopt(long, hidden = true, conflicts_with_all = &["universal", "dylib", "staticlib", "jit", "object_file"])]
|
||||
native: bool,
|
||||
|
||||
/// Use the ObjectFile (Staticlib) Engine.
|
||||
#[structopt(long, hidden = true, conflicts_with_all = &["universal", "dylib", "staticlib", "jit", "native"])]
|
||||
#[structopt(long, hidden = true, conflicts_with_all = &["universal", "staticlib", "jit"])]
|
||||
object_file: bool,
|
||||
}
|
||||
|
||||
@@ -150,13 +142,6 @@ impl CompilerOptions {
|
||||
.target(target)
|
||||
.engine(),
|
||||
),
|
||||
#[cfg(feature = "dylib")]
|
||||
EngineType::Dylib => Box::new(
|
||||
wasmer_engine_dylib::Dylib::new(compiler_config)
|
||||
.target(target)
|
||||
.features(features)
|
||||
.engine(),
|
||||
),
|
||||
#[cfg(feature = "staticlib")]
|
||||
EngineType::Staticlib => Box::new(
|
||||
wasmer_engine_staticlib::Staticlib::new(compiler_config)
|
||||
@@ -164,7 +149,7 @@ impl CompilerOptions {
|
||||
.features(features)
|
||||
.engine(),
|
||||
),
|
||||
#[cfg(not(all(feature = "universal", feature = "dylib", feature = "staticlib")))]
|
||||
#[cfg(not(all(feature = "universal", feature = "staticlib")))]
|
||||
engine => bail!(
|
||||
"The `{}` engine is not included in this binary.",
|
||||
engine.to_string()
|
||||
@@ -356,8 +341,6 @@ impl ToString for CompilerType {
|
||||
pub enum EngineType {
|
||||
/// Universal Engine
|
||||
Universal,
|
||||
/// Dylib Engine
|
||||
Dylib,
|
||||
/// Static Engine
|
||||
Staticlib,
|
||||
}
|
||||
@@ -366,7 +349,6 @@ impl ToString for EngineType {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
Self::Universal => "universal".to_string(),
|
||||
Self::Dylib => "dylib".to_string(),
|
||||
Self::Staticlib => "staticlib".to_string(),
|
||||
}
|
||||
}
|
||||
@@ -410,16 +392,12 @@ impl StoreOptions {
|
||||
fn get_engine(&self) -> Result<EngineType> {
|
||||
if self.universal || self.jit {
|
||||
Ok(EngineType::Universal)
|
||||
} else if self.dylib || self.native {
|
||||
Ok(EngineType::Dylib)
|
||||
} else if self.staticlib || self.object_file {
|
||||
Ok(EngineType::Staticlib)
|
||||
} else {
|
||||
// Auto mode, we choose the best engine for that platform
|
||||
if cfg!(feature = "universal") {
|
||||
Ok(EngineType::Universal)
|
||||
} else if cfg!(feature = "dylib") {
|
||||
Ok(EngineType::Dylib)
|
||||
} else if cfg!(feature = "staticlib") {
|
||||
Ok(EngineType::Staticlib)
|
||||
} else {
|
||||
@@ -439,13 +417,11 @@ impl StoreOptions {
|
||||
EngineType::Universal => {
|
||||
Arc::new(wasmer_engine_universal::Universal::headless().engine())
|
||||
}
|
||||
#[cfg(feature = "dylib")]
|
||||
EngineType::Dylib => Arc::new(wasmer_engine_dylib::Dylib::headless().engine()),
|
||||
#[cfg(feature = "staticlib")]
|
||||
EngineType::Staticlib => {
|
||||
Arc::new(wasmer_engine_staticlib::Staticlib::headless().engine())
|
||||
}
|
||||
#[cfg(not(all(feature = "universal", feature = "dylib", feature = "staticlib")))]
|
||||
#[cfg(not(all(feature = "universal", feature = "staticlib")))]
|
||||
engine => bail!(
|
||||
"The `{}` engine is not included in this binary.",
|
||||
engine.to_string()
|
||||
|
||||
Reference in New Issue
Block a user