install.bat 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. @echo off
  2. if defined MSYSTEM (
  3. echo This .bat file is for Windows CMD.EXE shell only.
  4. goto end
  5. )
  6. :: Missing requirements check
  7. set MISSING_REQUIREMENTS=
  8. python.exe --version >NUL 2>NUL
  9. if %errorlevel% neq 0 set "MISSING_REQUIREMENTS= python &echo\"
  10. git.exe --version >NUL 2>NUL
  11. if %errorlevel% neq 0 set "MISSING_REQUIREMENTS=%MISSING_REQUIREMENTS% git"
  12. if not "%MISSING_REQUIREMENTS%" == "" goto :error_missing_requirements
  13. :: Infer IDF_PATH from script location
  14. set IDF_PATH=%~dp0
  15. set IDF_PATH=%IDF_PATH:~0,-1%
  16. for /f "delims=" %%i in ('python.exe "%IDF_PATH%\tools\install_util.py" extract targets "%*"') do set TARGETS=%%i
  17. echo Installing ESP-IDF tools
  18. python.exe "%IDF_PATH%\tools\idf_tools.py" install --targets=%TARGETS%
  19. if %errorlevel% neq 0 goto :end
  20. for /f "delims=" %%i in ('python.exe "%IDF_PATH%\tools\install_util.py" extract features "%*"') do set FEATURES=%%i
  21. echo Setting up Python environment
  22. python.exe "%IDF_PATH%\tools\idf_tools.py" install-python-env --features=%FEATURES%
  23. if %errorlevel% neq 0 goto :end
  24. echo All done! You can now run:
  25. echo export.bat
  26. goto :end
  27. :error_missing_requirements
  28. echo.
  29. echo Error^: The following tools are not installed in your environment.
  30. echo.
  31. echo %MISSING_REQUIREMENTS%
  32. echo.
  33. echo Please use the Windows Tool installer for setting up your environment.
  34. echo Download link: https://dl.espressif.com/dl/esp-idf/
  35. echo For more details please visit our website: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/windows-setup.html
  36. goto :end
  37. :end