[PATCH] Adding llvm-shlib to CMake build system with a few new bells and whistles

Chris Bieneman beanz at apple.com
Tue Oct 21 14:16:40 PDT 2014


I'm not really sure tagging the C API with default visibility would solve the problem I'm trying to solve. Marking the C API as exported, doesn't mark the C++ API to not be exported - which is what I'm trying to do here.

New patches coming soon, and comments below.

================
Comment at: tools/llvm-shlib/CMakeLists.txt:54
@@ +53,3 @@
+    
+    set(LIB_PATH ${CMAKE_BINARY_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX})
+
----------------
rnk wrote:
> I'm not sure if this is always correct with funky generators like VS and XCode.
I'm not too concerned about VS because generally Windows support will need to be done by someone else. I'm a bit weak WRT Windows development. I'll make sure this does the right thing for Xcode though. I mostly work with SublimeText & Ninja.

================
Comment at: tools/llvm-shlib/CMakeLists.txt:59
@@ +58,3 @@
+    add_custom_command(OUTPUT ${LIB_PATH}.exports
+      COMMAND nm ${LIB_PATH} | awk "/T _LLVM/ { print $3 }" | sort -u | sed -e "s/^_//g" > ${LIB_PATH}.exports
+      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/lib
----------------
rnk wrote:
> rnk wrote:
> > Linux (and other OSs) won't add this leading underscore to functions with extern "C" linkage, so nm's output will look like 'T LLVM*'.
> It looks like you can skip the removal of leading underscores, add_llvm_symbol_exports appears to do this for you on Mac.
Good catch. on both of these. I'll update the patches.

http://reviews.llvm.org/D5890






More information about the llvm-commits mailing list