From 818f689d2685018fde2d162e30432ffbd341badf Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Mon, 26 Sep 2022 23:12:20 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Partially=20fix=20esp-idf?= =?UTF-8?q?=20activation=20in=20Windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +++- src/espidf.rs | 6 ++++-- src/llvm_toolchain.rs | 6 +++++- src/main.rs | 8 +++++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6b8f6bd..7a2970d 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,9 @@ OPTIONS: [possible values: debug, info, warn, error] ``` ## Known Issues - - Windows is not able to install the environment properly when insatlling esp-idf. + - When installing esp-idf in Windows, only `all` targets is wokring. If you try to install + any esp-idf version for any target combination that does not include all of them, you will + have issues activating the environment. ## Troubleshooting - In Windows, when installing esp-idf fails with diff --git a/src/espidf.rs b/src/espidf.rs index 16171a6..5d9ade0 100644 --- a/src/espidf.rs +++ b/src/espidf.rs @@ -128,15 +128,17 @@ impl EspIdfRepo { }; let espidf_origin = espidf::EspIdfOrigin::Managed(repo.clone()); + #[cfg(unix)] let espidf = install(espidf_origin)?; + #[cfg(windows)] + install(espidf_origin)?; let espidf_dir = get_install_path(repo); #[cfg(windows)] exports.push(format!("$Env:IDF_PATH=\"{}\"", espidf_dir.display())); #[cfg(unix)] exports.push(format!("export IDF_PATH={}", espidf_dir.display())); #[cfg(windows)] - exports.push(format!("$Env:PATH={:?}", espidf.exported_path)); - println!("PATTH: {:?}", espidf.exported_path); + exports.push(espidf_dir.join("export.ps1").display().to_string()); #[cfg(unix)] exports.push(format!("export PATH={:?}", espidf.exported_path)); if self.minified { diff --git a/src/llvm_toolchain.rs b/src/llvm_toolchain.rs index 88eccb9..e87855f 100644 --- a/src/llvm_toolchain.rs +++ b/src/llvm_toolchain.rs @@ -49,7 +49,11 @@ impl LlvmToolchain { /// Gets the binary path. pub fn get_lib_path(&self) -> String { - format!("{}/lib", get_tool_path("xtensa-esp32-elf-clang")) + #[cfg(windows)] + let lib_path = format!("{}/bin", get_tool_path("xtensa-esp32-elf-clang")); + #[cfg(unix)] + let lib_path = format!("{}/lib", get_tool_path("xtensa-esp32-elf-clang")); + lib_path } /// Gets the parsed version name. diff --git a/src/main.rs b/src/main.rs index 80e615d..0d41c55 100644 --- a/src/main.rs +++ b/src/main.rs @@ -169,7 +169,13 @@ fn install(args: InstallOpts) -> Result<()> { llvm.install()?; #[cfg(windows)] - exports.push(format!("$Env:LIBCLANG_PATH=\"{}\"", &llvm.get_lib_path())); + exports.push(format!( + "$Env:LIBCLANG_PATH=\"{}/libclang.dll\"", + &llvm.get_lib_path() + )); + #[cfg(windows)] + exports.push(format!("$Env:PATH+=\";{}\"", &llvm.get_lib_path())); + #[cfg(unix)] exports.push(format!("export LIBCLANG_PATH=\"{}\"", &llvm.get_lib_path()));