From 7f368b665ce4aaf380106a2733be1e8bfd1953bf Mon Sep 17 00:00:00 2001 From: David Brown Date: Tue, 24 Sep 2024 15:56:14 -0600 Subject: [PATCH] cmake: Add ZEPHYR_BASE to environment in template Export the ZEPHYR_BASE environment variable to the generated `.cargo/config.toml` file. The regular zephyr build system will set this if it is not set, but then trying to run a standalone build will cause the bindgen build to fail, as it needs this value. Explicitly place it into the environment to allow this to work. Signed-off-by: David Brown --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 637e48ce..515d124f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,6 +122,8 @@ ${module}.path = \"$CACHE{RUST_MODULE_DIR}/${module}\" # symlink) in the source directory to allow various IDE tools and such to work. The build we # invoke will override these settings, in case they are out of date. Everything set here # should match the arguments given to the cargo build command below. + # To allow this to be run outside of the tree, this also includes some things set in the + # environment by the normal build process. file(WRITE ${SAMPLE_CARGO_CONFIG} " # This is a generated sample .cargo/config.toml file from the Zephyr build. # At the time of generation, this represented the settings needed to allow @@ -138,6 +140,7 @@ ZEPHYR_DTS = \"${ZEPHYR_DTS}\" INCLUDE_DIRS = \"${include_dirs}\" INCLUDE_DEFINES = \"${include_defines}\" WRAPPER_FILE = \"${WRAPPER_FILE}\" +ZEPHYR_BASE = \"${ZEPHYR_BASE}\" [patch.crates-io] ${config_paths}