This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Allow building both shared and static library
ClosedPublic

Authored by phosek on Aug 5 2016, 4:34 PM.

Details

Summary

This change allows building both shared and static version of libc++ in a single build, sharing object files between both versions.

Diff Detail

Repository
rL LLVM

Event Timeline

phosek updated this revision to Diff 67046.Aug 5 2016, 4:34 PM
phosek retitled this revision from to [libcxx] Allow building both shared and static library.
phosek updated this object.
phosek added a subscriber: llvm-commits.
Eugene.Zelenko set the repository for this revision to rL LLVM.
compnerd added inline comments.Aug 6 2016, 10:20 AM
lib/CMakeLists.txt
188 ↗(On Diff #67046)

Im not sure I understand this. Couldn't you build both static and shared versions, and therefore, need both branches?

phosek added inline comments.Aug 6 2016, 4:46 PM
lib/CMakeLists.txt
188 ↗(On Diff #67046)

These are just link dependencies for libc++experimental.a, libc++.a and libc++.so` will get build in any case (see the cxx meta-target). Using both branches here imply lib/libc++.a -lc++ as link dependency which is most certainly incorrect. In fact, it seems that CMake ignores link dependencies for static libraries (which is a correct behavior) so this entire block can be safely removed.

compnerd accepted this revision.Aug 7 2016, 10:14 PM
compnerd edited edge metadata.
compnerd added inline comments.
lib/CMakeLists.txt
188 ↗(On Diff #67046)

Ah, missed the explicit static on the cxx_experimental.

This revision is now accepted and ready to land.Aug 7 2016, 10:14 PM
This revision was automatically updated to reflect the committed changes.