From e814ede9d93c7db801aa642db9767c0da01e39d7 Mon Sep 17 00:00:00 2001 From: Johan Anderholm Date: Mon, 19 Jun 2017 18:39:33 -0500 Subject: [PATCH] rust-common: provide C++ wrappers For similar reasons to the C and linker wrappers, using rustbuild requires a C++ wrapper to ensure that the right flags that Yocto needs are passed to the underlying compiler. --- classes/cargo.bbclass | 3 +++ classes/rust-common.bbclass | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass index 61f1324..76c245e 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo.bbclass @@ -70,12 +70,15 @@ oe_cargo_build () { oe_cargo_fix_env () { export CC="${RUST_TARGET_CC}" + export CXX="${RUST_TARGET_CXX}" export CFLAGS="${CFLAGS}" export AR="${AR}" export TARGET_CC="${RUST_TARGET_CC}" + export TARGET_CXX="${RUST_TARGET_CXX}" export TARGET_CFLAGS="${CFLAGS}" export TARGET_AR="${AR}" export HOST_CC="${RUST_BUILD_CC}" + export HOST_CXX="${RUST_BUILD_CXX}" export HOST_CFLAGS="${BUILD_CFLAGS}" export HOST_AR="${BUILD_AR}" } diff --git a/classes/rust-common.bbclass b/classes/rust-common.bbclass index f79c52e..bf955a5 100644 --- a/classes/rust-common.bbclass +++ b/classes/rust-common.bbclass @@ -74,9 +74,11 @@ RUST_TARGET_SYS = "${@rust_base_triple(d, 'TARGET')}" # use those commands based on the prefix. WRAPPER_DIR = "${WORKDIR}/wrapper" RUST_BUILD_CC = "${WRAPPER_DIR}/build-rust-cc" +RUST_BUILD_CXX = "${WRAPPER_DIR}/build-rust-cxx" RUST_BUILD_CCLD = "${WRAPPER_DIR}/build-rust-ccld" RUST_BUILD_AR = "${WRAPPER_DIR}/build-rust-ar" RUST_TARGET_CC = "${WRAPPER_DIR}/target-rust-cc" +RUST_TARGET_CXX = "${WRAPPER_DIR}/target-rust-cxx" RUST_TARGET_CCLD = "${WRAPPER_DIR}/target-rust-ccld" RUST_TARGET_AR = "${WRAPPER_DIR}/target-rust-ar" @@ -97,15 +99,19 @@ create_wrapper () { do_rust_create_wrappers () { mkdir -p "${WRAPPER_DIR}" - # Yocto Build / Rust Host compiler + # Yocto Build / Rust Host C compiler create_wrapper "${RUST_BUILD_CC}" "${BUILD_CC}" + # Yocto Build / Rust Host C++ compiler + create_wrapper "${RUST_BUILD_CXX}" "${BUILD_CXX}" # Yocto Build / Rust Host linker create_wrapper "${RUST_BUILD_CCLD}" "${BUILD_CCLD}" "${BUILD_LDFLAGS}" # Yocto Build / Rust Host archiver create_wrapper "${RUST_BUILD_AR}" "${BUILD_AR}" - # Yocto Target / Rust Target compiler + # Yocto Target / Rust Target C compiler create_wrapper "${RUST_TARGET_CC}" "${CC}" + # Yocto Target / Rust Target C++ compiler + create_wrapper "${RUST_TARGET_CXX}" "${CXX}" # Yocto Target / Rust Target linker create_wrapper "${RUST_TARGET_CCLD}" "${CCLD}" "${LDFLAGS}" # Yocto Target / Rust Target archiver