[PATCH] D61909: Add Clang shared library with C++ exports
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 16 15:03:39 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rC360946: Add Clang shared library with C++ exports (authored by cbieneman, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D61909?vs=199508&id=199912#toc
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61909/new/
https://reviews.llvm.org/D61909
Files:
cmake/modules/AddClang.cmake
tools/CMakeLists.txt
tools/clang-shlib/CMakeLists.txt
tools/clang-shlib/clang-shlib.cpp
Index: tools/clang-shlib/CMakeLists.txt
===================================================================
--- tools/clang-shlib/CMakeLists.txt
+++ 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: tools/clang-shlib/clang-shlib.cpp
===================================================================
--- tools/clang-shlib/clang-shlib.cpp
+++ tools/clang-shlib/clang-shlib.cpp
@@ -0,0 +1 @@
+// Intentionally empty source file to make CMake happy
Index: tools/CMakeLists.txt
===================================================================
--- tools/CMakeLists.txt
+++ 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: cmake/modules/AddClang.cmake
===================================================================
--- cmake/modules/AddClang.cmake
+++ 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.199912.patch
Type: text/x-patch
Size: 1893 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190516/837cc75d/attachment.bin>
More information about the cfe-commits
mailing list