use crate::config::ElevationPolicy;
use crate::sensor::Platform;
mod cpu_usage;
#[cfg(any(target_os = "windows", all(target_os = "linux", not(feature = "sbc"))))]
mod counter;
#[cfg(all(target_os = "linux", not(feature = "sbc")))]
mod linux;
#[cfg(target_os = "windows")]
mod windows;
#[cfg(target_os = "macos")]
mod macos;
#[cfg(target_os = "macos")]
mod macos_parse;
#[cfg(all(target_os = "linux", feature = "sbc"))]
mod sbc;
#[cfg(all(target_os = "linux", feature = "sbc"))]
mod sbc_models;
#[cfg(target_os = "linux")]
mod procfs;
#[cfg(any(target_os = "windows", all(target_os = "linux", not(feature = "sbc"))))]
mod gpu;
#[cfg(not(any(target_os = "linux", target_os = "windows", target_os = "macos")))]
compile_error!(
"joularcore has no sensor backend for this target; it supports Linux, Windows and macOS"
);
#[must_use]
pub fn current(elevation: ElevationPolicy) -> Box<dyn Platform> {
let _ = elevation;
#[cfg(all(target_os = "linux", not(feature = "sbc")))]
return Box::new(linux::LinuxPlatform);
#[cfg(all(target_os = "linux", feature = "sbc"))]
return Box::new(sbc::SbcPlatform);
#[cfg(target_os = "windows")]
return Box::new(windows::WindowsPlatform);
#[cfg(target_os = "macos")]
return Box::new(macos::MacOsPlatform::new(elevation));
}