Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
Browse files Browse the repository at this point in the history
… fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! feat: add esp-idf compilation feature
  • Loading branch information
pulsastrix committed Jun 13, 2024
1 parent d0cbe78 commit 08ce8d7
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions libcoap-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,23 @@ fn main() {
let out_dir = env::var_os("OUT_DIR").unwrap();

if cfg!(feature = "esp") {
for (key, value) in env::vars() {
println!("cargo:warning={key}: {value}");
}
println!("cargo:warning=ESPIDFPATH: {}", env::var_os(format!("DEP_ESP_IDF_{}", embuild::build::ENV_PATH_VAR)).unwrap().to_string_lossy());
let esp_idf_root = env::var_os("DEP_ESP_IDF_ROOT").unwrap();
let esp_include_path = embuild::build::CInclArgs::try_from_env("ESP_IDF").unwrap();

Check failure on line 50 in libcoap-sys/build.rs

View workflow job for this annotation

GitHub Actions / clippy (libcoap-sys)

[clippy (libcoap-sys)] libcoap-sys/build.rs#L50

error[E0433]: failed to resolve: use of undeclared crate or module `embuild` --> libcoap-sys/build.rs:50:32 | 50 | let esp_include_path = embuild::build::CInclArgs::try_from_env("ESP_IDF").unwrap(); | ^^^^^^^ use of undeclared crate or module `embuild`
Raw output
libcoap-sys/build.rs:50:32:e:error[E0433]: failed to resolve: use of undeclared crate or module `embuild`
  --> libcoap-sys/build.rs:50:32
   |
50 |         let esp_include_path = embuild::build::CInclArgs::try_from_env("ESP_IDF").unwrap();
   |                                ^^^^^^^ use of undeclared crate or module `embuild`


__END__

Check failure on line 50 in libcoap-sys/build.rs

View workflow job for this annotation

GitHub Actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap-sys/build.rs#L50

error[E0433]: failed to resolve: use of undeclared crate or module `embuild` --> libcoap-sys/build.rs:50:32 | 50 | let esp_include_path = embuild::build::CInclArgs::try_from_env("ESP_IDF").unwrap(); | ^^^^^^^ use of undeclared crate or module `embuild`
Raw output
libcoap-sys/build.rs:50:32:e:error[E0433]: failed to resolve: use of undeclared crate or module `embuild`
  --> libcoap-sys/build.rs:50:32
   |
50 |         let esp_include_path = embuild::build::CInclArgs::try_from_env("ESP_IDF").unwrap();
   |                                ^^^^^^^ use of undeclared crate or module `embuild`


__END__

let arg_splitter = regex::Regex::new(r##"(?:[^\\]"[^"]*[^\\]")?(\s)"##).unwrap();
let apostrophe_remover = regex::Regex::new(r##"^"(?<content>.*)"$"##).unwrap();
let esp_clang_args = arg_splitter.split(
esp_include_path.args.as_str()
).map(|x| apostrophe_remover.replace(x.trim(), "$content").to_string()).collect::<Vec<String>>();
bindgen_builder = bindgen_builder.clang_args(&esp_clang_args).clang_arg("-target").clang_arg("xtensa").clang_arg("-DESP_PLATFORM");
for arg in &esp_clang_args {
println!("cargo:warning={}", arg);
}
bindgen_builder = bindgen_builder
.clang_args(&esp_clang_args)
.clang_arg("-target")
.clang_arg("xtensa") // Will need to be adjusted for RISC-V ESPs, workaround according to https://github.com/esp-rs/esp-idf-sys/blob/7a0747614cdd3a65cf4ac8094bbeebfee980dbb2/build/build.rs#L119
.clang_arg("-DESP_PLATFORM")
.clang_arg(format!("-I{}/managed_components/espressif__coap/libcoap/include", esp_idf_root.to_string_lossy()));
//for arg in &esp_clang_args {
// println!("cargo:warning={}", arg);
//}
}


Expand Down

0 comments on commit 08ce8d7

Please sign in to comment.