fix: 🐛 Partially fix esp-idf activation in Windows

This commit is contained in:
Sergio Gasquez 2022-09-26 23:12:20 +02:00
parent 1517d2d4c9
commit 818f689d26
4 changed files with 19 additions and 5 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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.

View File

@ -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()));