]>
| Commit | Line | Data |
|---|---|---|
| 3c096107 MV |
1 | @echo off\r |
| 2 | \r | |
| 3 | @rem ---------------------------------------------------------------------------\r | |
| 452f525c | 4 | @rem setup-windows.bat - provision a fresh Windows box for native development\r |
| 3c096107 MV |
5 | @rem ---------------------------------------------------------------------------\r |
| 6 | \r | |
| 2e281421 | 7 | @rem --- Non-admin (per-user) winget installs ---\r |
| 3c096107 | 8 | winget install Anthropic.ClaudeCode\r |
| 0aec6243 | 9 | winget install Brave.Brave\r |
| 3c096107 | 10 | winget install Git.Git\r |
| aa6eb783 | 11 | winget install Microsoft.DotNet.SDK.10\r |
| 3c096107 | 12 | winget install Microsoft.PowerShell Microsoft.Sysinternals.ProcessExplorer Microsoft.Sysinternals.ProcessMonitor Microsoft.Sysinternals.SDelete Microsoft.VisualStudioCode Microsoft.WindowsTerminal\r |
| d68d73b6 | 13 | winget install Oracle.VirtualBox\r |
| 3c096107 MV |
14 | winget install Python.Python.3.13\r |
| 15 | winget install WinMerge.WinMerge\r | |
| 3c096107 MV |
16 | \r |
| 17 | @rem OpenCppCoverage: native (PE) line coverage for the C++ binaries. run-coverage-occ.py drives the\r | |
| 452f525c | 18 | @rem pytest suite under it to produce an HTML report (the binaries under test build with PDBs,\r |
| 3c096107 MV |
19 | @rem which it reads). The installer elevates via UAC.\r |
| 20 | winget install OpenCppCoverage.OpenCppCoverage\r | |
| 21 | \r | |
| aa6eb783 MV |
22 | @rem --- WiX 5.0.2, pinned on purpose ---\r |
| 23 | @rem WiX packages our proprietary software into MSIs, and the version is pinned to keep that\r | |
| 24 | @rem free of a fee. 5.0.2 is the last release distributed under the Microsoft Reciprocal\r | |
| 25 | @rem License alone. From 6.0 onward the package also carries OSMFEULA.txt, an Open Source\r | |
| 26 | @rem Maintenance Fee agreement: a monthly fee owed by anyone who uses the PREBUILT BINARIES\r | |
| 27 | @rem as part of revenue-generating activity and has annual gross revenue >= US$10,000.\r | |
| 28 | @rem\r | |
| 29 | @rem It is a fee for the binaries, not a restriction on what we ship - MS-RL is file-scoped\r | |
| 30 | @rem and never reached the MSIs WiX builds, under any version - but 5.0.2 owes nothing.\r | |
| 31 | @rem The 6.x/7.x SOURCE is still MS-RL too, so self-compiling is another way out; a pin is\r | |
| 32 | @rem the cheaper one. This replaces `winget install WiXToolset.WiXCLI`, which has no version\r | |
| 33 | @rem selector and so installs the latest (7.0.0 today, EULA and all).\r | |
| 34 | @rem\r | |
| 35 | @rem PIN THE MSBUILD SIDE TOO. A .wixproj referencing WixToolset.Sdk without a version\r | |
| 36 | @rem resolves to the latest - 7.x, same EULA - and nothing here constrains it. Pin it in the\r | |
| 37 | @rem project: <Project Sdk="WixToolset.Sdk/5.0.2">.\r | |
| 38 | @rem\r | |
| 39 | @rem dotnet.exe is called by full path: winget put the SDK on the machine PATH a few lines\r | |
| 40 | @rem ago, but this cmd session inherited its environment before that and cannot see it.\r | |
| 41 | @rem install-then-update is for re-runs - install fails once the tool is there, and update\r | |
| 42 | @rem then holds it at exactly 5.0.2 - which keeps this script idempotent like the rest.\r | |
| 43 | set "DOTNET_EXE=%ProgramFiles%\dotnet\dotnet.exe"\r | |
| 44 | "%DOTNET_EXE%" tool install --global wix --version 5.0.2 || "%DOTNET_EXE%" tool update --global wix --version 5.0.2\r | |
| 45 | \r | |
| 46 | @rem Report what the pin actually produced. By full path again, and because the shim lands in\r | |
| 47 | @rem a directory this session's PATH predates: expect "5.0.2+<commit>", not 7.x.\r | |
| 48 | "%USERPROFILE%\.dotnet\tools\wix.exe" --version\r | |
| 49 | \r | |
| 3c096107 MV |
50 | @rem ---------------------------------------------------------------------------\r |
| 51 | @rem No package manager needed for the Windows build\r | |
| 52 | @rem\r | |
| 53 | @rem Just:\r | |
| 54 | @rem cd windows && cmake -B build -G "Visual Studio 17 2022" -A x64 && cmake --build build --config Release\r | |
| 55 | @rem ---------------------------------------------------------------------------\r | |
| 56 | \r | |
| 57 | @rem --- Elevated installs (VS2022, WDK, system tools) ---\r | |
| 58 | @rem The elevated script runs in its own window and logs to setup-windows-uac.log.\r | |
| 59 | @rem -PassThru + $p.ExitCode propagates its real exit code back through to ERRORLEVEL.\r | |
| 99725a30 MV |
60 | @rem\r |
| 61 | @rem -TraceUser passes YOU across the UAC boundary. Accepting that prompt with an\r | |
| 62 | @rem administrator's credentials runs the elevated half AS that administrator, so\r | |
| 63 | @rem it cannot see whose box this is; the account named here is the one it grants\r | |
| 64 | @rem non-elevated ETW collection rights to (xperf / wpr without a UAC prompt).\r | |
| 422ce8c7 MV |
65 | @rem\r |
| 66 | @rem The two values go through the environment, and the quotes the child needs\r | |
| 67 | @rem around them are built in PowerShell as [char]34, so the command line below\r | |
| 68 | @rem contains no embedded quote characters at all. Writing them inline as ""..""\r | |
| 69 | @rem works for ONE argument and quietly breaks at two: the quote-state parsing\r | |
| 70 | @rem swallows everything after the first into the -File value, and the elevated\r | |
| 71 | @rem PowerShell dies with "failed because the file does not have a '.ps1'\r | |
| 72 | @rem extension" and exit code -196608 (0xFFFD0000) before it can log a thing.\r | |
| 3c096107 MV |
73 | set "UAC_LOG=%~dp0setup-windows-uac.log"\r |
| 74 | if exist "%UAC_LOG%" del "%UAC_LOG%"\r | |
| 422ce8c7 MV |
75 | set "UAC_SCRIPT=%~dp0setup-windows-with-uac.ps1"\r |
| 76 | set "UAC_TRACE_USER=%USERDOMAIN%\%USERNAME%"\r | |
| 3c096107 | 77 | \r |
| 422ce8c7 | 78 | powershell -NoProfile -Command "$q = [char]34; $p = Start-Process powershell -Verb RunAs -ArgumentList '-NoProfile','-ExecutionPolicy','Bypass','-File',($q + $env:UAC_SCRIPT + $q),'-TraceUser',($q + $env:UAC_TRACE_USER + $q) -Wait -PassThru; exit $p.ExitCode"\r |
| 3c096107 MV |
79 | set "UAC_RC=%ERRORLEVEL%"\r |
| 80 | \r | |
| 81 | @rem --- Surface the elevated session's output (its window has already closed) ---\r | |
| 82 | if exist "%UAC_LOG%" (\r | |
| 83 | echo.\r | |
| 84 | echo ===== elevated setup log ^(%UAC_LOG%^) =====\r | |
| 85 | type "%UAC_LOG%"\r | |
| 86 | echo ===== end of elevated setup log =====\r | |
| 87 | ) else (\r | |
| 88 | echo [setup-windows] WARNING: no elevated log found at "%UAC_LOG%".\r | |
| 89 | echo [setup-windows] The elevated window may have been cancelled at the UAC prompt.\r | |
| 90 | )\r | |
| 91 | \r | |
| 2bbc9b41 MV |
92 | @rem --- Non-elevated PowerShell half ---\r |
| 93 | @rem WinMerge on the user PATH, BinSkim, and the global git config (identity +\r | |
| 94 | @rem core.sshCommand -> a Win32-OpenSSH client, so git shares the Windows\r | |
| 95 | @rem ssh-agent). EDIT THE GIT IDENTITY at the top of setup-windows-no-uac.ps1\r | |
| 96 | @rem before the first run.\r | |
| 97 | @rem\r | |
| 98 | @rem Deliberately NOT elevated: every step writes per-user state (the HKCU PATH,\r | |
| 99 | @rem the .gitconfig under %USERPROFILE%), which the elevated half would write to\r | |
| 100 | @rem the administrator profile instead.\r | |
| 101 | @rem\r | |
| 102 | @rem AFTER the elevated half on purpose: core.sshCommand prefers the ssh.exe that\r | |
| 103 | @rem half unpacks beside rsync.exe - a push through the in-box client is capped\r | |
| 104 | @rem at ~17MB/s - and it can only prefer it once it is on disk. Run either way,\r | |
| 105 | @rem including when the elevated half failed above: nothing here depends on it,\r | |
| 106 | @rem and the fallback is the in-box client that Windows already has.\r | |
| 107 | @rem\r | |
| 108 | @rem Non-fatal: these are conveniences, and the elevated half is the part worth\r | |
| 109 | @rem the UAC prompt. A failure warns and provisioning continues.\r | |
| 110 | powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0setup-windows-no-uac.ps1"\r | |
| 111 | if not "%ERRORLEVEL%"=="0" echo [setup-windows] WARNING: setup-windows-no-uac.ps1 reported a failure ^(see above^); continuing.\r | |
| 112 | \r | |
| 3c096107 MV |
113 | if not "%UAC_RC%"=="0" (\r |
| 114 | echo.\r | |
| 115 | echo [setup-windows] ELEVATED SETUP FAILED ^(exit code %UAC_RC%^). See log above.\r | |
| 116 | exit /b %UAC_RC%\r | |
| 117 | )\r | |
| 118 | echo.\r | |
| 119 | echo [setup-windows] Elevated setup completed successfully.\r | |
| 120 | \r | |
| 121 | @rem Removed: this doesn't work as well as I hoped, maybe try again later\r | |
| 122 | @rem -- Install Headroom ---\r | |
| 123 | @rem py -m pip install "headroom-ai[all]"\r | |
| 124 | @rem npm install headroom-ai\r | |
| 125 | \r | |
| 126 | py -m pip install Pillow |