[PATCH] D141825: [docs] Expand example on stand-alone builds.

Francesco Petrogalli via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 16 07:03:18 PST 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG730c7a45f5f6: [docs] Expand example on stand-alone builds. (authored by fpetrogalli).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141825/new/

https://reviews.llvm.org/D141825

Files:
  llvm/docs/GettingStarted.rst


Index: llvm/docs/GettingStarted.rst
===================================================================
--- llvm/docs/GettingStarted.rst
+++ llvm/docs/GettingStarted.rst
@@ -127,7 +127,7 @@
 
 .. code-block:: console
 
-  cmake -G Ninja -S llvm -B $builddir \
+  cmake -G Ninja -S path/to/llvm-project/llvm -B $builddir \
         -DLLVM_INSTALL_UTILS=ON \
         -DCMAKE_INSTALL_PREFIX=/path/to/llvm/install/prefix \
         < other options >
@@ -138,15 +138,23 @@
 
 .. code-block:: console
 
-  cmake -G Ninja -S $subproj -B $buildir \
+  cmake -G Ninja -S path/to/llvm-project/$subproj \
+        -B $buildir_subproj \
         -DLLVM_EXTERNAL_LIT=/path/to/lit \
         -DLLVM_ROOT=/path/to/llvm/install/prefix
 
-``LLVM_ROOT`` should point to the prefix of your llvm installation, so for example,
-if llvm is installed into ``/usr/bin`` and ``/usr/lib64``, then you should pass
-``-DLLVM_ROOT=/usr/``.  Both the ``LLVM_ROOT`` and ``LLVM_EXTERNAL_LIT`` options
-are required to do stand-alone builds for all sub-projects.  Additional required
-options for each sub-project can be found in the table below.
+Notice that:
+
+* The stand-alone build needs to happen in a folder that is not the
+  original folder where LLVMN was built
+  (`$builddir!=$builddir_subproj`).
+* ``LLVM_ROOT`` should point to the prefix of your llvm installation,
+   so for example, if llvm is installed into ``/usr/bin`` and
+   ``/usr/lib64``, then you should pass ``-DLLVM_ROOT=/usr/``.
+* Both the ``LLVM_ROOT`` and ``LLVM_EXTERNAL_LIT`` options are
+  required to do stand-alone builds for all sub-projects.  Additional
+  required options for each sub-project can be found in the table
+  below.
 
 The ``check-$subproj`` and ``install`` build targets are supported for the
 sub-projects listed in the table below.
@@ -159,6 +167,31 @@
 lld          lld, cmake
 ============ ======================== ======================
 
+Example for building stand-alone `clang`:
+
+.. code-block:: console
+
+   #!/bin/sh
+
+   build_llvm=`pwd`/build-llvm
+   build_clang=`pwd`/build-clang
+   installprefix=`pwd`/install
+   llvm=`pwd`/llvm-project
+   mkdir -p $build_llvm
+   mkdir -p $installprefix
+
+   cmake -G Ninja -S $llvm/llvm -B $build_llvm \
+         -DLLVM_INSTALL_UTILS=ON \
+         -DCMAKE_INSTALL_PREFIX=$installprefix \
+         -DCMAKE_BUILD_TYPE=Release
+
+   ninja -C $build_llvm install
+
+   cmake -G Ninja -S $llvm/clang -B $build_clang \
+         -DLLVM_EXTERNAL_LIT=$build_llvm/utils/lit \
+         -DLLVM_ROOT=$installprefix
+
+   ninja -C $build_clang
 
 Requirements
 ============


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141825.489547.patch
Type: text/x-patch
Size: 2597 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230116/7b5745b0/attachment.bin>


More information about the llvm-commits mailing list