[compiler-rt] r177382 - Support CMake build of profile runtime library on Linux

Alexey Samsonov samsonov at google.com
Tue Mar 19 02:17:35 PDT 2013


Author: samsonov
Date: Tue Mar 19 04:17:35 2013
New Revision: 177382

URL: http://llvm.org/viewvc/llvm-project?rev=177382&view=rev
Log:
Support CMake build of profile runtime library on Linux

Added:
    compiler-rt/trunk/lib/profile/CMakeLists.txt
Modified:
    compiler-rt/trunk/CMakeLists.txt
    compiler-rt/trunk/lib/CMakeLists.txt

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=177382&r1=177381&r2=177382&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Tue Mar 19 04:17:35 2013
@@ -23,10 +23,10 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[
 # Setup the paths where compiler-rt runtimes and headers should be stored.
 set(LIBCLANG_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION})
 string(TOLOWER ${CMAKE_SYSTEM_NAME} LIBCLANG_OS_DIR)
-set(COMPILER_RT_LIBRARY_OUTPUT_DIR 
-  ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/lib/${LIBCLANG_OS_DIR})
+set(CLANG_RESOURCE_DIR ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION})
+set(COMPILER_RT_LIBRARY_OUTPUT_DIR ${CLANG_RESOURCE_DIR}/lib/${LIBCLANG_OS_DIR})
 set(COMPILER_RT_LIBRARY_INSTALL_DIR
- ${LIBCLANG_INSTALL_PATH}/lib/${LIBCLANG_OS_DIR}) 
+  ${LIBCLANG_INSTALL_PATH}/lib/${LIBCLANG_OS_DIR})
 
 # Add path for custom modules
 set(CMAKE_MODULE_PATH
@@ -36,6 +36,9 @@ set(CMAKE_MODULE_PATH
 include(AddCompilerRT)
 
 set(COMPILER_RT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+# Setup custom SDK sysroots.
+set(COMPILER_RT_DARWIN_SDK_SYSROOT ${COMPILER_RT_SOURCE_DIR}/SDKs/darwin)
+set(COMPILER_RT_LINUX_SDK_SYSROOT ${COMPILER_RT_SOURCE_DIR}/SDKs/linux)
 
 # Detect whether the current target platform is 32-bit or 64-bit, and setup
 # the correct commandline flags needed to attempt to target 32-bit and 64-bit.

Modified: compiler-rt/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/CMakeLists.txt?rev=177382&r1=177381&r2=177382&view=diff
==============================================================================
--- compiler-rt/trunk/lib/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/CMakeLists.txt Tue Mar 19 04:17:35 2013
@@ -15,10 +15,10 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linu
   add_subdirectory(tsan)
   add_subdirectory(msan)
   add_subdirectory(msandr)
+  # FIXME: Add support for the profile library on OS X.
+  add_subdirectory(profile)
 endif()
 
-# FIXME: Add support for the profile library.
-
 # The top-level lib directory contains a large amount of C code which provides
 # generic implementations of the core runtime library along with optimized
 # architecture-specific code in various subdirectories.

Added: compiler-rt/trunk/lib/profile/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/CMakeLists.txt?rev=177382&view=auto
==============================================================================
--- compiler-rt/trunk/lib/profile/CMakeLists.txt (added)
+++ compiler-rt/trunk/lib/profile/CMakeLists.txt Tue Mar 19 04:17:35 2013
@@ -0,0 +1,13 @@
+set(PROFILE_SOURCES
+  GCDAProfiling.c)
+
+filter_available_targets(PROFILE_SUPPORTED_ARCH x86_64 i386)
+
+if(NOT APPLE)
+  # FIXME: Add support for profile.rt on Mac.
+  foreach(arch ${PROFILE_SUPPORTED_ARCH})
+    add_compiler_rt_static_runtime(clang_rt.profile-${arch} ${arch}
+      SOURCES ${PROFILE_SOURCES}
+      CFLAGS --sysroot=${COMPILER_RT_LINUX_SDK_SYSROOT})
+  endforeach()
+endif()





More information about the llvm-commits mailing list