Debian Codegraph @

openmp/tools/archer/tests/CMakeLists.txt

raw
1 # CMakeLists.txt file for unit testing Archer runtime library.
2 include(CheckFunctionExists)
3 include(CheckLibraryExists)
4
5 # When using libgcc, -latomic may be needed for atomics
6 # (but when using compiler-rt, the atomics will be built-in)
7 # Note: we can not check for __atomic_load because clang treats it
8 # as special built-in and that breaks CMake checks
9 check_function_exists(__atomic_load_1 LIBARCHER_HAVE_BUILTIN_ATOMIC)
10 if(NOT LIBARCHER_HAVE_BUILTIN_ATOMIC)
11 check_library_exists(atomic __atomic_load_1 "" LIBARCHER_HAVE_LIBATOMIC)
12 else()
13 # not needed
14 set(LIBARCHER_HAVE_LIBATOMIC 0)
15 endif()
16
17 set(LIBARCHER_TEST_PATH ${CMAKE_CURRENT_SOURCE_DIR})
18
19 set(LIBARCHER_TEST_FLAGS "" CACHE STRING
20 "Extra compiler flags to send to the test compiler.")
21
22 macro(pythonize_bool var)
23 if (${var})
24 set(${var} True)
25 else()
26 set(${var} False)
27 endif()
28 endmacro()
29
30 pythonize_bool(LIBARCHER_HAVE_LIBATOMIC)
31 pythonize_bool(OPENMP_TEST_ENABLE_TSAN)
32
33 set(ARCHER_TSAN_TEST_DEPENDENCE "")
34 if(TARGET tsan)
35 set(ARCHER_TSAN_TEST_DEPENDENCE tsan)
36 endif()
37
38 add_openmp_testsuite(check-libarcher "Running libarcher tests" ${CMAKE_CURRENT_BINARY_DIR}
39 DEPENDS archer omp ${ARCHER_TSAN_TEST_DEPENDENCE})
40
41 # Configure the lit.site.cfg.in file
42 set(AUTO_GEN_COMMENT "## Autogenerated by libarcher configuration.\n# Do not edit!")
43 configure_file(lit.site.cfg.in lit.site.cfg @ONLY)