44 lines · plain
1# CMakeLists.txt file for unit testing Archer runtime library.2include(CheckFunctionExists)3include(CheckLibraryExists)4 5# When using libgcc, -latomic may be needed for atomics6# (but when using compiler-rt, the atomics will be built-in)7# Note: we can not check for __atomic_load because clang treats it8# as special built-in and that breaks CMake checks9check_function_exists(__atomic_load_1 LIBARCHER_HAVE_BUILTIN_ATOMIC)10if(NOT LIBARCHER_HAVE_BUILTIN_ATOMIC)11 check_library_exists(atomic __atomic_load_1 "" LIBARCHER_HAVE_LIBATOMIC)12else()13 # not needed14 set(LIBARCHER_HAVE_LIBATOMIC 0)15endif()16 17set(LIBARCHER_TEST_PATH ${CMAKE_CURRENT_SOURCE_DIR})18 19set(LIBARCHER_TEST_FLAGS "" CACHE STRING20 "Extra compiler flags to send to the test compiler.")21 22macro(pythonize_bool var)23 if (${var})24 set(${var} True)25 else()26 set(${var} False)27 endif()28endmacro()29 30pythonize_bool(LIBARCHER_HAVE_LIBATOMIC)31pythonize_bool(OPENMP_TEST_ENABLE_TSAN)32 33set(ARCHER_TSAN_TEST_DEPENDENCE "")34if(TARGET tsan)35 set(ARCHER_TSAN_TEST_DEPENDENCE tsan)36endif()37 38add_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 file42set(AUTO_GEN_COMMENT "## Autogenerated by libarcher configuration.\n# Do not edit!")43configure_file(lit.site.cfg.in lit.site.cfg @ONLY)44