Skip to content

Commit c0ff108

Browse files
authored
docs/GettingStarted: document linker-related cmake options (#80932)
Both LLVM_LINK_LLVM_DYLIB and LLVM_PARALLEL_LINK_JOBS help with some common gotchas. It seems worth documenting them here explicitly. Based on a review comment, also "refactor" the documentation to avoid duplication.
1 parent b92e0a3 commit c0ff108

File tree

2 files changed

+19
-69
lines changed

2 files changed

+19
-69
lines changed

llvm/docs/CMake.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ variable and type on the CMake command line:
178178
179179
$ cmake -DVARIABLE:TYPE=value path/to/llvm/source
180180
181+
.. _cmake_frequently_used_variables:
182+
181183
Frequently-used CMake variables
182184
-------------------------------
183185

llvm/docs/GettingStarted.rst

Lines changed: 17 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -540,75 +540,23 @@ Variables are passed to ``cmake`` on the command line using the format
540540
``-D<variable name>=<value>``. The following variables are some common options
541541
used by people developing LLVM.
542542

543-
+-------------------------+----------------------------------------------------+
544-
| Variable | Purpose |
545-
+=========================+====================================================+
546-
| CMAKE_C_COMPILER | Tells ``cmake`` which C compiler to use. By |
547-
| | default, this will be /usr/bin/cc. |
548-
+-------------------------+----------------------------------------------------+
549-
| CMAKE_CXX_COMPILER | Tells ``cmake`` which C++ compiler to use. By |
550-
| | default, this will be /usr/bin/c++. |
551-
+-------------------------+----------------------------------------------------+
552-
| CMAKE_BUILD_TYPE | Tells ``cmake`` what type of build you are trying |
553-
| | to generate files for. Valid options are Debug, |
554-
| | Release, RelWithDebInfo, and MinSizeRel. Default |
555-
| | is Debug. |
556-
+-------------------------+----------------------------------------------------+
557-
| CMAKE_INSTALL_PREFIX | Specifies the install directory to target when |
558-
| | running the install action of the build files. |
559-
+-------------------------+----------------------------------------------------+
560-
| Python3_EXECUTABLE | Forces CMake to use a specific Python version by |
561-
| | passing a path to a Python interpreter. By default |
562-
| | the Python version of the interpreter in your PATH |
563-
| | is used. |
564-
+-------------------------+----------------------------------------------------+
565-
| LLVM_TARGETS_TO_BUILD | A semicolon delimited list controlling which |
566-
| | targets will be built and linked into llvm. |
567-
| | The default list is defined as |
568-
| | ``LLVM_ALL_TARGETS``, and can be set to include |
569-
| | out-of-tree targets. The default value includes: |
570-
| | ``AArch64, AMDGPU, ARM, AVR, BPF, Hexagon, Lanai, |
571-
| | Mips, MSP430, NVPTX, PowerPC, RISCV, Sparc, |
572-
| | SystemZ, WebAssembly, X86, XCore``. Setting this |
573-
| | to ``"host"`` will only compile the host |
574-
| | architecture (e.g. equivalent to specifying ``X86``|
575-
| | on an x86 host machine) can |
576-
| | significantly speed up compile and test times. |
577-
+-------------------------+----------------------------------------------------+
578-
| LLVM_ENABLE_DOXYGEN | Build doxygen-based documentation from the source |
579-
| | code This is disabled by default because it is |
580-
| | slow and generates a lot of output. |
581-
+-------------------------+----------------------------------------------------+
582-
| LLVM_ENABLE_PROJECTS | A semicolon-delimited list selecting which of the |
583-
| | other LLVM subprojects to additionally build. (Only|
584-
| | effective when using a side-by-side project layout |
585-
| | e.g. via git). The default list is empty. Can |
586-
| | include: clang, clang-tools-extra, |
587-
| | cross-project-tests, flang, libc, libclc, lld, |
588-
| | lldb, mlir, openmp, polly, or pstl. |
589-
+-------------------------+----------------------------------------------------+
590-
| LLVM_ENABLE_RUNTIMES | A semicolon-delimited list selecting which of the |
591-
| | runtimes to build. (Only effective when using the |
592-
| | full monorepo layout). The default list is empty. |
593-
| | Can include: compiler-rt, libc, libcxx, libcxxabi, |
594-
| | libunwind, or openmp. |
595-
+-------------------------+----------------------------------------------------+
596-
| LLVM_ENABLE_SPHINX | Build sphinx-based documentation from the source |
597-
| | code. This is disabled by default because it is |
598-
| | slow and generates a lot of output. Sphinx version |
599-
| | 1.5 or later recommended. |
600-
+-------------------------+----------------------------------------------------+
601-
| LLVM_BUILD_LLVM_DYLIB | Generate libLLVM.so. This library contains a |
602-
| | default set of LLVM components that can be |
603-
| | overridden with ``LLVM_DYLIB_COMPONENTS``. The |
604-
| | default contains most of LLVM and is defined in |
605-
| | ``tools/llvm-shlib/CMakelists.txt``. This option is|
606-
| | not available on Windows. |
607-
+-------------------------+----------------------------------------------------+
608-
| LLVM_OPTIMIZED_TABLEGEN | Builds a release tablegen that gets used during |
609-
| | the LLVM build. This can dramatically speed up |
610-
| | debug builds. |
611-
+-------------------------+----------------------------------------------------+
543+
* ``CMAKE_C_COMPILER``
544+
* ``CMAKE_CXX_COMPILER``
545+
* ``CMAKE_BUILD_TYPE``
546+
* ``CMAKE_INSTALL_PREFIX``
547+
* ``Python3_EXECUTABLE``
548+
* ``LLVM_TARGETS_TO_BUILD``
549+
* ``LLVM_ENABLE_PROJECTS``
550+
* ``LLVM_ENABLE_RUNTIMES``
551+
* ``LLVM_ENABLE_DOXYGEN``
552+
* ``LLVM_ENABLE_SPHINX``
553+
* ``LLVM_BUILD_LLVM_DYLIB``
554+
* ``LLVM_LINK_LLVM_DYLIB``
555+
* ``LLVM_PARALLEL_LINK_JOBS``
556+
* ``LLVM_OPTIMIZED_TABLEGEN``
557+
558+
See :ref:`the list of frequently-used CMake variables <cmake_frequently_used_variables>`
559+
for more information.
612560

613561
To configure LLVM, follow these steps:
614562

0 commit comments

Comments
 (0)