Various target names using Rust Cargo to build

Is there a way to set different target names for developing and releasing configurations using Cargo for construction? For example, rustlibd.a and rustlib.a?

+4
source share
1 answer

No. Debug and release information is controlled by the profile. You can see all the manifest keys associated with the profile in the source code . The only thing I see is this rustc_options. Running the assembly in verbose mode, you will see rustc cargo calls:

$ 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, the change --crate-namehas no effect.


Instead, I would point out that you already have a different file name, you just need to look wider:

target/debug/libname.a
target/release/libname.a

. , , , debug release. script:

mv target/debug/libname.a libnamed.a
mv target/release/libname.a libname.a
+3

Source: https://habr.com/ru/post/1686943/


All Articles