<div class="gmail_quote"><div>What we have right now in the driver sucks for various reasons. Code for handling multiple versions of VS is very complex and possibly incorrect. How do you select the right VS (latest version?). Also how do you get the include paths, these depend on the target. How do you find the right link.exe, and so on.</div>
<div><br></div><div>Since Clang can't figure all this out on its own the user should be required to follow the windows convention and run vcvars.bat or invoke clang from VS Command prompt (it's not a real convention but I don't know of any other way to detect active compiler on windows, one can only make assumptions since windows doesn't have a notion of system compiler like linux does). It's far from perfect but everything should just work from this point on:</div>
<div><br></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">Environment variables have almost everything we need<br>INCLUDES variable is used for system includes (it also has the path to SDK)<br>
SDK variable (don't think we need this, maybe if there is a newer SDK installed, but I don't think vcvars knows about the new version?)<br>Link.exe is in the path, and uses LIB variable to find libraries so everything should just work<br>
Any user supplied target triple should be ignored. This is what I find a bit problematic, users are expected to know what is going on. The active environment is what determines which triple to use. Michel mentioned implementing <i>which </i>command but we actually only need the path to cl.exe (no need to iterate over all extensions in PATHEXT). cl.exe from VC/BIN directory targets x86 while the ones from amd64 and x86_amd64 both target x64.<br>
<br></blockquote>My assumption is that Win32 in the triple means "standalone Clang that uses headers and tools provided by VS to target the Windows platform". Hope that mingw never plays a role in here and always uses its own triple?</div>
<div><br></div><div>What do you think, have I missed anything? Here's a patch that implements most of this stuff so you get a better idea of what I'm talking about.<div><br></div>
</div>
</div><br>