Reputation: 43
Is there a way to set different target names for development and release configurations using Cargo for building? For example, rustlibd.a and rustlib.a?
Upvotes: 4
Views: 1216
Reputation: 430554
No. Debug vs release information is controlled by a profile. You can see all the profile-related manifest keys in the source code. The only related one I see is rustc_options
. Running the build in verbose mode, you can see how cargo calls rustc:
$ cargo build --verbose
Compiling namez v0.1.0 (file:///private/tmp/namez)
Running `rustc --crate-name namez src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=5444c772a04e08f3 -C extra-filename=-5444c772a04e08f3 --out-dir /private/tmp/namez/target/debug/deps -L dependency=/private/tmp/namez/target/debug/deps`
Finished dev [unoptimized + debuginfo] target(s) in 0.45 secs
Unfortunately, changing --crate-name
does not have the effect you'd like.
Instead, I'd point out that you already have a different filename, you just have to look broader:
target/debug/libname.a
target/release/libname.a
The debug and release files are in different directories. Whatever you were going to do to move separately named libraries would have to deal with the debug
and release
directories anyway. Just update your script:
mv target/debug/libname.a libnamed.a
mv target/release/libname.a libname.a
Upvotes: 3