Skip to content

Commit

Permalink
cmake: Add ZEPHYR_BASE to environment in template
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
d3zd3z committed Sep 27, 2024
1 parent a5e05cc commit d52b710
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
Expand Down

0 comments on commit d52b710

Please sign in to comment.