This is an archive of the discontinued LLVM Phabricator instance.

[CMake][libcxx] Check that we have libcxxabi before using it
ClosedPublic

Authored by phosek on Jan 11 2017, 2:51 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

phosek updated this revision to Diff 84028.Jan 11 2017, 2:51 PM
phosek retitled this revision from to [CMake][libcxx] Check that we have libcxxabi before using it.
phosek updated this object.
phosek added reviewers: beanz, EricWF.
phosek set the repository for this revision to rL LLVM.
phosek added subscribers: llvm-commits, krasin.
krasin added inline comments.Jan 11 2017, 2:59 PM
CMakeLists.txt
122 ↗(On Diff #84028)

This condition is hard to read. What's about

if (HAVE_LIBCXXABI OR NOT LIBCXX_STANDALONE_BUILD) AND
    IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")

Also, can you please elaborate the parts of this condition a bit? I don't follow the logic. How do HAVE_LIBCXXABI, LIBCXX_STANDALONE_BUILD and LIBCXX_LIBCXXABI_INCLUDES_INTERNAL play with each other?

phosek updated this revision to Diff 84035.Jan 11 2017, 3:08 PM
phosek edited edge metadata.
phosek marked an inline comment as done.
krasin accepted this revision.Jan 11 2017, 3:15 PM
krasin added a reviewer: krasin.
This revision is now accepted and ready to land.Jan 11 2017, 3:15 PM

We now have basically 3 modes of operations when building libc++:

  1. building libc++ as part of LLVM using projects/ when neither LIBCXX_STANDALONE_BUILD is nor HAVE_LIBCXXABI is defined, but we to link against libc++abi if it's available hence the IS_DIRECTORY check
  2. building libc++ as part of LLVM using runtimes/ when LIBCXX_STANDALONE_BUILD is set and HAVE_LIBCXXABI will be set as well if libc++abi is being built as part of runtimes/ in which case we want to link against it
  3. building libc++ standalone when only LIBCXX_STANDALONE_BUILD is set in which case we shouldn't be using libc++abi even if it's present (the IS_DIRECTORY is true) because it might not be built

With D28579, we'll be building libc++ for TSan as standalone, but since we aren't building libc++abi as well we shouldn't attempt to use even if it's in the tree hence the change in the condition.

This revision was automatically updated to reflect the committed changes.