Skip to content

Commit

Permalink
Merge pull request #169 from rust-embedded/fix-special-case-cargo-pro…
Browse files Browse the repository at this point in the history
…files

correctly handle dev, bench, test profiles
  • Loading branch information
eldruin authored Mar 6, 2024
2 parents 019e3b0 + 3773306 commit 7e87634
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion classes/cargo_bin.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ CARGO_BUILD_PROFILE ?= "release"

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

CARGO_BINDIR = "${B}/${RUST_TARGET}/${CARGO_BUILD_PROFILE}"
def cargo_profile_to_builddir(profile):
# See https://doc.rust-lang.org/cargo/guide/build-cache.html
# for the special cases mapped here.
return {
'dev': 'debug',
'test': 'debug',
'release': 'release',
'bench': 'release',
}.get(profile, profile)

CARGO_BINDIR = "${B}/${RUST_TARGET}/${@cargo_profile_to_builddir(d.getVar('CARGO_BUILD_PROFILE'))}"
WRAPPER_DIR = "${WORKDIR}/wrappers"

# Set the Cargo manifest path to the typical location
Expand Down

0 comments on commit 7e87634

Please sign in to comment.