[llvm] docs/GettingStarted: document linker-related cmake options (PR #80932)

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 06:10:30 PST 2024


https://github.com/nhaehnle updated https://github.com/llvm/llvm-project/pull/80932

>From 8928a0e6757e2a7fcf4083f3cea83b7a07c81ead Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= <nicolai.haehnle at amd.com>
Date: Wed, 7 Feb 2024 01:35:53 +0100
Subject: [PATCH 1/2] docs/GettingStarted: document linker-related cmake
 options

Both LLVM_LINK_LLVM_DYLIB and LLVM_PARALLEL_LINK_JOBS help with some
common gotchas. It seems worth documenting them here explicitly.
---
 llvm/docs/GettingStarted.rst | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/llvm/docs/GettingStarted.rst b/llvm/docs/GettingStarted.rst
index 316fc6ad86b848..69475e7e922d1b 100644
--- a/llvm/docs/GettingStarted.rst
+++ b/llvm/docs/GettingStarted.rst
@@ -605,6 +605,13 @@ used by people developing LLVM.
 |                         | ``tools/llvm-shlib/CMakelists.txt``. This option is|
 |                         | not available on Windows.                          |
 +-------------------------+----------------------------------------------------+
+| LLVM_LINK_LLVM_DYLIB    | Link tools against libLLVM.so. This can save a     |
+|                         | significant amount of disk space.                  |
++-------------------------+----------------------------------------------------+
+| LLVM_PARALLEL_LINK_JOBS | Limit the number of parallel linking jobs during   |
+|                         | a parallel build. This can help prevent running    |
+|                         | out of memory  during build.                       |
++-------------------------+----------------------------------------------------+
 | LLVM_OPTIMIZED_TABLEGEN | Builds a release tablegen that gets used during    |
 |                         | the LLVM build. This can dramatically speed up     |
 |                         | debug builds.                                      |

>From 737417af78b8a60edae3d524c2901579d21a6ec2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= <nicolai.haehnle at amd.com>
Date: Wed, 7 Feb 2024 15:08:45 +0100
Subject: [PATCH 2/2] Keep the list of variable names but refer to CMake.rst
 for details

I took the liberty of moving LLVM_ENABLE_DOXYGEN to keep
thematically-related variables closer together.
---
 llvm/docs/CMake.rst          |  2 +
 llvm/docs/GettingStarted.rst | 93 +++++++-----------------------------
 2 files changed, 19 insertions(+), 76 deletions(-)

diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst
index 13d1912ceb2ab8..20f73c99bff89d 100644
--- a/llvm/docs/CMake.rst
+++ b/llvm/docs/CMake.rst
@@ -178,6 +178,8 @@ variable and type on the CMake command line:
 
   $ cmake -DVARIABLE:TYPE=value path/to/llvm/source
 
+.. _cmake_frequently_used_variables:
+
 Frequently-used CMake variables
 -------------------------------
 
diff --git a/llvm/docs/GettingStarted.rst b/llvm/docs/GettingStarted.rst
index 69475e7e922d1b..7e024d59fe87cc 100644
--- a/llvm/docs/GettingStarted.rst
+++ b/llvm/docs/GettingStarted.rst
@@ -540,82 +540,23 @@ Variables are passed to ``cmake`` on the command line using the format
 ``-D<variable name>=<value>``. The following variables are some common options
 used by people developing LLVM.
 
-+-------------------------+----------------------------------------------------+
-| Variable                | Purpose                                            |
-+=========================+====================================================+
-| CMAKE_C_COMPILER        | Tells ``cmake`` which C compiler to use. By        |
-|                         | default, this will be /usr/bin/cc.                 |
-+-------------------------+----------------------------------------------------+
-| CMAKE_CXX_COMPILER      | Tells ``cmake`` which C++ compiler to use. By      |
-|                         | default, this will be /usr/bin/c++.                |
-+-------------------------+----------------------------------------------------+
-| CMAKE_BUILD_TYPE        | Tells ``cmake`` what type of build you are trying  |
-|                         | to generate files for. Valid options are Debug,    |
-|                         | Release, RelWithDebInfo, and MinSizeRel. Default   |
-|                         | is Debug.                                          |
-+-------------------------+----------------------------------------------------+
-| CMAKE_INSTALL_PREFIX    | Specifies the install directory to target when     |
-|                         | running the install action of the build files.     |
-+-------------------------+----------------------------------------------------+
-| Python3_EXECUTABLE      | Forces CMake to use a specific Python version by   |
-|                         | passing a path to a Python interpreter. By default |
-|                         | the Python version of the interpreter in your PATH |
-|                         | is used.                                           |
-+-------------------------+----------------------------------------------------+
-| LLVM_TARGETS_TO_BUILD   | A semicolon delimited list controlling which       |
-|                         | targets will be built and linked into llvm.        |
-|                         | The default list is defined as                     |
-|                         | ``LLVM_ALL_TARGETS``, and can be set to include    |
-|                         | out-of-tree targets. The default value includes:   |
-|                         | ``AArch64, AMDGPU, ARM, AVR, BPF, Hexagon, Lanai,  |
-|                         | Mips, MSP430, NVPTX, PowerPC, RISCV, Sparc,        |
-|                         | SystemZ, WebAssembly, X86, XCore``. Setting this   |
-|                         | to ``"host"`` will only compile the host           |
-|                         | architecture (e.g. equivalent to specifying ``X86``|
-|                         | on an x86 host machine) can                        |
-|                         | significantly speed up compile and test times.     |
-+-------------------------+----------------------------------------------------+
-| LLVM_ENABLE_DOXYGEN     | Build doxygen-based documentation from the source  |
-|                         | code This is disabled by default because it is     |
-|                         | slow and generates a lot of output.                |
-+-------------------------+----------------------------------------------------+
-| LLVM_ENABLE_PROJECTS    | A semicolon-delimited list selecting which of the  |
-|                         | other LLVM subprojects to additionally build. (Only|
-|                         | effective when using a side-by-side project layout |
-|                         | e.g. via git). The default list is empty. Can      |
-|                         | include: clang, clang-tools-extra,                 |
-|                         | cross-project-tests, flang, libc, libclc, lld,     |
-|                         | lldb, mlir, openmp, polly, or pstl.                |
-+-------------------------+----------------------------------------------------+
-| LLVM_ENABLE_RUNTIMES    | A semicolon-delimited list selecting which of the  |
-|                         | runtimes to build. (Only effective when using the  |
-|                         | full monorepo layout). The default list is empty.  |
-|                         | Can include: compiler-rt, libc, libcxx, libcxxabi, |
-|                         | libunwind, or openmp.                              |
-+-------------------------+----------------------------------------------------+
-| LLVM_ENABLE_SPHINX      | Build sphinx-based documentation from the source   |
-|                         | code. This is disabled by default because it is    |
-|                         | slow and generates a lot of output. Sphinx version |
-|                         | 1.5 or later recommended.                          |
-+-------------------------+----------------------------------------------------+
-| LLVM_BUILD_LLVM_DYLIB   | Generate libLLVM.so. This library contains a       |
-|                         | default set of LLVM components that can be         |
-|                         | overridden with ``LLVM_DYLIB_COMPONENTS``. The     |
-|                         | default contains most of LLVM and is defined in    |
-|                         | ``tools/llvm-shlib/CMakelists.txt``. This option is|
-|                         | not available on Windows.                          |
-+-------------------------+----------------------------------------------------+
-| LLVM_LINK_LLVM_DYLIB    | Link tools against libLLVM.so. This can save a     |
-|                         | significant amount of disk space.                  |
-+-------------------------+----------------------------------------------------+
-| LLVM_PARALLEL_LINK_JOBS | Limit the number of parallel linking jobs during   |
-|                         | a parallel build. This can help prevent running    |
-|                         | out of memory  during build.                       |
-+-------------------------+----------------------------------------------------+
-| LLVM_OPTIMIZED_TABLEGEN | Builds a release tablegen that gets used during    |
-|                         | the LLVM build. This can dramatically speed up     |
-|                         | debug builds.                                      |
-+-------------------------+----------------------------------------------------+
+* CMAKE_C_COMPILER
+* CMAKE_CXX_COMPILER
+* CMAKE_BUILD_TYPE
+* CMAKE_INSTALL_PREFIX
+* Python3_EXECUTABLE
+* LLVM_TARGETS_TO_BUILD
+* LLVM_ENABLE_DOXYGEN
+* LLVM_ENABLE_SPHINX
+* LLVM_ENABLE_PROJECTS
+* LLVM_ENABLE_RUNTIMES
+* LLVM_BUILD_LLVM_DYLIB
+* LLVM_LINK_LLVM_DYLIB
+* LLVM_PARALLEL_LINK_JOBS
+* LLVM_OPTIMIZED_TABLEGEN
+
+See :ref:`the list of frequently-used CMake variables <cmake_frequently_used_variables>`
+for more information.
 
 To configure LLVM, follow these steps:
 



More information about the llvm-commits mailing list