[cfe-dev] Compiling a simple Win32 program

Nikola Smiljanic popizdeh at gmail.com
Thu Jun 7 05:29:22 PDT 2012


I forgot to handle the 64bit tool chain, hope this is the right approach.

I'm also not sure what to do with the cross tools? Maybe a check if we're
on a 32bit platform but targeting a 64bit one?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120607/7787564b/attachment.html>
-------------- next part --------------
Index: lib/Driver/WindowsToolChain.cpp
===================================================================
--- lib/Driver/WindowsToolChain.cpp	(revision 158139)
+++ lib/Driver/WindowsToolChain.cpp	(working copy)
@@ -25,6 +25,8 @@
   #define NOGDI
   #define NOMINMAX
   #include <Windows.h>
+
+  static bool getVisualStudioDir(std::string &path);
 #endif
 
 using namespace clang::driver;
@@ -33,6 +35,12 @@
 
 Windows::Windows(const Driver &D, const llvm::Triple& Triple)
   : ToolChain(D, Triple) {
+  std::string path;
+  if (getVisualStudioDir(path)) {
+	path += "\\VC\\bin";
+	if (Triple.getArch() == llvm::Triple::x86_64) path += "\\amd64";
+	getProgramPaths().push_back(path);
+  }
 }
 
 Tool &Windows::SelectTool(const Compilation &C, const JobAction &JA,


More information about the cfe-dev mailing list