summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-08-29 10:49:04 +0000
committerAlexey Samsonov <samsonov@google.com>2013-08-29 10:49:04 +0000
commit38a61aa7d3fc1deeb612e02863f0fbb417cda612 (patch)
treeee7c38dba7932f75a02e6c5990c99f69bb2b7a1c /cmake
parent5fa3d5d7ec35a704c6362d8d04f03023bb6e95e8 (diff)
downloadcompiler-rt-38a61aa7d3fc1deeb612e02863f0fbb417cda612.tar.gz
[sanitizer] Refine CMake rules for generating exported symbols and lint checking
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@189577 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/SanitizerUtils.cmake22
1 files changed, 20 insertions, 2 deletions
diff --git a/cmake/Modules/SanitizerUtils.cmake b/cmake/Modules/SanitizerUtils.cmake
index a443b191e..aa7be300c 100644
--- a/cmake/Modules/SanitizerUtils.cmake
+++ b/cmake/Modules/SanitizerUtils.cmake
@@ -3,6 +3,9 @@ include(LLVMParseArguments)
set(SANITIZER_GEN_DYNAMIC_LIST
${COMPILER_RT_SOURCE_DIR}/lib/sanitizer_common/scripts/gen_dynamic_list.py)
+set(SANITIZER_LINT_SCRIPT
+ ${COMPILER_RT_SOURCE_DIR}/lib/sanitizer_common/scripts/check_lint.sh)
+
# Create a target "<name>-symbols" that would generate the list of symbols
# that need to be exported from sanitizer runtime "<name>". Function
# interceptors are exported automatically, user can also provide files with
@@ -11,13 +14,28 @@ set(SANITIZER_GEN_DYNAMIC_LIST
macro(add_sanitizer_rt_symbols name)
get_target_property(libfile ${name} LOCATION)
set(symsfile "${libfile}.syms")
- add_custom_target(${name}-symbols ALL
+ add_custom_command(OUTPUT ${symsfile}
COMMAND ${PYTHON_EXECUTABLE}
${SANITIZER_GEN_DYNAMIC_LIST} ${libfile} ${ARGN}
> ${symsfile}
DEPENDS ${name} ${SANITIZER_GEN_DYNAMIC_LIST} ${ARGN}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- VERBATIM
+ COMMENT "Generating exported symbols for ${name}"
+ VERBATIM)
+ add_custom_target(${name}-symbols ALL
+ DEPENDS ${symsfile}
SOURCES ${SANITIZER_GEN_DYNAMIC_LIST} ${ARGN})
install(FILES ${symsfile} DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
endmacro()
+
+# Add target to check code style for sanitizer runtimes.
+if(UNIX)
+ add_custom_target(SanitizerLintCheck
+ COMMAND LLVM_CHECKOUT=${LLVM_MAIN_SRC_DIR} SILENT=1 TMPDIR=
+ PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
+ ${SANITIZER_LINT_SCRIPT}
+ DEPENDS ${SANITIZER_LINT_SCRIPT}
+ COMMENT "Running lint check for sanitizer sources..."
+ VERBATIM)
+endif()
+