cargo.bbclass: Make release mode optional

Use DEBUG_BUILD to determine if cargo should build with --release or
not. Set DEBUG_BUILD="1" in a recipe to build it without --release.
This commit is contained in:
Johan Anderholm
2018-07-03 17:19:34 +02:00
parent 9b1b4db8b0
commit de42179513

View File

@@ -23,11 +23,13 @@ B = "${S}"
export RUST_BACKTRACE = "1"
RUSTFLAGS ??= ""
CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} --release"
BUILD_MODE = "${@['--release', ''][d.getVar('DEBUG_BUILD') == '1']}"
CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} ${BUILD_MODE}"
# This is based on the content of CARGO_BUILD_FLAGS and generally will need to
# change if CARGO_BUILD_FLAGS changes.
CARGO_TARGET_SUBDIR="${HOST_SYS}/release"
BUILD_DIR = "${@['release', 'debug'][d.getVar('DEBUG_BUILD') == '1']}"
CARGO_TARGET_SUBDIR="${HOST_SYS}/${BUILD_DIR}"
oe_cargo_build () {
export RUSTFLAGS="${RUSTFLAGS}"
export RUST_TARGET_PATH="${RUST_TARGET_PATH}"