[llvm-commits] [compiler-rt] r163607 - in /compiler-rt/trunk: CMakeLists.txt lib/CMakeLists.txt lib/asan/CMakeLists.txt
Alexey Samsonov
samsonov at google.com
Tue Sep 11 03:26:54 PDT 2012
Author: samsonov
Date: Tue Sep 11 05:26:54 2012
New Revision: 163607
URL: http://llvm.org/viewvc/llvm-project?rev=163607&view=rev
Log:
[compiler-rt] Install support for CMake build of compiler-rt
Modified:
compiler-rt/trunk/CMakeLists.txt
compiler-rt/trunk/lib/CMakeLists.txt
compiler-rt/trunk/lib/asan/CMakeLists.txt
Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=163607&r1=163606&r2=163607&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Tue Sep 11 05:26:54 2012
@@ -106,6 +106,40 @@
set_property(TARGET ${target} PROPERTY COMPILE_FLAGS "${argstring}")
endfunction()
+# Compute the Clang version from the LLVM version.
+# FIXME: We should be able to reuse CLANG_VERSION variable calculated
+# in Clang cmake files, instead of copying the rules here.
+string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+ ${PACKAGE_VERSION})
+# Setup the paths where compiler-rt runtimes and headers should be stored.
+set(LIBCLANG_INSTALL_PATH lib${LLVM_LIBIR_SUFFIX}/clang/${CLANG_VERSION})
+string(TOLOWER ${CMAKE_SYSTEM_NAME} LIBCLANG_OS_DIR)
+
+# Install compiler-rt headers.
+install(DIRECTORY include/
+ DESTINATION ${LIBCLANG_INSTALL_PATH}/include
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+ )
+
+# Call add_clang_compiler_rt_libraries to make sure that targets are built
+# and installed in the directories where Clang driver expects to find them.
+macro(add_clang_compiler_rt_libraries)
+ # Setup output directories so that clang in build tree works.
+ set_target_properties(${ARGN} PROPERTIES
+ ARCHIVE_OUTPUT_DIRECTORY
+ ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/lib/${LIBCLANG_OS_DIR}
+ LIBRARY_OUTPUT_DIRECTORY
+ ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/lib/${LIBCLANG_OS_DIR}
+ )
+ # Add installation command.
+ install(TARGETS ${ARGN}
+ ARCHIVE DESTINATION ${LIBCLANG_INSTALL_PATH}/lib/${LIBCLANG_OS_DIR}
+ LIBRARY DESTINATION ${LIBCLANG_INSTALL_PATH}/lib/${LIBCLANG_OS_DIR}
+ )
+endmacro(add_clang_compiler_rt_libraries)
+
# Add the public header's directory to the includes for all of compiler-rt.
include_directories(include)
Modified: compiler-rt/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/CMakeLists.txt?rev=163607&r1=163606&r2=163607&view=diff
==============================================================================
--- compiler-rt/trunk/lib/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/CMakeLists.txt Tue Sep 11 05:26:54 2012
@@ -1,29 +1,3 @@
-# Compute the Clang version from the LLVM version.
-# FIXME: We should be able to reuse CLANG_VERSION variable calculated
-# in Clang cmake files, instead of copying the rules here.
-string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
- ${PACKAGE_VERSION})
-
-# Call add_clang_runtime_static_library(<target_library>) to make
-# sure that static <target_library> is built in the directory
-# where Clang driver expects to find it.
-if (APPLE)
- set(CLANG_RUNTIME_LIB_DIR
- ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/lib/darwin)
-elseif (UNIX)
- # Assume Linux.
- set(CLANG_RUNTIME_LIB_DIR
- ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/lib/linux)
-endif()
-function(add_clang_runtime_static_library)
- set_target_properties(${ARGN} PROPERTIES
- ARCHIVE_OUTPUT_DIRECTORY ${CLANG_RUNTIME_LIB_DIR})
-endfunction()
-function(add_clang_runtime_shared_library)
- set_target_properties(${ARGN} PROPERTIES
- LIBRARY_OUTPUT_DIRECTORY ${CLANG_RUNTIME_LIB_DIR})
-endfunction()
-
# First, add the subdirectories which contain feature-based runtime libraries
# and several convenience helper libraries.
add_subdirectory(asan)
@@ -178,6 +152,7 @@
${GENERIC_SOURCES}
)
set_target_properties(clang_rt.x86_64 PROPERTIES COMPILE_FLAGS "-std=c99 ${TARGET_X86_64_CFLAGS}")
+ add_clang_compiler_rt_libraries(clang_rt.x86_64)
endif()
if(CAN_TARGET_I386)
add_library(clang_rt.i386 STATIC
@@ -198,4 +173,5 @@
${GENERIC_SOURCES}
)
set_target_properties(clang_rt.i386 PROPERTIES COMPILE_FLAGS "-std=c99 ${TARGET_I386_CFLAGS}")
+ add_clang_compiler_rt_libraries(clang_rt.i386)
endif()
Modified: compiler-rt/trunk/lib/asan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/CMakeLists.txt?rev=163607&r1=163606&r2=163607&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/CMakeLists.txt Tue Sep 11 05:26:54 2012
@@ -93,7 +93,7 @@
set_property(TARGET ${ASAN_RUNTIME_LIBRARIES} APPEND PROPERTY
COMPILE_DEFINITIONS ${ASAN_COMMON_DEFINITIONS})
-add_clang_runtime_static_library(${ASAN_RUNTIME_LIBRARIES})
+add_clang_compiler_rt_libraries(${ASAN_RUNTIME_LIBRARIES})
set(ASAN_DYNAMIC_RUNTIME_LIBRARIES)
if(APPLE)
@@ -111,7 +111,7 @@
LINK_FLAGS "-framework Foundation")
list(APPEND ASAN_DYNAMIC_RUNTIME_LIBRARIES clang_rt.asan_osx_dynamic)
endif()
-add_clang_runtime_shared_library(${ASAN_DYNAMIC_RUNTIME_LIBRARIES})
+add_clang_compiler_rt_libraries(${ASAN_DYNAMIC_RUNTIME_LIBRARIES})
if(LLVM_INCLUDE_TESTS)
More information about the llvm-commits
mailing list