ExpHP / lammps-sys

Rust bindgen wrapper (and static lib builder) for LAMMPS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v0.4.x should have the ability to use dynamic builds

ExpHP opened this issue · comments

This is a big reason why my own code still uses v0.3.x. I need dynamic linking for the occasional time I need to modify the LAMMPS source.

Back when I was writing 0.4.x, I briefly considered having static and dynamic flags, but chickened out. Kornelski gives some good best practices here: https://kornel.ski/rust-sys-crate

In Cargo.toml you can have [features] section with static and dynamic options.

[features]
static = []
dynamic = []

Don't put any of them as Cargo's default feature, because it's too hard to unset defaults in Cargo.

and this gives the toplevel binary crate the power to choose which to use by depending on lammps-sys and activating the appropriate feature.

v0.5.x added this ability back, done using pkg-config with automatic builds as a fallback