cargo: Enable build separation

Place generated artifacts in the directory suggested by bitbake (${B})
instead of directly in the source directory. This has multiple
advantages such as the ability to share source directory between
multiple machine types without risking cross contamination.
This commit is contained in:
Johan Anderholm committed 2021-01-08 16:47:40 +01:00
1 parent 2a4bb8966a
commit a673320995
3 files changed
+18 -4

No files matched your search

+11
View File
@@ -73,6 +73,17 @@ cargo_common_do_configure () {
echo "[target.${BUILD_SYS}]" >> ${CARGO_HOME}/config
echo "linker = '${RUST_BUILD_CCLD}'" >> ${CARGO_HOME}/config
fi
# Put build output in build directory preferred by bitbake instead of
# inside source directory unless they are the same
if [ "${B}" != "${S}" ]; then
cat <<- EOF >> ${CARGO_HOME}/config
[build]
# Use out of tree build destination to avoid poluting the source tree
target-dir = "${B}/target"
EOF
fi
}
oe_cargo_fix_env () {