File
Blob: tools/windows/install-deps.bat
| 1 | @echo off |
| 2 | setlocal enabledelayedexpansion |
| 3 | |
| 4 | rem Check this script is being run from an elevated cmd binary. |
| 5 | net session > NUL 2>&1 |
| 6 | if %ERRORLEVEL% NEQ 0 ( |
| 7 | echo This script requires administrator privileges. |
| 8 | exit /b 1 |
| 9 | ) |
| 10 | |
| 11 | cls |
| 12 | |
| 13 | goto :InstallDependencies |
| 14 | |
| 15 | :AddToUserPathInEnvironment |
| 16 | rem Function to add an element to the users PATH as defined in HCU\Environment. |
| 17 | setlocal |
| 18 | set "PATH_TO_ADD=%~1" |
| 19 | for /F "usebackq tokens=3 skip=2" %%P IN (`reg query "HKEY_CURRENT_USER\Environment" /v PATH`) do set "USERPATH=%%P" |
| 20 | setx PATH "%PATH_TO_ADD%;!USERPATH!" |
| 21 | echo Added %PATH_TO_ADD% to default PATH. |
| 22 | endlocal |
| 23 | exit /b 0 |
| 24 | |
| 25 | :InstallDependencies |
| 26 | |
| 27 | echo.Workerd dependency installation |
| 28 | echo.------------------------------- |
| 29 | echo. |
| 30 | echo.This script will configure your Windows machine for building workerd with |
| 31 | echo.bazel on Windows. |
| 32 | echo. |
| 33 | echo.Some of the steps will open windows for you to approve. |
| 34 | echo. |
| 35 | echo.* Step 1: Enable developer mode features. |
| 36 | echo. |
| 37 | rem This is based on https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging |
| 38 | reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock /v AllowDevelopmentWithoutDevLicense /t REG_DWORD /d 1 /f |
| 39 | |
| 40 | echo. |
| 41 | echo.* Step 2: Enable 8.3 name support on this machine. |
| 42 | fsutil 8dot3name set 0 |
| 43 | |
| 44 | rem Install Visual Studio Code Community edition with Desktop development with C++ package. |
| 45 | rem ---------------------------------------------------------------------------------------- |
| 46 | rem |
| 47 | rem The config in vsconfig.json is the config for "Desktop development with C++". |
| 48 | rem |
| 49 | rem The config is determined by first installing Visual Studio Community Edition on your |
| 50 | rem devbox. Then run `c:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe` and click |
| 51 | rem `More -> Export Configuration Settings`, select an config file to write, then `Review Details` |
| 52 | rem and select "Desktop development with C++". |
| 53 | echo. |
| 54 | echo.* Step 3: Install Visual Studio Code Community edition with Desktop development with C++ package. |
| 55 | winget install "Microsoft.VisualStudio.2022.Community" --override "install --config %~dp0\vsconfig.json" |
| 56 | |
| 57 | echo. |
| 58 | echo.* Step 4: Install Python 3. |
| 59 | winget install Python3 -v 3.12.1 --override "/passive PrependPath=1" |
| 60 | @rem bazel requires a python3.exe binary, create a symlink for it. |
| 61 | mklink "%LOCALAPPDATA%\Programs\Python\Python312\python3.exe" "%LOCALAPPDATA%\Programs\Python\Python312\python.exe" |
| 62 | |
| 63 | echo. |
| 64 | echo.* Step 5: Install msys2. |
| 65 | winget install msys2.msys2 |
| 66 | setx BAZEL_SH "C:\msys64\usr\bin\bash.exe" |
| 67 | |
| 68 | echo. |
| 69 | echo.* Step 6 Install msys2 tools suggested for bazel, from https://bazel.build/install/windows. |
| 70 | @rem Invoking pacman like this reports an error updating GNU info files, no idea how to fix. |
| 71 | C:\msys64\usr\bin\bash -c "/usr/bin/pacman -S --noconfirm zip unzip patch diffutils" |
| 72 | call :AddToUserPathInEnvironment C:\msys64\usr\bin |
| 73 | |
| 74 | echo. |
| 75 | echo.* Step 7: Install LLVM compiler toolchain. |
| 76 | @rem The MSVC build frequently breaks in some ways when the LLVM version is updated, we may have to |
| 77 | @rem manually install a different version again soon. |
| 78 | @rem winget install "LLVM" --version 19.1.7 |
| 79 | |
| 80 | echo. |
| 81 | echo.* Step 8: Install bazelisk as %LOCALAPPDATA%\Programs\bazelisk\bazel.exe. |
| 82 | winget install bazelisk -l "%LOCALAPPDATA%\Programs\bazelisk" -r "bazel.exe" |
| 83 | call :AddToUserPathInEnvironment "%LOCALAPPDATA%\Programs\bazelisk" |
| 84 | |
| 85 | echo. |
| 86 | echo.* Setup complete. |
| 87 | set /p GO="Press enter to exit." |
| 88 | exit 0 |