[compiler-rt] r205183 - [CMake] Rename add_compiler_rt_static_runtime to add_compiler_rt_runtime.

Alexey Samsonov samsonov at google.com
Mon Mar 31 06:45:36 PDT 2014


Author: samsonov
Date: Mon Mar 31 08:45:36 2014
New Revision: 205183

URL: http://llvm.org/viewvc/llvm-project?rev=205183&view=rev
Log:
[CMake] Rename add_compiler_rt_static_runtime to add_compiler_rt_runtime.

Soon there will be an option to build compiler-rt parts as shared libraries
on Linux. Extracted from http://llvm-reviews.chandlerc.com/D3042
by Yuri Gribov.


Modified:
    compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
    compiler-rt/trunk/lib/asan/CMakeLists.txt
    compiler-rt/trunk/lib/builtins/CMakeLists.txt
    compiler-rt/trunk/lib/dfsan/CMakeLists.txt
    compiler-rt/trunk/lib/lsan/CMakeLists.txt
    compiler-rt/trunk/lib/msan/CMakeLists.txt
    compiler-rt/trunk/lib/profile/CMakeLists.txt
    compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
    compiler-rt/trunk/lib/tsan/CMakeLists.txt
    compiler-rt/trunk/lib/tsan/dd/CMakeLists.txt
    compiler-rt/trunk/lib/ubsan/CMakeLists.txt

Modified: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake?rev=205183&r1=205182&r2=205183&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake Mon Mar 31 08:45:36 2014
@@ -37,33 +37,37 @@ macro(add_compiler_rt_darwin_object_libr
     COMPILE_DEFINITIONS ${LIB_DEFS})
 endmacro()
 
-# Adds static runtime for a given architecture and puts it in the proper
-# directory in the build and install trees.
-# add_compiler_rt_static_runtime(<name> <arch>
-#                                SOURCES <source files>
-#                                CFLAGS <compile flags>
-#                                DEFS <compile definitions>)
-macro(add_compiler_rt_static_runtime name arch)
+# Adds static or shared runtime for a given architecture and puts it in the
+# proper directory in the build and install trees.
+# add_compiler_rt_runtime(<name> <arch> {STATIC,SHARED}
+#                         SOURCES <source files>
+#                         CFLAGS <compile flags>
+#                         DEFS <compile definitions>)
+macro(add_compiler_rt_runtime name arch type)
   if(CAN_TARGET_${arch})
     parse_arguments(LIB "SOURCES;CFLAGS;DEFS" "" ${ARGN})
-    add_library(${name} STATIC ${LIB_SOURCES})
+    add_library(${name} ${type} ${LIB_SOURCES})
     # Setup compile flags and definitions.
     set_target_compile_flags(${name}
       ${TARGET_${arch}_CFLAGS} ${LIB_CFLAGS})
+    set_target_link_flags(${name}
+      ${TARGET_${arch}_CFLAGS} ${LIB_CFLAGS})
     set_property(TARGET ${name} APPEND PROPERTY
       COMPILE_DEFINITIONS ${LIB_DEFS})
     # Setup correct output directory in the build tree.
     set_target_properties(${name} PROPERTIES
-      ARCHIVE_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR})
+      ARCHIVE_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
+      LIBRARY_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR})
     # Add installation command.
     install(TARGETS ${name}
-      ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
+      ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR}
+      LIBRARY DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
   else()
     message(FATAL_ERROR "Archtecture ${arch} can't be targeted")
   endif()
 endmacro()
 
-# Same as add_compiler_rt_static_runtime, but creates a universal library
+# Same as add_compiler_rt_runtime(... STATIC), but creates a universal library
 # for several architectures.
 # add_compiler_rt_osx_static_runtime(<name> ARCH <architectures>
 #                                    SOURCES <source files>

Modified: compiler-rt/trunk/lib/asan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/CMakeLists.txt?rev=205183&r1=205182&r2=205183&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/CMakeLists.txt Mon Mar 31 08:45:36 2014
@@ -113,7 +113,7 @@ else()
       list(APPEND ASAN_RUNTIME_OBJECTS $<TARGET_OBJECTS:RTLSanCommon.${arch}>)
     endif()
 
-    add_compiler_rt_static_runtime(clang_rt.asan-${arch} ${arch}
+    add_compiler_rt_runtime(clang_rt.asan-${arch} ${arch} STATIC
       SOURCES ${ASAN_RUNTIME_OBJECTS}
       CFLAGS ${ASAN_CFLAGS}
       DEFS ${ASAN_COMMON_DEFINITIONS})
@@ -124,10 +124,10 @@ else()
     endif()
 
     if (WIN32)
-      add_compiler_rt_static_runtime(clang_rt.asan_dll_thunk-${arch} ${arch}
-      SOURCES asan_dll_thunk.cc
-      CFLAGS ${ASAN_CFLAGS} -DASAN_DLL_THUNK
-      DEFS ${ASAN_COMMON_DEFINITIONS})
+      add_compiler_rt_runtime(clang_rt.asan_dll_thunk-${arch} ${arch} STATIC
+        SOURCES asan_dll_thunk.cc
+        CFLAGS ${ASAN_CFLAGS} -DASAN_DLL_THUNK
+        DEFS ${ASAN_COMMON_DEFINITIONS})
       add_dependencies(asan clang_rt.asan_dll_thunk-${arch})
     endif()
   endforeach()

Modified: compiler-rt/trunk/lib/builtins/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/CMakeLists.txt?rev=205183&r1=205182&r2=205183&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/builtins/CMakeLists.txt Mon Mar 31 08:45:36 2014
@@ -247,7 +247,7 @@ add_custom_target(builtins)
 if (NOT WIN32)
   foreach(arch x86_64 i386 arm)
     if(CAN_TARGET_${arch})
-      add_compiler_rt_static_runtime(clang_rt.${arch} ${arch}
+      add_compiler_rt_runtime(clang_rt.${arch} ${arch} STATIC
         SOURCES ${${arch}_SOURCES}
         CFLAGS "-std=c99")
       add_dependencies(builtins clang_rt.${arch})

Modified: compiler-rt/trunk/lib/dfsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/dfsan/CMakeLists.txt?rev=205183&r1=205182&r2=205183&view=diff
==============================================================================
--- compiler-rt/trunk/lib/dfsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/dfsan/CMakeLists.txt Mon Mar 31 08:45:36 2014
@@ -15,14 +15,14 @@ set(arch "x86_64")
 if(CAN_TARGET_${arch})
   set(DFSAN_CFLAGS ${DFSAN_COMMON_CFLAGS})
   append_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE DFSAN_CFLAGS)
-  add_compiler_rt_static_runtime(clang_rt.dfsan-${arch} ${arch}
+  add_compiler_rt_runtime(clang_rt.dfsan-${arch} ${arch} STATIC
     SOURCES ${DFSAN_RTL_SOURCES}
             $<TARGET_OBJECTS:RTInterception.${arch}>
             $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
             $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
     CFLAGS ${DFSAN_CFLAGS})
   set(DFSAN_NOLIBC_CFLAGS ${DFSAN_COMMON_CFLAGS} -DDFSAN_NOLIBC)
-  add_compiler_rt_static_runtime(clang_rt.dfsan-libc-${arch} ${arch}
+  add_compiler_rt_runtime(clang_rt.dfsan-libc-${arch} ${arch} STATIC
     SOURCES ${DFSAN_RTL_SOURCES}
             $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
             CFLAGS ${DFSAN_NOLIBC_CFLAGS})

Modified: compiler-rt/trunk/lib/lsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/CMakeLists.txt?rev=205183&r1=205182&r2=205183&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/lsan/CMakeLists.txt Mon Mar 31 08:45:36 2014
@@ -38,7 +38,7 @@ elseif(NOT ANDROID)
   endforeach()
 
   foreach(arch ${LSAN_SUPPORTED_ARCH})
-    add_compiler_rt_static_runtime(clang_rt.lsan-${arch} ${arch}
+    add_compiler_rt_runtime(clang_rt.lsan-${arch} ${arch} STATIC
       SOURCES ${LSAN_SOURCES}
               $<TARGET_OBJECTS:RTInterception.${arch}>
               $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>

Modified: compiler-rt/trunk/lib/msan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/CMakeLists.txt?rev=205183&r1=205182&r2=205183&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/msan/CMakeLists.txt Mon Mar 31 08:45:36 2014
@@ -20,7 +20,7 @@ append_if(COMPILER_RT_HAS_FFREESTANDING_
 add_custom_target(msan)
 set(arch "x86_64")
 if(CAN_TARGET_${arch})
-  add_compiler_rt_static_runtime(clang_rt.msan-${arch} ${arch}
+  add_compiler_rt_runtime(clang_rt.msan-${arch} ${arch} STATIC
     SOURCES ${MSAN_RTL_SOURCES}
             $<TARGET_OBJECTS:RTInterception.${arch}>
             $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>

Modified: compiler-rt/trunk/lib/profile/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/CMakeLists.txt?rev=205183&r1=205182&r2=205183&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/profile/CMakeLists.txt Mon Mar 31 08:45:36 2014
@@ -25,8 +25,7 @@ else()
     InstrProfilingRuntime.cc)
 
   foreach(arch ${PROFILE_SUPPORTED_ARCH})
-    add_compiler_rt_static_runtime(clang_rt.profile-${arch}
-      ${arch}
+    add_compiler_rt_runtime(clang_rt.profile-${arch} ${arch} STATIC
       SOURCES ${PROFILE_SOURCES})
     add_dependencies(profile clang_rt.profile-${arch})
   endforeach()

Modified: compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt?rev=205183&r1=205182&r2=205183&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt Mon Mar 31 08:45:36 2014
@@ -129,7 +129,7 @@ else()
       DEFS ${SANITIZER_COMMON_DEFINITIONS})
     list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.${arch}
                                             RTSanitizerCommonLibc.${arch})
-    add_compiler_rt_static_runtime(clang_rt.san-${arch} ${arch}
+    add_compiler_rt_runtime(clang_rt.san-${arch} ${arch} STATIC
       SOURCES $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
               $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
       CFLAGS ${SANITIZER_CFLAGS}

Modified: compiler-rt/trunk/lib/tsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/CMakeLists.txt?rev=205183&r1=205182&r2=205183&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/CMakeLists.txt Mon Mar 31 08:45:36 2014
@@ -83,7 +83,7 @@ if(CAN_TARGET_x86_64 AND UNIX AND NOT AP
   set_source_files_properties(${TSAN_ASM_SOURCES} PROPERTIES
     LANGUAGE C)
   set(arch "x86_64")
-  add_compiler_rt_static_runtime(clang_rt.tsan-${arch} ${arch}
+  add_compiler_rt_runtime(clang_rt.tsan-${arch} ${arch} STATIC
     SOURCES ${TSAN_SOURCES} ${TSAN_ASM_SOURCES}
             $<TARGET_OBJECTS:RTInterception.${arch}>
             $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>

Modified: compiler-rt/trunk/lib/tsan/dd/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/dd/CMakeLists.txt?rev=205183&r1=205182&r2=205183&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/dd/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/dd/CMakeLists.txt Mon Mar 31 08:45:36 2014
@@ -26,7 +26,7 @@ add_custom_target(dd)
 # Deadlock detector is currently supported on 64-bit Linux only.
 if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID)
   set(arch "x86_64")
-  add_compiler_rt_static_runtime(clang_rt.dd-${arch} ${arch}
+  add_compiler_rt_runtime(clang_rt.dd-${arch} ${arch} STATIC
     SOURCES ${DD_SOURCES}
             $<TARGET_OBJECTS:RTInterception.${arch}>
             $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>

Modified: compiler-rt/trunk/lib/ubsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/CMakeLists.txt?rev=205183&r1=205182&r2=205183&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/ubsan/CMakeLists.txt Mon Mar 31 08:45:36 2014
@@ -29,11 +29,11 @@ else()
   # Build separate libraries for each target.
   foreach(arch ${UBSAN_SUPPORTED_ARCH})
     # Main UBSan runtime.
-    add_compiler_rt_static_runtime(clang_rt.ubsan-${arch} ${arch}
+    add_compiler_rt_runtime(clang_rt.ubsan-${arch} ${arch} STATIC
       SOURCES ${UBSAN_SOURCES}
       CFLAGS ${UBSAN_CFLAGS})
     # C++-specific parts of UBSan runtime. Requires a C++ ABI library.
-    add_compiler_rt_static_runtime(clang_rt.ubsan_cxx-${arch} ${arch}
+    add_compiler_rt_runtime(clang_rt.ubsan_cxx-${arch} ${arch} STATIC
       SOURCES ${UBSAN_CXX_SOURCES}
       CFLAGS ${UBSAN_CFLAGS})
     add_dependencies(ubsan





More information about the llvm-commits mailing list