[compiler-rt] r179293 - Explicitly list all sanitizer headers in CMake build rules. Make sure sanitizer lit_tests depend on fresh headers.

Alexey Samsonov samsonov at google.com
Thu Apr 11 08:49:52 PDT 2013


Author: samsonov
Date: Thu Apr 11 10:49:52 2013
New Revision: 179293

URL: http://llvm.org/viewvc/llvm-project?rev=179293&view=rev
Log:
Explicitly list all sanitizer headers in CMake build rules. Make sure sanitizer lit_tests depend on fresh headers.

Added:
    compiler-rt/trunk/include/CMakeLists.txt
Modified:
    compiler-rt/trunk/CMakeLists.txt
    compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt
    compiler-rt/trunk/lib/msan/lit_tests/CMakeLists.txt
    compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt
    compiler-rt/trunk/lib/ubsan/lit_tests/CMakeLists.txt

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=179293&r1=179292&r2=179293&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Thu Apr 11 10:49:52 2013
@@ -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)
 

Added: compiler-rt/trunk/include/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/CMakeLists.txt?rev=179293&view=auto
==============================================================================
--- compiler-rt/trunk/include/CMakeLists.txt (added)
+++ compiler-rt/trunk/include/CMakeLists.txt Thu Apr 11 10:49:52 2013
@@ -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)

Modified: compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt?rev=179293&r1=179292&r2=179293&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt Thu Apr 11 10:49:52 2013
@@ -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
     )

Modified: compiler-rt/trunk/lib/msan/lit_tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/lit_tests/CMakeLists.txt?rev=179293&r1=179292&r2=179293&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/lit_tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/msan/lit_tests/CMakeLists.txt Thu Apr 11 10:49:52 2013
@@ -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
     )

Modified: compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt?rev=179293&r1=179292&r2=179293&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt Thu Apr 11 10:49:52 2013
@@ -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
     )

Modified: compiler-rt/trunk/lib/ubsan/lit_tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/lit_tests/CMakeLists.txt?rev=179293&r1=179292&r2=179293&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/lit_tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/ubsan/lit_tests/CMakeLists.txt Thu Apr 11 10:49:52 2013
@@ -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
     )





More information about the llvm-commits mailing list