Cargo build configuration per platform os

Hi,

is it possible to define a build configuration per (source) platform os?
My goal is to define the target triple per platform os in the ./cargo/config.toml, instead of passing it as parameter to cargo build.

Something like:

[build.cfg(platform_os = 'windows')]
target = "x86_64-pc-windows-gnu" # JDIFF can only be compiled using the gnu target
rustflags = ["-C", "target-feature=+crt-static", "-C", "link-self-contained=yes"]

[build.cfg(platform_os = 'unix')]
target = "x86_64-unknown-linux-gnu"

Best Regards
Andreas

1 Like