windows - How to have different dependencies depending on OS family -
i'm writing cross-platform library has platform specific dependencies, 1 unix-like platforms, , 1 windows. these crates compile on specific platforms, wherefore can't add them under dependencies normally.
in actual rust code use cfg attributes, #[cfg(unix)] compile code platforms, , want similar in cargo.toml, or in build script, dependencies. currently, i'm using target triplets these:
[target.i686-unknown-linux-gnu.dependencies.crate1] git = repo1 [target.x86-unknown-linux-gnu.dependencies.crate1] git = repo1 [target.x86_64-unknown-linux-gnu.dependencies.crate1] git = repo1 [target.i686-pc-windows-gnu.dependencies] crate2 = "*" [target.x86-pc-windows-gnu.dependencies] crate2 = "*" [target.x86_64-pc-windows-gnu.dependencies] crate2 = "*" however, list far exhaustive. don't care architecture or abi, os family, , such, list long, match every single unix-like target triple.
is there way use specific dependencies, determined os family of platform cargo run on? like:
[target.family.unix.dependencies] abc-sys = "*" def = "*" [target.family.windows.dependencies] abc-win = "*"
as far read docs here, should work:
[target.'cfg(unix)'.dependencies] abc-sys = "*" def = "*" [target.'cfg(windows)'.dependencies] abc-win = "*"
Comments
Post a Comment