Skip to content

Commit d98eae8

Browse files
committed
rust: zephyr-sys: Use absolute path for wrapper
Change the header passed into bindgen to be an absolute path. This will cause the generated wrapper to refer to this file also using an absolute path. As such, remove the explicit include path added as part of the build. Signed-off-by: David Brown <[email protected]>
1 parent c440acd commit d98eae8

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

cmake/modules/rust.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,4 @@ ${config_paths}
178178
# Presumably, Rust applications will have no C source files, but cmake will require them.
179179
# Add an empty file so that this will build. The main will come from the rust library.
180180
target_sources(app PRIVATE ${ZEPHYR_BASE}/lib/rust/main.c ${WRAPPER_FILE})
181-
set_source_files_properties(
182-
${WRAPPER_FILE}
183-
COMPILE_FLAGS "-I${ZEPHYR_BASE}/lib/rust/zephyr-sys"
184-
)
185181
endfunction()

lib/rust/zephyr-sys/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use anyhow::Result;
1616
use bindgen::Builder;
1717

1818
use std::env;
19-
use std::path::PathBuf;
19+
use std::path::{Path, PathBuf};
2020

2121
fn main() -> Result<()> {
2222
// Pass in the target used to build the native code.
@@ -30,7 +30,7 @@ fn main() -> Result<()> {
3030

3131
// Bindgen everything.
3232
let bindings = Builder::default()
33-
.header("wrapper.h")
33+
.header(Path::new("wrapper.h").canonicalize().unwrap().to_str().unwrap())
3434
.use_core()
3535
.clang_arg(&target_arg);
3636
let bindings = define_args(bindings, "-I", "INCLUDE_DIRS");

0 commit comments

Comments
 (0)