install.bat 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. :: Print help if requested
  17. if /I "%1" == "/?" goto :help
  18. if /I "%1" == "-h" goto :help
  19. if /I "%1" == "--help" goto :help
  20. for /f "delims=" %%i in ('python.exe "%IDF_PATH%\tools\install_util.py" extract targets "%*"') do set TARGETS=%%i
  21. echo Installing ESP-IDF tools
  22. python.exe "%IDF_PATH%\tools\idf_tools.py" install --targets=%TARGETS%
  23. if %errorlevel% neq 0 goto :end
  24. for /f "delims=" %%i in ('python.exe "%IDF_PATH%\tools\install_util.py" extract features "%*"') do set FEATURES=%%i
  25. echo Setting up Python environment
  26. python.exe "%IDF_PATH%\tools\idf_tools.py" install-python-env --features=%FEATURES%
  27. if %errorlevel% neq 0 goto :end
  28. echo All done! You can now run:
  29. echo export.bat
  30. goto :end
  31. :error_missing_requirements
  32. echo.
  33. echo Error^: The following tools are not installed in your environment.
  34. echo.
  35. echo %MISSING_REQUIREMENTS%
  36. echo.
  37. echo Please use the Windows Tool installer for setting up your environment.
  38. echo Download link: https://dl.espressif.com/dl/esp-idf/
  39. echo For more details please visit our website: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/windows-setup.html
  40. goto :end
  41. :help
  42. python.exe "%IDF_PATH%\tools\install_util.py" print_help bat
  43. goto :end
  44. :end