1 # CMakeLists.txt file for unit testing OpenMP host runtime library.
2 include(CheckFunctionExists)
3 include(CheckLibraryExists)
5 # Some tests use math functions
6 check_library_exists(m sqrt "" LIBOMP_HAVE_LIBM)
7 # When using libgcc, -latomic may be needed for atomics
8 # (but when using compiler-rt, the atomics will be built-in)
9 # Note: we can not check for __atomic_load because clang treats it
10 # as special built-in and that breaks CMake checks
11 check_function_exists(__atomic_load_1 LIBOMP_HAVE_BUILTIN_ATOMIC)
12 if(NOT LIBOMP_HAVE_BUILTIN_ATOMIC)
13 check_library_exists(atomic __atomic_load_1 "" LIBOMP_HAVE_LIBATOMIC)
16 set(LIBOMP_HAVE_LIBATOMIC 0)
19 macro(pythonize_bool var)
27 list(APPEND OPENMP_TEST_COMPILER_FEATURE_LIST "${LIBOMP_ARCH}")
28 update_test_compiler_features()
30 pythonize_bool(LIBOMP_USE_HWLOC)
31 pythonize_bool(LIBOMP_OMPT_SUPPORT)
32 pythonize_bool(LIBOMP_OMPT_OPTIONAL)
33 pythonize_bool(LIBOMP_OMPX_TASKGRAPH)
34 pythonize_bool(LIBOMP_HAVE_LIBM)
35 pythonize_bool(LIBOMP_HAVE_LIBATOMIC)
36 pythonize_bool(OPENMP_STANDALONE_BUILD)
37 pythonize_bool(OPENMP_TEST_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS)
38 pythonize_bool(OPENMP_TEST_COMPILER_HAS_OMP_H)
40 add_library(ompt-print-callback INTERFACE)
41 target_include_directories(ompt-print-callback INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/ompt)
44 add_openmp_testsuite(check-libomp "Running libomp tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS omp)
45 # Add target check-ompt, but make sure to not add the tests twice to check-openmp.
46 add_openmp_testsuite(check-ompt "Running OMPT tests" ${CMAKE_CURRENT_BINARY_DIR}/ompt EXCLUDE_FROM_CHECK_ALL DEPENDS omp)
48 # Configure the lit.site.cfg.in file
49 set(AUTO_GEN_COMMENT "## Autogenerated by libomp configuration.\n# Do not edit!")
50 configure_file(lit.site.cfg.in lit.site.cfg @ONLY)