Search code examples
rustrust-cargo

Can I config a build script for specific binary with Cargo?


My project structure is something like this:

├── build_bin_a.rs
├── Cargo.lock
├── Cargo.toml
├── crates
│   ├── some-crate-a
│   ├── some-crate-b
│   └── .... #etc
├── src
│    ├── bin
│    │   └── some_bin_a.rs
│    │   └── some_bin_b.rs
│    └── lib.rs
└── ...

And I need to configure a build script for only one binary target. In this case I need to configure build_bin_a.rs build script for src/bin/some-bin-a.rs binary target.

Is there any way to achieve it?


Solution

  • This is issue #1430, not supported currently. Your best bet is to put the binary in a different package.