edlang/lib/edlang_session/src/lib.rs

42 lines
833 B
Rust
Raw Normal View History

2024-01-15 06:44:11 +00:00
use std::path::PathBuf;
2024-01-14 08:36:46 +00:00
2024-01-15 06:44:11 +00:00
use ariadne::Source;
#[derive(Debug, Clone)]
pub struct Session {
2024-03-11 11:02:14 +00:00
pub file_paths: Vec<PathBuf>,
2024-01-15 06:44:11 +00:00
pub debug_info: DebugInfo,
pub optlevel: OptLevel,
2024-03-11 11:02:14 +00:00
pub sources: Vec<Source<String>>,
2024-01-15 06:44:11 +00:00
pub library: bool,
pub output_file: PathBuf,
2024-02-14 07:53:47 +00:00
pub output_llvm: bool,
pub output_asm: bool,
}
impl Session {
pub fn get_platform_library_ext() -> &'static str {
if cfg!(target_os = "macos") {
"dylib"
} else if cfg!(target_os = "windows") {
"dll"
} else {
"so"
}
}
2024-01-15 06:44:11 +00:00
}
#[derive(Clone, Copy, Debug, PartialEq, Hash)]
pub enum OptLevel {
None, // -O0
Less, // -O1
Default, // -O2
Aggressive, // -O3
}
#[derive(Clone, Copy, Debug, PartialEq, Hash)]
pub enum DebugInfo {
None,
Full,
}