I heard about LLVM roughly two years ago from a coworker. It supposed to be this magical compiler that optimizes your code at multiple levels, or passes, including compile-time, link-time, run-time, and “idle-time”. It’s on my to-play-with list and I haven’t really got a chance to get to it till now. Within the last two years things got a lot more interesting. Apparently Apple is one of the main forces behind LLVM and Clang. To be honest, I probably would have delayed it if it wasn’t for Xcode 4 will have LLVM techology integrated in it, plus the renderer project I want to start and the recent presentation I attended etc., etc., anyway. The point is, LLVM is (about to) catching up with the main stream developers. It’s better to learn it now than never!
I’m just assuming absolutely *no one* would ever have a problem to build LLVM and Clang on Linux and Mac, right? I’m not a Windows fanboy, but really like vim and Visual Studio, therefore I develop on Windows whenever I can. I hope that doesn’t offend anyone. In fact, I reallly enjoy using vim commands inside Visual Studio. OK, that will be another post. But let’s focus on the task at hand, build LLVM and Clang on Windows.
My system: Windows 7 (64 bit), Visual Studio 2010.
Not sure why Clang would ask about svn, but when you run
cmake -G "Visual Studio 10" ..\llvm
it might complain that Subversion_SVN_EXECUTABLE and PYTHON_EXECUTABLE are not found. You just set them as follows:
cmake -DPYTHON_EXECUTABLE=c:\python27\python.exe -DSubversion_SVN_EXECUTABLE="C:\Program Files (x86)\CollabNet\Subversion Client\svn.exe" -G "Visual Studio 10" ..\llvm
The rest is fairly straightforward. Currently Clang doesn’t work with Visual C++ header files such as iostream. STLport doesn’t work either. However I was able to compile simple C++ code without including the STL headers.