[libcxx-commits] [libcxx] 09943e8 - [libc++] Provide a default LLVM_PATH when building standalone
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jun 29 09:42:23 PDT 2020
Author: Louis Dionne
Date: 2020-06-29T12:40:07-04:00
New Revision: 09943e8de1586dd7f28aa24879fd68717a859588
URL: https://github.com/llvm/llvm-project/commit/09943e8de1586dd7f28aa24879fd68717a859588
DIFF: https://github.com/llvm/llvm-project/commit/09943e8de1586dd7f28aa24879fd68717a859588.diff
LOG: [libc++] Provide a default LLVM_PATH when building standalone
Since we require that libc++ is built as part of the monorepo layout, we
can assume the path of the rest of LLVM and avoid requiring that LLVM_PATH
be set explicitly.
Added:
Modified:
libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
libcxx/docs/BuildingLibcxx.rst
Removed:
################################################################################
diff --git a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
index 757450a6e475..d488b8ede7bf 100644
--- a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
+++ b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
@@ -1,3 +1,7 @@
+if (NOT DEFINED LLVM_PATH)
+ set(LLVM_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../llvm CACHE PATH "" FORCE)
+endif()
+
if(NOT IS_DIRECTORY ${LLVM_PATH})
message(FATAL_ERROR
"The provided LLVM_PATH (${LLVM_PATH}) is not a valid directory. Note that "
diff --git a/libcxx/docs/BuildingLibcxx.rst b/libcxx/docs/BuildingLibcxx.rst
index 0fbb6693099c..c85c3d7fbcb6 100644
--- a/libcxx/docs/BuildingLibcxx.rst
+++ b/libcxx/docs/BuildingLibcxx.rst
@@ -52,21 +52,19 @@ The instructions are for building libc++ on
FreeBSD, Linux, or Mac using `libc++abi`_ as the C++ ABI library.
On Linux, it is also possible to use :ref:`libsupc++ <libsupcxx>` or libcxxrt.
-It is possible to keep your LLVM and libc++ trees separate so you can avoid
-rebuilding LLVM as often. An out-of-tree build would look like this:
+It is possible to build libc++ standalone (i.e. without building other LLVM
+projects). A standalone build would look like this:
.. code-block:: bash
- $ cd where-you-want-libcxx-to-live
- $ # Check out the sources (includes everything, but we'll only use libcxx)
- $ ``git clone https://github.com/llvm/llvm-project.git``
- $ cd where-you-want-to-build
+ $ git clone https://github.com/llvm/llvm-project.git llvm-project
+ $ cd llvm-project
$ mkdir build && cd build
- $ export CC=clang CXX=clang++
- $ cmake -DLLVM_PATH=path/to/separate/llvm \
+ $ cmake -DCMAKE_C_COMPILER=clang \
+ -DCMAKE_CXX_COMPILER=clang++ \
-DLIBCXX_CXX_ABI=libcxxabi \
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=path/to/separate/libcxxabi/include \
- path/to/llvm-project/libcxx
+ ../libcxx
$ make
$ make check-cxx # optional
More information about the libcxx-commits
mailing list