<div>Here's another crack at the windows include paths patch, using the registry this time, with a fall back to the environment (if perhaps run on a non-Windows system), with another fall back to hard-coded paths (if the env vars are not set).  I also added an extra path that is typically defaulted on Windows, the PlatformSDK/Include path, where all the Windows headers are.</div>

<div> </div>
<div>I rearranged the code to try to localize the #ifdefs a bit more, but rather than try to create a common place for system related things, I punted and just left them in the file for now.<br></div>
<div>On thing you might not like is the hack to the CMakeLists.txt files I put in, for working around the problem including windows.h because of the /Za option.  But if anyone knows a better way...</div>
<div> </div>
<div>-John<br></div>
<div class="gmail_quote">On Thu, Oct 8, 2009 at 6:46 PM, Mike Stump <span dir="ltr"><<a href="mailto:mrs@apple.com">mrs@apple.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div class="im">On Oct 8, 2009, at 5:42 PM, John Thompson wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Can you give me some pointers on how to do a platform-specific file?<br></blockquote><br></div>Oh, there are lots of ways and llvm doesn't tend to have a beautiful way to do this...  but one way would be to arrange it like so:<br>
<br>#ifdef _MSC_VER<br>code<br>#endif<br><br>You can then just have it  built normally, and call the routines from the file from the other parts of the file.<br><br>So, for example, take a concepts called filename path canonicalization (just to pick a windows difference between unix).<br>
<br>Support/Paths.h:<br><br> char *canonicalize(char *);<br><br>Support/UnixPaths.cpp:<br><br> #ifndef _MSC_VER<br> char *canonicalize(char *c) {<br>   while (c[0] == '/' && c[1] == '/') ++c;<br>   return c;<br>
 }<br> #endif<br><br>Support/WinPaths.cpp:<br><br> #ifdef _MSC_VER<br> char *canonicalize(char *c) {<br>   // ...<br> }<br> #endif<br><br>another approach would be llvm/lib/System/Atomic.cpp, though, I'm not sure I really like that style as much.  In general, one wraps up the system specific bits they want behind a system independent api, use that api in the main code, and then in the implementation, one can hide the details.<br>
</blockquote></div><br><br clear="all">
<div></div><br>-- <br>John Thompson<br><a href="mailto:John.Thompson.JTSoftware@gmail.com">John.Thompson.JTSoftware@gmail.com</a><br><br>