Make Clang environment for Windows

Clang, GCC, Boost and many more packages are easily available on Windows via MSYS2. Clang is also available via direct download.

it’s often useful to have separate development environments for each compiler. The Powershell script “~/clang.ps1” creates a Clang LLVM environment. We don’t permanently put Clang on our user or system PATH. Running “~/clang.ps1” in Powershell enables Clang until that Powershell window is closed.

$Env:CC="clang"
$Env:FC="flang"
$Env:CXX="clang++"
$Env:path += ";$Env:ProgramFiles/LLVM/bin"

If you need to use the MSVC CL-like clang driver clang-cl, create “~/clang-cl.ps1” and run it when desired.

$Env:CC="clang-cl"
$Env:FC="flang"
$Env:CXX="clang-cl"
$Env:path += ";$Env:ProgramFiles/LLVM/bin"