[PATCH] D61909: Add Clang shared library with C++ exports
Chris Bieneman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 14 13:49:34 PDT 2019
beanz updated this revision to Diff 199508.
beanz added a comment.
Changed to lowercase 'c' to match other clang libraries.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61909/new/
https://reviews.llvm.org/D61909
Files:
clang/cmake/modules/AddClang.cmake
clang/tools/CMakeLists.txt
clang/tools/clang-shlib/CMakeLists.txt
clang/tools/clang-shlib/clang-shlib.cpp
Index: clang/tools/clang-shlib/clang-shlib.cpp
===================================================================
--- /dev/null
+++ clang/tools/clang-shlib/clang-shlib.cpp
@@ -0,0 +1 @@
+// Intentionally empty source file to make CMake happy
Index: clang/tools/clang-shlib/CMakeLists.txt
===================================================================
--- /dev/null
+++ clang/tools/clang-shlib/CMakeLists.txt
@@ -0,0 +1,13 @@
+get_property(clang_libs GLOBAL PROPERTY CLANG_STATIC_LIBS)
+
+foreach (lib ${clang_libs})
+ list(APPEND _OBJECTS $<TARGET_OBJECTS:obj.${lib}>)
+ list(APPEND _DEPS $<TARGET_PROPERTY:${lib},INTERFACE_LINK_LIBRARIES>)
+endforeach ()
+
+add_clang_library(clang_shared
+ SHARED
+ clang-shlib.cpp
+ ${_OBJECTS}
+ LINK_LIBS
+ ${_DEPS})
Index: clang/tools/CMakeLists.txt
===================================================================
--- clang/tools/CMakeLists.txt
+++ clang/tools/CMakeLists.txt
@@ -13,6 +13,9 @@
add_clang_subdirectory(clang-rename)
add_clang_subdirectory(clang-refactor)
+if(UNIX)
+ add_clang_subdirectory(clang-shlib)
+endif()
if(CLANG_ENABLE_ARCMT)
add_clang_subdirectory(arcmt-test)
Index: clang/cmake/modules/AddClang.cmake
===================================================================
--- clang/cmake/modules/AddClang.cmake
+++ clang/cmake/modules/AddClang.cmake
@@ -81,9 +81,12 @@
)
endif()
if(ARG_SHARED)
- set(ARG_ENABLE_SHARED SHARED)
+ set(LIBTYPE SHARED)
+ else()
+ set(LIBTYPE STATIC OBJECT)
+ set_property(GLOBAL APPEND PROPERTY CLANG_STATIC_LIBS ${name})
endif()
- llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
+ llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
if(TARGET ${name})
target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61909.199508.patch
Type: text/x-patch
Size: 1906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190514/b49135db/attachment.bin>
More information about the cfe-commits
mailing list