dftd3-sys 0.1.1

Pinned static build of the simple-dftd3 (s-dftd3) Fortran library for the `dftd3` bindings
Documentation
//! Build-script-only support crate for the DFT-D3 dispersion correction.
//!
//! This crate contains no Rust API. Its `build.rs` provides the native
//! `s-dftd3` (and its `mctc-lib` dependency) as **static** archives and
//! emits the corresponding `cargo:rustc-link-lib` directives, so anything
//! depending on this crate links `libs-dftd3.a` + `libmctc-lib.a` directly
//! into the final binary — no `libs-dftd3.so` ever ends up next to the
//! wheel.
//!
//! The Rust FFI bindings and the safe wrapper API come from the [`dftd3`]
//! crate (crates.io, RESTGroup/dftd3-rs), wired up without its
//! `dynamic_loading` feature (which would `dlopen` a shared library at
//! runtime). `fastatomstruct-simulation`'s `dftd3` cargo feature pulls in
//! both crates.
//!
//! [`dftd3`]: https://crates.io/crates/dftd3

/// The simple-dftd3 release this crate links. Referenced from
/// `fastatomstruct-simulation` (or any downstream user) so the crate is
/// part of every final link graph — rustc prunes unreferenced crates, and
/// with them the static-archive link flags emitted by this crate's build
/// script.
///
/// Derived from the `SDFTD3_TAG` pin in `build.rs` via
/// `cargo:rustc-env=SDFTD3_VERSION`, so it can never drift from the
/// library that was actually built (finding F0459).
pub const SDFTD3_VERSION: &str = env!("SDFTD3_VERSION");

#[cfg(test)]
mod tests {
    use super::SDFTD3_VERSION;

    #[test]
    fn pinned_version_is_plain_semver() {
        // Guards the build.rs `cargo:rustc-env` plumbing: the value must be
        // the tag minus its leading `v`, e.g. "1.4.0".
        let mut parts = SDFTD3_VERSION.split('.');
        assert!(
            parts
                .next()
                .is_some_and(|p| !p.is_empty() && p.bytes().all(|b| b.is_ascii_digit())),
            "SDFTD3_VERSION = {SDFTD3_VERSION:?} is not derived from the v-prefixed tag"
        );
        assert!(parts.next().is_some(), "SDFTD3_VERSION must be X.Y.Z");
        assert!(parts.next().is_some(), "SDFTD3_VERSION must be X.Y.Z");
        assert_eq!(parts.next(), None, "SDFTD3_VERSION must be X.Y.Z");
    }
}