Skip to content

Commit 97fdb3a

Browse files
committed
Update all LLVM documentation mentioning runtimes in LLVM_ENABLE_PROJECTS
We are moving away from building the runtimes with LLVM_ENABLE_PROJECTS, however the documentation was largely outdated. This commit updates all the documentation I could find to use LLVM_ENABLE_RUNTIMES instead of LLVM_ENABLE_PROJECTS for building runtimes. Note that in the near future, libcxx, libcxxabi and libunwind will stop supporting being built with LLVM_ENABLE_PROJECTS altogether. I don't know what the plans are for other runtimes like libc, openmp and compiler-rt, so I didn't make any changes to the documentation that would imply something for those projects. Once this lands, I will also cherry-pick this on the release/14.x branch to make sure that LLVM's documentation is up-to-date and reflects what we intend to support in the future. Differential Revision: https://reviews.llvm.org/D119351 (cherry picked from commit 4ae83bb)
1 parent 2ead82c commit 97fdb3a

File tree

11 files changed

+60
-36
lines changed

11 files changed

+60
-36
lines changed

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,25 @@ This is an example work-flow and configuration to get and build the LLVM source:
6363

6464
Some common options:
6565

66-
* ``-DLLVM_ENABLE_PROJECTS='...'`` --- semicolon-separated list of the LLVM
67-
sub-projects you'd like to additionally build. Can include any of: clang,
68-
clang-tools-extra, compiler-rt,cross-project-tests, flang, libc, libclc,
69-
libcxx, libcxxabi, libunwind, lld, lldb, mlir, openmp, polly, or pstl.
66+
* ``-DLLVM_ENABLE_PROJECTS='...'`` and ``-DLLVM_ENABLE_RUNTIMES='...'`` ---
67+
semicolon-separated list of the LLVM sub-projects and runtimes you'd like to
68+
additionally build. ``LLVM_ENABLE_PROJECTS`` can include any of: clang,
69+
clang-tools-extra, cross-project-tests, flang, libc, libclc, lld, lldb,
70+
mlir, openmp, polly, or pstl. ``LLVM_ENABLE_RUNTIMES`` can include any of
71+
libcxx, libcxxabi, libunwind, compiler-rt, libc or openmp. Some runtime
72+
projects can be specified either in ``LLVM_ENABLE_PROJECTS`` or in
73+
``LLVM_ENABLE_RUNTIMES``.
7074

7175
For example, to build LLVM, Clang, libcxx, and libcxxabi, use
72-
``-DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi"``.
76+
``-DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"``.
7377

7478
* ``-DCMAKE_INSTALL_PREFIX=directory`` --- Specify for *directory* the full
7579
path name of where you want the LLVM tools and libraries to be installed
76-
(default ``/usr/local``).
80+
(default ``/usr/local``). Be careful if you install runtime libraries: if
81+
your system uses those provided by LLVM (like libc++ or libc++abi), you
82+
must not overwrite your system's copy of those libraries, since that
83+
could render your system unusable. In general, using something like
84+
``/usr`` is not advised, but ``/usr/local`` is fine.
7785

7886
* ``-DCMAKE_BUILD_TYPE=type`` --- Valid options for *type* are Debug,
7987
Release, RelWithDebInfo, and MinSizeRel. Default is Debug.

bolt/docs/OptimizingClang.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Collecting accurate profile requires running `perf` on a hardware that
4141
implements taken branch sampling (`-b/-j` flag). For that reason, it may not be possible to
4242
collect the accurate profile in a virtualized environment, e.g. in the cloud.
4343
We do support regular sampling profiles, but the performance
44-
improvements are expected to be more modest.
44+
improvements are expected to be more modest.
4545

4646
```bash
4747
$ mkdir ${TOPLEV}/stage3
@@ -211,7 +211,8 @@ $ cd ${TOPLEV}/stage1
211211
$ cmake -G Ninja ${TOPLEV}/llvm-project/llvm -DLLVM_TARGETS_TO_BUILD=X86 \
212212
-DCMAKE_BUILD_TYPE=Release \
213213
-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_ASM_COMPILER=gcc \
214-
-DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" \
214+
-DLLVM_ENABLE_PROJECTS="clang;lld" \
215+
-DLLVM_ENABLE_RUNTIMES="compiler-rt" \
215216
-DCOMPILER_RT_BUILD_SANITIZERS=OFF -DCOMPILER_RT_BUILD_XRAY=OFF \
216217
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
217218
-DCMAKE_INSTALL_PREFIX=${TOPLEV}/stage1/install

clang/docs/DataFlowSanitizer.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ libc++ and the libc++ ABI with data flow sanitizer instrumentation.
3232

3333
.. code-block:: console
3434
35+
mkdir libcxx-build
3536
cd libcxx-build
3637
3738
# An example using ninja
38-
cmake -GNinja path/to/llvm-project/llvm \
39+
cmake -GNinja -S <monorepo-root>/runtimes \
3940
-DCMAKE_C_COMPILER=clang \
4041
-DCMAKE_CXX_COMPILER=clang++ \
4142
-DLLVM_USE_SANITIZER="DataFlow" \
42-
-DLLVM_ENABLE_LIBCXX=ON \
43-
-DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi"
43+
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"
4444
4545
ninja cxx cxxabi
4646

clang/docs/Toolchain.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ libunwind (LLVM)
230230
^^^^^^^^^^^^^^^^
231231

232232
LLVM's unwinder library is part of the llvm-project git repository. To
233-
build it, pass ``-DLLVM_ENABLE_PROJECTS=libunwind`` to the cmake invocation.
233+
build it, pass ``-DLLVM_ENABLE_RUNTIMES=libunwind`` to the cmake invocation.
234234

235235
If using libc++abi, you may need to configure it to use libunwind
236236
rather than libgcc_s by passing ``-DLIBCXXABI_USE_LLVM_UNWINDER=YES``

compiler-rt/www/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ <h2>Get it and get involved!</h2>
112112
<p>Generally, you need to build LLVM/Clang in order to build compiler-rt. You
113113
can build it either together with llvm and clang, or separately.
114114

115-
<p>To build it together, simply add compiler-rt to the -DLLVM_ENABLE_PROJECTS= option to
115+
<p>To build it together, simply add compiler-rt to the -DLLVM_ENABLE_RUNTIMES= option to
116116
cmake.
117117

118118
<p>To build it separately, first

flang/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ read the [style guide](docs/C++style.md)
3333
and
3434
also review [how flang uses modern C++ features](docs/C++17.md).
3535

36-
If you are interested in writing new documentation, follow
37-
[markdown style guide from LLVM](https://github.com/llvm/llvm-project/blob/main/llvm/docs/MarkdownQuickstartTemplate.md).
36+
If you are interested in writing new documentation, follow
37+
[LLVM's Markdown style guide](https://github.com/llvm/llvm-project/blob/main/llvm/docs/MarkdownQuickstartTemplate.md).
3838

3939
## Building flang
4040
There are two ways to build flang. The first method is to build it at the same
@@ -55,7 +55,7 @@ Note that compiler-rt is only needed to access libraries that support 16 bit
5555
floating point numbers. It's not needed to run the automated tests.
5656

5757
Here's a complete set of commands to clone all of the necessary source and do
58-
the build.
58+
the build.
5959

6060
First clone the source:
6161
```bash
@@ -79,7 +79,8 @@ cmake \
7979
-DLLVM_TARGETS_TO_BUILD=host \
8080
-DCMAKE_INSTALL_PREFIX=$INSTALLDIR
8181
-DLLVM_LIT_ARGS=-v \
82-
-DLLVM_ENABLE_PROJECTS="clang;mlir;flang;compiler-rt"
82+
-DLLVM_ENABLE_PROJECTS="clang;mlir;flang" \
83+
-DLLVM_ENABLE_RUNTIMES="compiler-rt"
8384

8485
ninja
8586
```

libcxx/docs/BuildingLibcxx.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,8 @@ We can now run CMake:
523523

524524
.. code-block:: bash
525525
526-
$ cmake -G Ninja -S llvm -B build \
527-
-DLLVM_ENABLE_PROJECTS="libcxx" \
526+
$ cmake -G Ninja -S runtimes -B build \
527+
-DLLVM_ENABLE_RUNTIMES="libcxx" \
528528
-DLIBCXX_CXX_ABI=libstdc++ \
529529
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="/usr/include/c++/4.7/;/usr/include/c++/4.7/x86_64-linux-gnu/"
530530
$ ninja -C build install-cxx
@@ -549,8 +549,8 @@ We can now run CMake like:
549549

550550
.. code-block:: bash
551551
552-
$ cmake -G Ninja -S llvm -B build \
553-
-DLLVM_ENABLE_PROJECTS="libcxx" \
552+
$ cmake -G Ninja -S runtimes -B build \
553+
-DLLVM_ENABLE_RUNTIMES="libcxx" \
554554
-DLIBCXX_CXX_ABI=libcxxrt \
555555
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=path/to/libcxxrt-sources/src
556556
$ ninja -C build install-cxx

libunwind/docs/BuildingLibunwind.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The basic steps needed to build libc++ are:
3232
* ``cd where you want to build llvm``
3333
* ``mkdir build``
3434
* ``cd build``
35-
* ``cmake -G <generator> -DLLVM_ENABLE_PROJECTS=libunwind [options] <path to llvm sources>``
35+
* ``cmake -G <generator> -DLLVM_ENABLE_RUNTIMES=libunwind [options] <llvm-monorepo>/runtimes``
3636

3737
For more information about configuring libunwind see :ref:`CMake Options`.
3838

llvm/docs/BuildingADistribution.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ Relevant CMake Options
199199
This section provides documentation of the CMake options that are intended to
200200
help construct distributions. This is not an exhaustive list, and many
201201
additional options are documented in the :doc:`CMake` page. Some key options
202-
that are already documented include: *LLVM_TARGETS_TO_BUILD*,
203-
*LLVM_ENABLE_PROJECTS*, *LLVM_BUILD_LLVM_DYLIB*, and *LLVM_LINK_LLVM_DYLIB*.
202+
that are already documented include: *LLVM_TARGETS_TO_BUILD*, *LLVM_ENABLE_PROJECTS*,
203+
*LLVM_ENABLE_RUNTIMES*, *LLVM_BUILD_LLVM_DYLIB*, and *LLVM_LINK_LLVM_DYLIB*.
204204

205205
**LLVM_ENABLE_RUNTIMES**:STRING
206206
When building a distribution that includes LLVM runtime projects (i.e. libcxx,

llvm/docs/CMake.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ description is in `LLVM-related variables`_ below.
221221
Control which projects are enabled. For example you may want to work on clang
222222
or lldb by specifying ``-DLLVM_ENABLE_PROJECTS="clang;lldb"``.
223223

224+
**LLVM_ENABLE_RUNTIMES**:STRING
225+
Control which runtimes are enabled. For example you may want to work on
226+
libc++ or libc++abi by specifying ``-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"``.
227+
224228
**LLVM_LIBDIR_SUFFIX**:STRING
225229
Extra suffix to append to the directory where libraries are to be
226230
installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
@@ -505,17 +509,17 @@ enabled sub-projects. Nearly all of these variable names begin with
505509

506510
**LLVM_ENABLE_PROJECTS**:STRING
507511
Semicolon-separated list of projects to build, or *all* for building all
508-
(clang, lldb, compiler-rt, lld, polly, etc) projects. This flag assumes
509-
that projects are checked out side-by-side and not nested, i.e. clang
510-
needs to be in parallel of llvm instead of nested in `llvm/tools`.
511-
This feature allows to have one build for only LLVM and another for clang+llvm
512-
using the same source checkout.
512+
(clang, lldb, lld, polly, etc) projects. This flag assumes that projects
513+
are checked out side-by-side and not nested, i.e. clang needs to be in
514+
parallel of llvm instead of nested in `llvm/tools`. This feature allows
515+
to have one build for only LLVM and another for clang+llvm using the same
516+
source checkout.
513517
The full list is:
514-
``clang;clang-tools-extra;compiler-rt;cross-project-tests;libc;libclc;lld;lldb;openmp;polly;pstl``
518+
``clang;clang-tools-extra;cross-project-tests;libc;libclc;lld;lldb;openmp;polly;pstl``
515519

516520
**LLVM_ENABLE_RUNTIMES**:STRING
517-
Build libc++, libc++abi or other projects using that a just-built compiler.
518-
This is the correct way to build libc++ when putting together a toolchain.
521+
Build libc++, libc++abi, libunwind or compiler-rt using the just-built compiler.
522+
This is the correct way to build runtimes when putting together a toolchain.
519523
It will build the builtins separately from the other runtimes to preserve
520524
correct dependency ordering. If you want to build the runtimes using a system
521525
compiler, see the `libc++ documentation <https://libcxx.llvm.org/BuildingLibcxx.html>`_.

llvm/docs/GettingStarted.rst

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -623,10 +623,15 @@ used by people developing LLVM.
623623
| | other LLVM subprojects to additionally build. (Only|
624624
| | effective when using a side-by-side project layout |
625625
| | e.g. via git). The default list is empty. Can |
626-
| | include: clang, clang-tools-extra, compiler-rt, |
627-
| | cross-project-tests, flang, libc, libclc, libcxx, |
628-
| | libcxxabi, libunwind, lld, lldb, mlir, openmp, |
629-
| | polly, or pstl. |
626+
| | include: clang, clang-tools-extra, |
627+
| | cross-project-tests, flang, libc, libclc, lld, |
628+
| | lldb, mlir, openmp, polly, or pstl. |
629+
+-------------------------+----------------------------------------------------+
630+
| LLVM_ENABLE_RUNTIMES | A semicolon-delimited list selecting which of the |
631+
| | runtimes to build. (Only effective when using the |
632+
| | full monorepo layout). The default list is empty. |
633+
| | Can include: compiler-rt, libc, libcxx, libcxxabi, |
634+
| | libunwind, or openmp. |
630635
+-------------------------+----------------------------------------------------+
631636
| LLVM_ENABLE_SPHINX | Build sphinx-based documentation from the source |
632637
| | code. This is disabled by default because it is |
@@ -1217,6 +1222,11 @@ following options with cmake:
12171222
compiling more than one project, separate the items with a semicolon. Should
12181223
you run into issues with the semicolon, try surrounding it with single quotes.
12191224

1225+
* -DLLVM_ENABLE_RUNTIMES
1226+
Set this equal to the runtimes you wish to compile (e.g. libcxx, libcxxabi, etc.)
1227+
If compiling more than one runtime, separate the items with a semicolon. Should
1228+
you run into issues with the semicolon, try surrounding it with single quotes.
1229+
12201230
* -DCLANG_ENABLE_STATIC_ANALYZER
12211231
Set this option to OFF if you do not require the clang static analyzer. This
12221232
should improve your build time slightly.

0 commit comments

Comments
 (0)