use std::collections::HashMap;
use crate::{config::GaiaConfig, program::GaiaModule, Backend, GeneratedFiles};
use gaia_types::{
helpers::{AbiCompatible, ApiCompatible, Architecture, ArtifactType, CompilationTarget},
Result,
};
#[derive(Default)]
pub struct MslBackend {}
impl Backend for MslBackend {
fn name(&self) -> &'static str {
"MSL"
}
fn primary_target(&self) -> CompilationTarget {
CompilationTarget { build: Architecture::Unknown, host: AbiCompatible::MSL, target: ApiCompatible::Metal }
}
fn artifact_type(&self) -> ArtifactType {
ArtifactType::Source
}
fn match_score(&self, target: &CompilationTarget) -> f32 {
if target.host == AbiCompatible::MSL {
return 80.0;
}
0.0
}
fn generate(&self, _program: &GaiaModule, config: &GaiaConfig) -> Result<GeneratedFiles> {
#[cfg(feature = "msl-assembler")]
{
Ok(GeneratedFiles { artifact_type: self.artifact_type(), files: HashMap::new(), custom: None, diagnostics: vec![] })
}
#[cfg(not(feature = "msl-assembler"))]
{
Err(gaia_types::GaiaError::custom_error("MSL feature is not enabled"))
}
}
}