Explicitly list all sanitizer headers in CMake build rules. Make sure sanitizer lit_t...
authorAlexey Samsonov <samsonov@google.com>
Thu, 11 Apr 2013 15:49:52 +0000 (15:49 +0000)
committerAlexey Samsonov <samsonov@google.com>
Thu, 11 Apr 2013 15:49:52 +0000 (15:49 +0000)
llvm-svn: 179293

compiler-rt/CMakeLists.txt
compiler-rt/include/CMakeLists.txt [new file with mode: 0644]
compiler-rt/lib/asan/lit_tests/CMakeLists.txt
compiler-rt/lib/msan/lit_tests/CMakeLists.txt
compiler-rt/lib/tsan/lit_tests/CMakeLists.txt
compiler-rt/lib/ubsan/lit_tests/CMakeLists.txt

index fe895cf..9deb608 100644 (file)
@@ -170,49 +170,13 @@ endif()
 filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
   x86_64 i386 powerpc64 powerpc)
 
-file(GLOB_RECURSE COMPILER_RT_HEADERS
-  RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/include"
-  "include/*.h")
-
-set(output_dir ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include)
-
-if(MSVC_IDE OR XCODE)
-   set(other_output_dir ${LLVM_BINARY_DIR}/bin/lib/clang/${CLANG_VERSION}/include)
-endif()
-
-# Copy compiler-rt headers to the build tree.
-set(out_files)
-foreach( f ${COMPILER_RT_HEADERS} )
-  set( src ${CMAKE_CURRENT_SOURCE_DIR}/include/${f} )
-  set( dst ${output_dir}/${f} )
-  add_custom_command(OUTPUT ${dst}
-    DEPENDS ${src}
-    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
-    COMMENT "Copying compiler-rt's ${f}...")
-  list(APPEND out_files ${dst})
-
-  if(other_output_dir)
-   set(other_dst ${other_output_dir}/${f})
-    add_custom_command(OUTPUT ${other_dst}
-      DEPENDS ${src}
-      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${other_dst}
-      COMMENT "Copying compiler-rt's ${f}...")    
-    list(APPEND out_files ${other_dst})
-  endif()
-endforeach( f )
-
-add_custom_target(compiler-rt-headers ALL DEPENDS ${out_files})
-
-# Install compiler-rt headers.
-install(DIRECTORY include/
-  DESTINATION ${LIBCLANG_INSTALL_PATH}/include
-  FILES_MATCHING
-  PATTERN "*.h"
-  PATTERN ".svn" EXCLUDE
-  )
-
 # Add the public header's directory to the includes for all of compiler-rt.
 include_directories(include)
+add_subdirectory(include)
+
+set(SANITIZER_COMMON_LIT_TEST_DEPS
+  clang clang-headers FileCheck count not llvm-nm llvm-symbolizer
+  compiler-rt-headers)
 
 add_subdirectory(lib)
 
diff --git a/compiler-rt/include/CMakeLists.txt b/compiler-rt/include/CMakeLists.txt
new file mode 100644 (file)
index 0000000..700b532
--- /dev/null
@@ -0,0 +1,39 @@
+set(SANITIZER_HEADERS
+  sanitizer/asan_interface.h
+  sanitizer/common_interface_defs.h
+  sanitizer/linux_syscall_hooks.h
+  sanitizer/msan_interface.h)
+
+set(output_dir ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include)
+
+if(MSVC_IDE OR XCODE)
+   set(other_output_dir ${LLVM_BINARY_DIR}/bin/lib/clang/${CLANG_VERSION}/include)
+endif()
+
+# Copy compiler-rt headers to the build tree.
+set(out_files)
+foreach( f ${SANITIZER_HEADERS} )
+  set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} )
+  set( dst ${output_dir}/${f} )
+  add_custom_command(OUTPUT ${dst}
+    DEPENDS ${src}
+    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+    COMMENT "Copying compiler-rt's ${f}...")
+  list(APPEND out_files ${dst})
+
+  if(other_output_dir)
+   set(other_dst ${other_output_dir}/${f})
+    add_custom_command(OUTPUT ${other_dst}
+      DEPENDS ${src}
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${other_dst}
+      COMMENT "Copying compiler-rt's ${f}...")    
+    list(APPEND out_files ${other_dst})
+  endif()
+endforeach( f )
+
+add_custom_target(compiler-rt-headers ALL DEPENDS ${out_files})
+
+# Install sanitizer headers.
+install(FILES ${SANITIZER_HEADERS}
+  PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+  DESTINATION ${LIBCLANG_INSTALL_PATH}/include/sanitizer)
index 1609032..eb033bd 100644 (file)
@@ -14,9 +14,8 @@ configure_lit_site_cfg(
 if(COMPILER_RT_CAN_EXECUTE_TESTS)
   # Run ASan tests only if we're sure we may produce working binaries.
   set(ASAN_TEST_DEPS
-    clang clang-headers FileCheck count not llvm-nm llvm-symbolizer
-    ${ASAN_RUNTIME_LIBRARIES}
-    )
+    ${SANITIZER_COMMON_LIT_TEST_DEPS}
+    ${ASAN_RUNTIME_LIBRARIES})
   set(ASAN_TEST_PARAMS
     asan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
     )
index 62b2101..8d419de 100644 (file)
@@ -14,9 +14,8 @@ configure_lit_site_cfg(
 if(COMPILER_RT_CAN_EXECUTE_TESTS)
   # Run MSan tests only if we're sure we may produce working binaries.
   set(MSAN_TEST_DEPS
-    clang clang-headers FileCheck count not llvm-nm llvm-symbolizer
-    ${MSAN_RUNTIME_LIBRARIES}
-    )
+    ${SANITIZER_COMMON_LIT_TEST_DEPS}
+    ${MSAN_RUNTIME_LIBRARIES})
   set(MSAN_TEST_PARAMS
     msan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
     )
index ff2508d..53e5015 100644 (file)
@@ -11,9 +11,8 @@ configure_lit_site_cfg(
 if(COMPILER_RT_CAN_EXECUTE_TESTS)
   # Run TSan output tests only if we're sure we can produce working binaries.
   set(TSAN_TEST_DEPS
-    clang clang-headers FileCheck count not llvm-symbolizer
-    ${TSAN_RUNTIME_LIBRARIES}
-    )
+    ${SANITIZER_COMMON_LIT_TEST_DEPS}
+    ${TSAN_RUNTIME_LIBRARIES})
   set(TSAN_TEST_PARAMS
     tsan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
     )
index 565c523..7e1a13c 100644 (file)
@@ -7,9 +7,8 @@ if(COMPILER_RT_CAN_EXECUTE_TESTS)
   # Run UBSan output tests only if we're sure that clang would produce
   # working binaries.
   set(UBSAN_TEST_DEPS
-    clang clang-headers FileCheck count not
-    ${UBSAN_RUNTIME_LIBRARIES}
-    )
+    ${SANITIZER_COMMON_LIT_TEST_DEPS}
+    ${UBSAN_RUNTIME_LIBRARIES})
   set(UBSAN_TEST_PARAMS
     ubsan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
     )