| Chris Bieneman | 12b134b | 2016-08-18 21:31:51 +0000 | [diff] [blame] | 1 | include(AddLLVM) # for add_lit_testsuite |
| 2 | |
| Michael J. Spencer | f5799be | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 3 | macro(pythonize_bool var) |
| 4 | if (${var}) |
| 5 | set(${var} True) |
| 6 | else() |
| 7 | set(${var} False) |
| 8 | endif() |
| 9 | endmacro() |
| 10 | |
| Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 11 | set(LIBCXX_LIT_VARIANT "libcxx" CACHE STRING |
| 12 | "Configuration variant to use for LIT.") |
| Greg Fitzgerald | d9ecf1a | 2015-02-03 18:02:04 +0000 | [diff] [blame] | 13 | |
| Eric Fiselier | 054fc4c | 2016-10-09 21:34:03 +0000 | [diff] [blame] | 14 | # The tests shouldn't link to any ABI library when it has been linked into |
| 15 | # libc++ statically or via a linker script. |
| 16 | if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY OR LIBCXX_ENABLE_ABI_LINKER_SCRIPT) |
| 17 | set(LIBCXX_CXX_ABI_LIBNAME "none") |
| 18 | endif() |
| 19 | |
| 20 | # The tests shouldn't link to libunwind if we have a linker script which |
| 21 | # already does so. |
| 22 | if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT) |
| 23 | set(LIBCXXABI_USE_LLVM_UNWINDER OFF) |
| 24 | endif() |
| 25 | |
| Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 26 | pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS) |
| Eric Fiselier | 27cb2f1 | 2016-05-03 21:30:18 +0000 | [diff] [blame] | 27 | pythonize_bool(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) |
| Eric Fiselier | c797958 | 2016-06-17 19:46:40 +0000 | [diff] [blame] | 28 | pythonize_bool(LIBCXX_ENABLE_FILESYSTEM) |
| Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 29 | pythonize_bool(LIBCXX_ENABLE_RTTI) |
| 30 | pythonize_bool(LIBCXX_ENABLE_SHARED) |
| 31 | pythonize_bool(LIBCXX_BUILD_32_BITS) |
| Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 32 | pythonize_bool(LIBCXX_GENERATE_COVERAGE) |
| Ben Craig | 0142a9d | 2016-04-19 12:49:05 +0000 | [diff] [blame] | 33 | pythonize_bool(LIBCXXABI_ENABLE_SHARED) |
| Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 34 | pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER) |
| Vasileios Kalintiris | d247ac4 | 2016-02-11 12:43:04 +0000 | [diff] [blame] | 35 | pythonize_bool(LIBCXX_HAS_ATOMIC_LIB) |
| Eric Fiselier | a23470e | 2016-07-18 06:01:50 +0000 | [diff] [blame] | 36 | pythonize_bool(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB) |
| Eric Fiselier | 00f6bea | 2017-01-06 20:05:40 +0000 | [diff] [blame] | 37 | pythonize_bool(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY) |
| Eric Fiselier | 7e3ee09 | 2017-01-14 07:54:39 +0000 | [diff] [blame^] | 38 | pythonize_bool(LIBCXX_DEBUG_BUILD) |
| Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 39 | |
| Ben Craig | 0142a9d | 2016-04-19 12:49:05 +0000 | [diff] [blame] | 40 | # By default, for non-standalone builds, libcxx and libcxxabi share a library |
| 41 | # directory. |
| 42 | if (NOT LIBCXX_CXX_ABI_LIBRARY_PATH) |
| 43 | set(LIBCXX_CXX_ABI_LIBRARY_PATH "${LIBCXX_LIBRARY_DIR}" CACHE PATH |
| 44 | "The path to libc++abi library.") |
| 45 | endif() |
| 46 | |
| Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 47 | set(LIBCXX_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING |
| 48 | "TargetInfo to use when setting up test environment.") |
| 49 | set(LIBCXX_EXECUTOR "None" CACHE STRING |
| 50 | "Executor to use when running tests.") |
| Greg Fitzgerald | 2e18729 | 2015-02-03 18:47:37 +0000 | [diff] [blame] | 51 | |
| Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 52 | set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!") |
| Michael J. Spencer | f5799be | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 53 | |
| Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 54 | configure_file( |
| 55 | ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in |
| 56 | ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg |
| 57 | @ONLY) |
| Dan Albert | b3db766 | 2015-01-15 18:35:04 +0000 | [diff] [blame] | 58 | |
| Asiri Rathnayake | 205d7d3 | 2017-01-03 12:59:50 +0000 | [diff] [blame] | 59 | set(LIBCXX_TEST_DEPS "") |
| 60 | |
| Eric Fiselier | ad89e38 | 2016-05-03 21:58:07 +0000 | [diff] [blame] | 61 | if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) |
| Asiri Rathnayake | 205d7d3 | 2017-01-03 12:59:50 +0000 | [diff] [blame] | 62 | set(LIBCXX_TEST_DEPS cxx_experimental) |
| Eric Fiselier | ad89e38 | 2016-05-03 21:58:07 +0000 | [diff] [blame] | 63 | endif() |
| 64 | |
| Asiri Rathnayake | 8c2bf45 | 2016-09-11 21:46:40 +0000 | [diff] [blame] | 65 | if (LIBCXX_HAS_EXTERNAL_THREAD_API) |
| Asiri Rathnayake | 205d7d3 | 2017-01-03 12:59:50 +0000 | [diff] [blame] | 66 | list(APPEND LIBCXX_TEST_DEPS cxx_external_threads) |
| Asiri Rathnayake | 8c2bf45 | 2016-09-11 21:46:40 +0000 | [diff] [blame] | 67 | endif() |
| 68 | |
| Chris Bieneman | f17227a | 2016-08-24 22:17:06 +0000 | [diff] [blame] | 69 | add_lit_testsuite(check-cxx |
| Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 70 | "Running libcxx tests" |
| 71 | ${CMAKE_CURRENT_BINARY_DIR} |
| Asiri Rathnayake | 205d7d3 | 2017-01-03 12:59:50 +0000 | [diff] [blame] | 72 | DEPENDS cxx ${LIBCXX_TEST_DEPS}) |
| Eric Fiselier | 78fdf2d | 2015-03-31 04:15:45 +0000 | [diff] [blame] | 73 | |
| Chris Bieneman | f17227a | 2016-08-24 22:17:06 +0000 | [diff] [blame] | 74 | add_custom_target(check-libcxx DEPENDS check-cxx) |
| 75 | |
| Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 76 | if (LIBCXX_GENERATE_COVERAGE) |
| 77 | include(CodeCoverage) |
| 78 | set(output_dir "${CMAKE_CURRENT_BINARY_DIR}/coverage") |
| Eric Fiselier | 31dd2b1 | 2016-05-08 23:08:50 +0000 | [diff] [blame] | 79 | set(capture_dirs "${LIBCXX_LIB_CMAKEFILES_DIR}/cxx.dir/;${LIBCXX_LIB_CMAKEFILES_DIR}/cxx_experimental.dir/;${CMAKE_CURRENT_BINARY_DIR}") |
| Eric Fiselier | 10ed6c3 | 2015-07-30 22:30:34 +0000 | [diff] [blame] | 80 | set(extract_dirs "${LIBCXX_SOURCE_DIR}/include;${LIBCXX_SOURCE_DIR}/src") |
| 81 | setup_lcov_test_target_coverage("cxx" "${output_dir}" "${capture_dirs}" "${extract_dirs}") |
| Michael J. Spencer | f5799be | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 82 | endif() |