forked from espressif/esp-idf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.bat
71 lines (58 loc) · 1.99 KB
/
install.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
@echo off
if defined MSYSTEM (
echo This .bat file is for Windows CMD.EXE shell only.
goto :__end
)
set SCRIPT_EXIT_CODE=0
:: Missing requirements check
set MISSING_REQUIREMENTS=
python.exe --version >NUL 2>NUL
if %errorlevel% neq 0 (
set SCRIPT_EXIT_CODE=%errorlevel%
set "MISSING_REQUIREMENTS= python &echo\"
)
git.exe --version >NUL 2>NUL
if %errorlevel% neq 0 (
set SCRIPT_EXIT_CODE=%errorlevel%
set "MISSING_REQUIREMENTS=%MISSING_REQUIREMENTS% git"
)
if not "%MISSING_REQUIREMENTS%" == "" goto :__error_missing_requirements
:: Infer IDF_PATH from script location
set IDF_PATH=%~dp0
set IDF_PATH=%IDF_PATH:~0,-1%
:: Print help if requested
if /I "%1" == "/?" goto :__help
if /I "%1" == "-h" goto :__help
if /I "%1" == "--help" goto :__help
for /f "delims=" %%i in ('python.exe "%IDF_PATH%\tools\install_util.py" extract targets "%*"') do set TARGETS=%%i
echo Installing ESP-IDF tools
python.exe "%IDF_PATH%\tools\idf_tools.py" install --targets=%TARGETS%
if %errorlevel% neq 0 (
set SCRIPT_EXIT_CODE=%errorlevel%
goto :__end
)
for /f "delims=" %%i in ('python.exe "%IDF_PATH%\tools\install_util.py" extract features "%*"') do set FEATURES=%%i
echo Setting up Python environment
python.exe "%IDF_PATH%\tools\idf_tools.py" install-python-env --features=%FEATURES%
if %errorlevel% neq 0 (
set SCRIPT_EXIT_CODE=%errorlevel%
goto :__end
)
echo All done! You can now run:
echo export.bat
goto :__end
:__error_missing_requirements
echo.
echo Error^: The following tools are not installed in your environment.
echo.
echo %MISSING_REQUIREMENTS%
echo.
echo Please use the Windows Tool installer for setting up your environment.
echo Download link: https://dl.espressif.com/dl/esp-idf/
echo For more details please visit our website: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/windows-setup.html
goto :__end
:__help
python.exe "%IDF_PATH%\tools\install_util.py" print_help bat
goto :__end
:__end
exit /b %SCRIPT_EXIT_CODE%