2019-04-28 22:37:02 -04:00
|
|
|
@echo off
|
|
|
|
if defined MSYSTEM (
|
2021-11-09 07:10:56 -05:00
|
|
|
echo This .bat file is for Windows CMD.EXE shell only.
|
2019-04-28 22:37:02 -04:00
|
|
|
goto :eof
|
|
|
|
)
|
|
|
|
|
2024-02-23 11:17:47 -05:00
|
|
|
set SCRIPT_EXIT_CODE=0
|
|
|
|
|
2024-08-21 10:34:19 -04:00
|
|
|
:: Emergency backup option to use previous export.bat (export_legacy.bat) if the new export approach fails.
|
|
|
|
:: To use it, set environmental variable like: set ESP_IDF_LEGACY_EXPORT=1
|
|
|
|
if not "%ESP_IDF_LEGACY_EXPORT%"=="" (
|
|
|
|
tools\legacy_exports\export_legacy.bat
|
|
|
|
set SCRIPT_EXIT_CODE=%errorlevel%
|
|
|
|
goto :eof
|
|
|
|
)
|
|
|
|
|
2021-03-09 06:53:11 -05:00
|
|
|
:: Missing requirements check
|
|
|
|
set MISSING_REQUIREMENTS=
|
|
|
|
python.exe --version >NUL 2>NUL
|
2024-02-23 11:17:47 -05:00
|
|
|
if %errorlevel% neq 0 (
|
|
|
|
set SCRIPT_EXIT_CODE=%errorlevel%
|
|
|
|
set "MISSING_REQUIREMENTS= python &echo\"
|
|
|
|
)
|
2021-03-09 06:53:11 -05:00
|
|
|
git.exe --version >NUL 2>NUL
|
2024-02-23 11:17:47 -05:00
|
|
|
if %errorlevel% neq 0 (
|
|
|
|
set SCRIPT_EXIT_CODE=%errorlevel%
|
|
|
|
set "MISSING_REQUIREMENTS=%MISSING_REQUIREMENTS% git"
|
|
|
|
)
|
2021-03-09 06:53:11 -05:00
|
|
|
|
2021-10-06 07:48:11 -04:00
|
|
|
if not "%MISSING_REQUIREMENTS%" == "" goto :__error_missing_requirements
|
2021-03-09 06:53:11 -05:00
|
|
|
|
2019-04-28 22:37:02 -04:00
|
|
|
:: Infer IDF_PATH from script location
|
|
|
|
set IDF_PATH=%~dp0
|
|
|
|
set IDF_PATH=%IDF_PATH:~0,-1%
|
|
|
|
|
2024-06-21 11:13:18 -04:00
|
|
|
if not exist "%IDF_PATH%\tools\idf.py" (
|
|
|
|
set SCRIPT_EXIT_CODE=1
|
|
|
|
goto :__missing_file
|
2024-02-23 11:17:47 -05:00
|
|
|
)
|
2024-06-21 11:13:18 -04:00
|
|
|
if not exist "%IDF_PATH%\tools\idf_tools.py" (
|
|
|
|
set SCRIPT_EXIT_CODE=1
|
|
|
|
goto :__missing_file
|
|
|
|
)
|
|
|
|
if not exist "%IDF_PATH%\tools\activate.py" (
|
|
|
|
set SCRIPT_EXIT_CODE=1
|
|
|
|
goto :__missing_file
|
2024-02-23 11:17:47 -05:00
|
|
|
)
|
2019-04-28 22:37:02 -04:00
|
|
|
|
2021-12-13 10:45:11 -05:00
|
|
|
|
2024-06-21 11:13:18 -04:00
|
|
|
for /f "delims=" %%i in ('python "%IDF_PATH%/tools/activate.py" --export') do set activate=%%i
|
|
|
|
%activate%
|
2019-04-28 22:37:02 -04:00
|
|
|
|
2021-10-06 07:48:11 -04:00
|
|
|
goto :__end
|
2019-04-28 22:37:02 -04:00
|
|
|
|
2021-10-06 07:48:11 -04:00
|
|
|
:__error_missing_requirements
|
2021-03-09 06:53:11 -05:00
|
|
|
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
|
2021-10-06 07:48:11 -04:00
|
|
|
goto :__end
|
2019-04-28 22:37:02 -04:00
|
|
|
|
2024-06-21 11:13:18 -04:00
|
|
|
:__missing_file
|
|
|
|
echo Could not detect correct IDF_PATH. Please set it before running this script:
|
|
|
|
echo set IDF_PATH=(add path here)
|
|
|
|
goto :__end
|
2021-12-13 10:45:11 -05:00
|
|
|
|
2021-10-06 07:48:11 -04:00
|
|
|
:__end
|
2019-04-28 22:37:02 -04:00
|
|
|
:: Clean up
|
2021-03-09 06:53:11 -05:00
|
|
|
set MISSING_REQUIREMENTS=
|
2024-06-21 11:13:18 -04:00
|
|
|
set activate=
|
2024-02-23 11:17:47 -05:00
|
|
|
exit /b %SCRIPT_EXIT_CODE%
|