[CMake] Introduce COMPILER_RT_INCLUDE_TESTS option

llvm-svn: 201666
This commit is contained in:
Alexey Samsonov 2014-02-19 11:18:47 +00:00
parent 6d3df420d2
commit cd8535a96d
8 changed files with 12 additions and 9 deletions

View File

@ -38,12 +38,15 @@ if (NOT COMPILER_RT_STANDALONE_BUILD)
# Setup the paths where compiler-rt runtimes and headers should be stored. # Setup the paths where compiler-rt runtimes and headers should be stored.
set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}) set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}) set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION})
option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests."
${LLVM_INCLUDE_TESTS})
else() else()
# Take output dir and install path from the user. # Take output dir and install path from the user.
set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
"Path where built compiler-rt libraries should be stored.") "Path where built compiler-rt libraries should be stored.")
set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
"Path where built compiler-rt libraries should be installed.") "Path where built compiler-rt libraries should be installed.")
option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
set(LLVM_CONFIG_PATH "" CACHE PATH "Path to llvm-config binary") set(LLVM_CONFIG_PATH "" CACHE PATH "Path to llvm-config binary")
if (NOT LLVM_CONFIG_PATH) if (NOT LLVM_CONFIG_PATH)
@ -296,7 +299,7 @@ endif()
add_subdirectory(lib) add_subdirectory(lib)
if(LLVM_INCLUDE_TESTS) if(COMPILER_RT_INCLUDE_TESTS)
add_subdirectory(unittests) add_subdirectory(unittests)
endif() endif()
add_subdirectory(test) add_subdirectory(test)

View File

@ -135,6 +135,6 @@ add_compiler_rt_resource_file(asan_blacklist asan_blacklist.txt)
add_dependencies(asan asan_blacklist) add_dependencies(asan asan_blacklist)
add_dependencies(compiler-rt asan) add_dependencies(compiler-rt asan)
if(LLVM_INCLUDE_TESTS) if(COMPILER_RT_INCLUDE_TESTS)
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()

View File

@ -37,6 +37,6 @@ add_compiler_rt_resource_file(msan_blacklist msan_blacklist.txt)
add_dependencies(msan msan_blacklist) add_dependencies(msan msan_blacklist)
add_dependencies(compiler-rt msan) add_dependencies(compiler-rt msan)
if(LLVM_INCLUDE_TESTS) if(COMPILER_RT_INCLUDE_TESTS)
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()

View File

@ -137,6 +137,6 @@ endif()
add_dependencies(compiler-rt sanitizer_common) add_dependencies(compiler-rt sanitizer_common)
# Unit tests for common sanitizer runtime. # Unit tests for common sanitizer runtime.
if(LLVM_INCLUDE_TESTS) if(COMPILER_RT_INCLUDE_TESTS)
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()

View File

@ -73,6 +73,6 @@ endif()
add_dependencies(compiler-rt tsan) add_dependencies(compiler-rt tsan)
if(LLVM_INCLUDE_TESTS) if(COMPILER_RT_INCLUDE_TESTS)
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()

View File

@ -39,7 +39,7 @@ if(CAN_TARGET_i386)
list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/32bitConfig) list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/32bitConfig)
endif() endif()
if(LLVM_INCLUDE_TESTS) if(COMPILER_RT_INCLUDE_TESTS)
configure_lit_site_cfg( configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
@ -53,7 +53,7 @@ set(ASAN_TEST_DEPS
set(ASAN_TEST_PARAMS set(ASAN_TEST_PARAMS
asan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg) asan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
# FIXME: support unit test in the android test runner # FIXME: support unit test in the android test runner
if(LLVM_INCLUDE_TESTS AND NOT CAN_TARGET_arm_android) if(COMPILER_RT_INCLUDE_TESTS AND NOT CAN_TARGET_arm_android)
list(APPEND ASAN_TEST_DEPS AsanUnitTests) list(APPEND ASAN_TEST_DEPS AsanUnitTests)
list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit) list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit)
endif() endif()

View File

@ -8,7 +8,7 @@ set(MSAN_TEST_DEPS
${SANITIZER_COMMON_LIT_TEST_DEPS} ${SANITIZER_COMMON_LIT_TEST_DEPS}
msan) msan)
if(LLVM_INCLUDE_TESTS AND COMPILER_RT_HAS_LIBCXX_SOURCES) if(COMPILER_RT_INCLUDE_TESTS AND COMPILER_RT_HAS_LIBCXX_SOURCES)
configure_lit_site_cfg( configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg) ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg)

View File

@ -6,7 +6,7 @@ set(TSAN_TEST_DEPS
${SANITIZER_COMMON_LIT_TEST_DEPS} ${SANITIZER_COMMON_LIT_TEST_DEPS}
tsan) tsan)
if(LLVM_INCLUDE_TESTS) if(COMPILER_RT_INCLUDE_TESTS)
configure_lit_site_cfg( configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg) ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg)