Skip to content

Commit 3773306

Browse files
committed
correctly handle dev, bench, test profiles
From https://doc.rust-lang.org/cargo/guide/build-cache.html > For historical reasons, the dev and test profiles are stored in the > debug directory, and the release and bench profiles are stored in the > release directory. User-defined profiles are stored in a directory with > the same name as the profile. Fixes #167 Signed-off-by: Paul Osborne <[email protected]>
1 parent 019e3b0 commit 3773306

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

classes/cargo_bin.bbclass

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,17 @@ CARGO_BUILD_PROFILE ?= "release"
3333

3434
CARGO_INSTALL_DIR ?= "${D}${bindir}"
3535

36-
CARGO_BINDIR = "${B}/${RUST_TARGET}/${CARGO_BUILD_PROFILE}"
36+
def cargo_profile_to_builddir(profile):
37+
# See https://doc.rust-lang.org/cargo/guide/build-cache.html
38+
# for the special cases mapped here.
39+
return {
40+
'dev': 'debug',
41+
'test': 'debug',
42+
'release': 'release',
43+
'bench': 'release',
44+
}.get(profile, profile)
45+
46+
CARGO_BINDIR = "${B}/${RUST_TARGET}/${@cargo_profile_to_builddir(d.getVar('CARGO_BUILD_PROFILE'))}"
3747
WRAPPER_DIR = "${WORKDIR}/wrappers"
3848

3949
# Set the Cargo manifest path to the typical location

0 commit comments

Comments
 (0)