r343809 - Update Clang Windows getting started docs

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 4 13:34:52 PDT 2018


Author: rnk
Date: Thu Oct  4 13:34:52 2018
New Revision: 343809

URL: http://llvm.org/viewvc/llvm-project?rev=343809&view=rev
Log:
Update Clang Windows getting started docs

Summary:
- Update the example VS project generation to use VS2017.
- Add docs for generating ninja build files, since they are popular.
- Remove reference to "make update" which no longer exists. Mention the
  monorepo instead.
- Try to explain gnuwin32/coreutils requirements better.
- Use https:// links where possible

Reviewers: zturner, STL_MSFT

Subscribers: jfb, cfe-commits

Differential Revision: https://reviews.llvm.org/D52843

Modified:
    cfe/trunk/www/get_started.html

Modified: cfe/trunk/www/get_started.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/get_started.html?rev=343809&r1=343808&r2=343809&view=diff
==============================================================================
--- cfe/trunk/www/get_started.html (original)
+++ cfe/trunk/www/get_started.html Thu Oct  4 13:34:52 2018
@@ -127,23 +127,21 @@ follows:</p>
   </li>
 </ol>
 
-<p>If you encounter problems while building Clang, make sure that your LLVM
-checkout is at the same revision as your Clang checkout. LLVM's interfaces
-change over time, and mismatched revisions are not expected to work
-together.</p>
-
 <h3>Simultaneously Building Clang and LLVM:</h3>
 
 <p>Once you have checked out Clang into the llvm source tree it will build along
 with the rest of <tt>llvm</tt>. To build all of LLVM and Clang together all at
 once simply run <tt>make</tt> from the root LLVM directory.</p>
 
-<p><em>Note:</em> Observe that Clang is technically part of a separate
-Subversion repository. As mentioned above, the latest Clang sources are tied to
-the latest sources in the LLVM tree. You can update your toplevel LLVM project
-and all (possibly unrelated) projects inside it with <tt><b>make
-update</b></tt>. This will run <tt>svn update</tt> on all subdirectories related
-to subversion. </p>
+<p>If you encounter problems while building Clang, make sure that your LLVM
+checkout is at the same revision as your Clang checkout. LLVM's interfaces
+change over time, and mismatched revisions are not expected to work
+together. We recommend writing a script to automatically run <tt>svn up</tt> in
+each repository to keep them synchronized. Alternatively, you may consider using
+the unofficial
+<a href="https://llvm.org/docs/GettingStarted.html#for-developers-to-work-with-a-git-monorepo">git monorepo</a>
+which automatically keeps everything in sync at the same revision and lets you
+commit changes atomically across multiple LLVM subprojects.</p>
 
 <h3 id="buildWindows">Using Visual Studio</h3>
 
@@ -154,37 +152,37 @@ Visual Studio:</p>
   <li>Get the required tools:
   <ul>
     <li><b>Subversion</b>.  Source code control program.  Get it from:
-        <a href="http://subversion.apache.org/packages.html">
-        http://subversion.apache.org/packages.html</a></li>
+        <a href="https://subversion.apache.org/packages.html">
+        https://subversion.apache.org/packages.html</a></li>
     <li><b>CMake</b>.  This is used for generating Visual Studio solution and
         project files.  Get it from:
-        <a href="http://www.cmake.org/cmake/resources/software.html">
-        http://www.cmake.org/cmake/resources/software.html</a></li>
-    <li><b>Visual Studio 2013 or later</b></li>
-    <li><b>Python</b>.  This is needed only if you will be running the tests
-        (which is essential, if you will be developing for clang).
-        Get it from:
-        <a href="http://www.python.org/download/">
-        http://www.python.org/download/</a></li>
+        <a href="https://cmake.org/download/">
+        https://cmake.org/download/</a></li>
+    <li><b>Visual Studio 2015 or later</b></li>
+    <li><b>Python</b>.  It is used to run the clang test suite. Get it from:
+        <a href="https://www.python.org/download/">
+        https://www.python.org/download/</a></li>
     <li><b>GnuWin32 tools</b>
-        These are also necessary for running the tests.
-        (Note that the grep from MSYS or Cygwin doesn't work with the tests
-        because of embedded double-quotes in the search strings.  The GNU
-        grep does work in this case.)
-        Get them from <a href="http://getgnuwin32.sourceforge.net/">
+        The Clang and LLVM test suite use various GNU core utilities, such as
+        <tt>grep</tt>, <tt>sed</tt>, and <tt>find</tt>. The gnuwin32 packages
+        are the oldest and most well-tested way to get these tools. However, the
+        MSys utilities provided by git for Windows have been known to work.
+        Cygwin has worked in the past, but is not well tested.
+        If you don't already have the core utilies from some other source, get
+        gnuwin32 from <a href="http://getgnuwin32.sourceforge.net/">
         http://getgnuwin32.sourceforge.net/</a>.</li>
   </ul>
   </li>
 
   <li>Check out LLVM:
   <ul>
-    <li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
+    <li><tt>svn co https://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
   </ul>
   </li>
   <li>Check out Clang:
   <ul>
      <li><tt>cd llvm\tools</tt>
-     <li><tt>svn co http://llvm.org/svn/llvm-project/cfe/trunk clang</tt></li>
+     <li><tt>svn co https://llvm.org/svn/llvm-project/cfe/trunk clang</tt></li>
   </ul>
   <p><em>Note</em>:  Some Clang tests are sensitive to the line endings.  Ensure
      that checking out the files does not convert LF line endings to CR+LF.
@@ -195,11 +193,12 @@ Visual Studio:</p>
     <li><tt>cd ..\..</tt>  (back to where you started)</li>
     <li><tt>mkdir build</tt> (for building without polluting the source dir)</li>
     <li><tt>cd build</tt></li>
-    <li>If you are using Visual Studio 2013:  <tt>cmake -G "Visual Studio 12" ..\llvm</tt></li>
-    <li>By default, the Visual Studio project files generated by CMake use the
-     32-bit toolset. If you are developing on a 64-bit version of Windows and
-     want to use the 64-bit toolset, pass the ``-Thost=x64`` flag when
-     generating the Visual Studio solution. This requires CMake 3.8.0 or later.</li>
+    <li>
+      If you are using Visual Studio 2017:
+      <tt>cmake -G "Visual Studio 15 2017" -A x64 -Thost=x64 ..\llvm</tt><br/>
+      <tt>-Thost=x64</tt> is required, since the 32-bit linker will run out of memory.
+    </li>
+    <li>To generate x86 binaries instead of x64, pass <tt>-A Win32</tt>.</li>
     <li>See the <a href="https://www.llvm.org/docs/CMake.html">LLVM CMake guide</a> for
         more information on other configuration options for CMake.</li>
     <li>The above, if successful, will have created an LLVM.sln file in the
@@ -224,6 +223,40 @@ Visual Studio:</p>
 to the latest code base, use the <tt>svn update</tt> command in both the
 llvm and llvm\tools\clang directories, as they are separate repositories.</p>
 
+<h3 id="buildWindowsNinja">Using Ninja alongside Visual Studio</h3>
+
+<p>We recommend that developers who want the fastest incremental builds use the
+<a href="https://ninja-build.org/">Ninja build system</a>. You can use the
+generated Visual Studio project files to edit Clang source code and generate a
+second build directory next to it for running the tests with these steps:</p>
+
+<ol>
+  <li>Check out clang and LLVM as described above</li>
+  <li>Open a developer command prompt with the appropriate environment.
+    <ul>
+      <li>If you open the start menu and search for "Command Prompt", you should
+        see shortcuts created by Visual Studio to do this. To use native x64
+        tools, choose the one titled "x64 Native Tools Command Prompt for VS
+        2017".</li>
+      <li> Alternatively, launch a regular <tt>cmd</tt> prompt and run the
+        appropriate vcvarsall.bat incantation. To get the 2017 x64 tools, this
+        would be:<br/>
+        <tt>"C:\Program Files (x86)\Microsoft Visual
+          Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64</tt>
+      </li>
+    </ul>
+  </li>
+  <li><tt>mkdir build_ninja</tt> (or <tt>build</tt>, or use your own
+    organization)</li>
+  <li><tt>cd build_ninja</tt></li>
+  <li><tt>set CC=cl</tt> (necessary to force CMake to choose MSVC over mingw GCC
+    if you have it installed)</li>
+  <li><tt>set CXX=cl</tt></li>
+  <li><tt>cmake -GNinja ..\llvm</tt></li>
+  <li><tt>ninja clang</tt> This will build just clang.</li>
+  <li><tt>ninja check-clang</tt> This will run the clang tests.</li>
+</ol>
+
 <h2 id="driver">Clang Compiler Driver (Drop-in Substitute for GCC)</h2>
 
 <p>The <tt>clang</tt> tool is the compiler driver and front-end, which is




More information about the cfe-commits mailing list