diff --git a/llvm/docs/GettingStarted.rst b/llvm/docs/GettingStarted.rst --- a/llvm/docs/GettingStarted.rst +++ b/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 ============