Skip to content

Instantly share code, notes, and snippets.

@nico
Created January 30, 2021 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nico/0be25ae4dd0b6ed2ab3c3a797920a0eb to your computer and use it in GitHub Desktop.
Save nico/0be25ae4dd0b6ed2ab3c3a797920a0eb to your computer and use it in GitHub Desktop.
@ech off
REM Creates "myroot" which can be used with `clang-cl /winsysroot myroot`
setlocal
REM Adjust this one accordingly:
set VSInstallDir="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional"
set WinSdkDir="%ProgramFiles(x86)%\Windows Kits"
mkdir "myroot\Windows Kits"
mklink /j myroot\VC %VSInstallDir%\VC
mklink /j "myroot\Windows Kits\10" %WinSdkDir%\10
endlocal
REM The correct value of VSInstallDir can be found programmatically by running
REM
REM vswhere -latest -products * -requires $ID -property installationPath
REM
REM where ID=Microsoft.VisualStudio.Component.VC.Tools.x86.x64 and where vswhere
REM is at "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere",
REM but calling that in bat is so ungainly and hard to read that I'm hardcoding
REM the path instead. If you're curious, the almost-full invocation is at
REM https://github.com/microsoft/vswhere/wiki/Find-VC (except they assume
REM that vswhere is on PATH, which it isn't), but be warned: It's ugly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment