Skip to main content

Crate cabin_driver

Crate cabin_driver 

Source
Expand description

Compiler-dialect drivers for Cabin’s build backend.

Cabin’s planner (cabin_build) produces a toolchain-independent semantic IR — a list of BuildActions describing what to compile, archive, and link, with no compiler flags spelled out. This crate is the single boundary where that intent becomes a concrete command line.

A Dialect names a compiler command-line family. Two are supported:

  • Dialect::GnuLike — the GCC / Clang driver (-std=c++17, -O2, -D / -I / -isystem / -c / -o, -MD -MF depfiles).
  • Dialect::Msvc — the Microsoft cl.exe / lib.exe driver (/std:c++17, /O2, /D / /I / /external:I / /c / /Fo, /showIncludes dependency tracking).

The dialect owns every platform- and toolchain-specific decision: how artifacts are named (Dialect::object_extension, Dialect::static_library_name, Dialect::executable_name), how Ninja discovers header dependencies (Dialect::ninja_deps), and how each BuildAction is spelled (lower()). The planner and the Ninja writer stay dialect-agnostic: they ask the dialect.

This split mirrors the way LLVM’s clang Driver constructs per-toolchain jobs and the way rustc selects a LinkerFlavor: one abstract description, many concrete spellings. Everything here is pure, deterministic, and free of I/O, so both dialects are fully unit-testable on any host.

Re-exports§

pub use action::ArchiveAction;
pub use action::BuildAction;
pub use action::CompileAction;
pub use action::CompileArguments;
pub use action::CompileMode;
pub use action::LinkAction;
pub use dialect::Dialect;
pub use dialect::NinjaDeps;
pub use lower::LoweredAction;
pub use lower::LoweredActionKind;
pub use lower::compile_argv;
pub use lower::lower;

Modules§

action
Semantic build-action IR.
dialect
Compiler command-line dialects and their artifact conventions.
lower
Lower the semantic BuildAction IR into concrete command argv for a Dialect.