brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 9ee3be6 Raw
57 lines · plain
1# CMakeLists.txt file for unit testing OpenMP host runtime library.2include(CheckFunctionExists)3include(CheckLibraryExists)4 5# Some tests use math functions6check_library_exists(m sqrt "" LIBOMP_HAVE_LIBM)7# When using libgcc, -latomic may be needed for atomics8# (but when using compiler-rt, the atomics will be built-in)9# Note: we can not check for __atomic_load because clang treats it10# as special built-in and that breaks CMake checks11check_function_exists(__atomic_load_1 LIBOMP_HAVE_BUILTIN_ATOMIC)12if(NOT LIBOMP_HAVE_BUILTIN_ATOMIC)13  check_library_exists(atomic __atomic_load_1 "" LIBOMP_HAVE_LIBATOMIC)14else()15  # not needed16  set(LIBOMP_HAVE_LIBATOMIC 0)17endif()18 19macro(pythonize_bool var)20  if (${var})21    set(${var} True)22  else()23    set(${var} False)24  endif()25endmacro()26 27list(APPEND OPENMP_TEST_COMPILER_FEATURE_LIST "${LIBOMP_ARCH}")28update_test_compiler_features()29 30pythonize_bool(LIBOMP_USE_HWLOC)31pythonize_bool(LIBOMP_OMPT_SUPPORT)32pythonize_bool(LIBOMP_OMPT_OPTIONAL)33pythonize_bool(LIBOMP_OMPX_TASKGRAPH)34pythonize_bool(LIBOMP_HAVE_LIBM)35pythonize_bool(LIBOMP_HAVE_LIBATOMIC)36pythonize_bool(OPENMP_STANDALONE_BUILD)37pythonize_bool(OPENMP_TEST_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS)38pythonize_bool(OPENMP_TEST_COMPILER_HAS_OMP_H)39 40add_library(ompt-print-callback INTERFACE)41target_include_directories(ompt-print-callback INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/ompt)42 43 44add_custom_target(libomp-test-depends)45add_dependencies(libomp-test-depends omp)46if (LLVM_RUNTIMES_BUILD AND OPENMP_TEST_Fortran_COMPILER AND "flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)47  add_dependencies(libomp-test-depends flang-rt)48endif ()49 50add_openmp_testsuite(check-libomp "Running libomp tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS libomp-test-depends)51# Add target check-ompt, but make sure to not add the tests twice to check-openmp.52add_openmp_testsuite(check-ompt "Running OMPT tests" ${CMAKE_CURRENT_BINARY_DIR}/ompt EXCLUDE_FROM_CHECK_ALL DEPENDS omp)53 54# Configure the lit.site.cfg.in file55set(AUTO_GEN_COMMENT "## Autogenerated by libomp configuration.\n# Do not edit!")56configure_file(lit.site.cfg.in lit.site.cfg @ONLY)57