if exist %1 (
set INSTALL_DIR=%1
) else (
set INSTALL_DIR=%HOMEPATH%
)
cd %INSTALL_DIR%
@REM Install Choco and package
powershell -c "Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))"
set PATH=%PATH%;C:\ProgramData\chocolatey\bin
choco feature enable -n allowGlobalConfirmation
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
choco install ninja gperf python git dtc-msys2 wget unzip
set PATH=%PATH%;C:\Python310\Scripts\;C:\Python310\;C:\Program Files\CMake\bin;C:\Program Files\Git\cmd
@REM Get Zephyr and install Python dependencies
pip3 install -U west
cd %INSTALL_DIR%
west init zephyrproject
cd zephyrproject
@REM west update
west zephyr-export
pip3 install -r %INSTALL_DIR%\zephyrproject\zephyr\scripts\requirements.txt
@REM Download and install Zephyr SDK
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.14.2/zephyr-sdk-0.14.2_windows-x86_64.zip
tar -xzf zephyr-sdk-0.14.2_windows-x86_64.zip
del zephyr-sdk-0.14.2_windows-x86_64.zip .wget-hsts cmake-3.24.0-windows-x86_64.msi
ren zephyr-sdk-0.14.2 zephyr-sdk
cd zephyr-sdk
echo "yyy" | setup.cmd
cd %INSTALL_DIR%
del wget.exe unzip.exe .wget-hsts
cd %~dp0