This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Introduce libLLVM.so as LLVM_ENABLE_SHARED
Needs ReviewPublic

Authored by chapuni on Mar 4 2014, 9:06 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Note, this includes; http://llvm-reviews.chandlerc.com/D2941

Why using OBJLIB?

  • --whole-archive is available only for GNU ld. Rather, I chose linking whole OBJLIBs.
  • No need to create *.a(s). Archive files may be created in parallel.

Why introducing DEPENDS instead of add_dependencies?

  • add_dependencies(target) works only for the target. Implicitly generated obj.LLVM*** are required to add deps to generated files.

Why llvm-tblgen and clang-tblgen are tweaked?

  • They should be built out of LINK_COMPONENTS with -static.

Why LLVM_ENABLE_SHARED turns off LLVM_DEAD_STRIP?

  • I think -ffunction-sections would not make sense for the big libLLVM.so.

TODO

  • libLLVM-3.5.so may have VERSION.
  • Consider c-index-test with libclang. With this, it requires "libclang.so libLLVM.so" in its command line to link it. If we could use -rpath-link, it might be simply "libclang.so" w/o libLLVM.so.
  • Introduce Clang's big shared libraries.
  • Introduce LLVM.dll for cygming.
  • Introduce LLVM.dll for whole win32. (It would require dllexport/dllimport in public headers)

Diff Detail

Event Timeline

chapuni updated this revision to Unknown Object (????).Mar 5 2014, 8:27 AM

I updated this BUILD_SHARED_LIBS-friendly.

  • With LLVM_ENABLE_SHARED and BUILD_SHARED_LIBS, libLLVM.so behaves "convenient library" w/o any contents.
  • Don't create obj.FOO if FOO is SHARED. (It would make building serialized, though)
  • Prune DEAD_STRIP stuff. It was micro-optimization.

TODO:
With LLVM_ENABLE_SHARED and BUILD_SHARED_LIBS, a warning could be seen;

You have called ADD_LIBRARY for library LLVM_shared without any source files.
This typically indicates a problem with your CMakeLists.txt file

I have to add at least one dummy.cpp to appease it.

chandlerc resigned from this revision.Mar 29 2015, 11:39 AM
chandlerc removed a reviewer: chandlerc.

Really stale patch and not clear if this is really something folks are still interested in as there have been lots of changes to the build since.

Update and add me back (or start a fresh revision) if this is still something you want to pursue.