2017-11-30 03:31:52 +08:00
|
|
|
# CMakeLists.txt file for unit testing OpenMP host runtime library.
|
2017-02-25 06:15:24 +08:00
|
|
|
include(CheckFunctionExists)
|
2016-05-24 01:50:32 +08:00
|
|
|
include(CheckLibraryExists)
|
2015-12-01 04:02:59 +08:00
|
|
|
|
2016-05-24 01:50:32 +08:00
|
|
|
# Some tests use math functions
|
|
|
|
check_library_exists(m sqrt "" LIBOMP_HAVE_LIBM)
|
2017-02-25 06:15:24 +08:00
|
|
|
# When using libgcc, -latomic may be needed for atomics
|
|
|
|
# (but when using compiler-rt, the atomics will be built-in)
|
|
|
|
# Note: we can not check for __atomic_load because clang treats it
|
|
|
|
# as special built-in and that breaks CMake checks
|
|
|
|
check_function_exists(__atomic_load_1 LIBOMP_HAVE_BUILTIN_ATOMIC)
|
|
|
|
if(NOT LIBOMP_HAVE_BUILTIN_ATOMIC)
|
|
|
|
check_library_exists(atomic __atomic_load_1 "" LIBOMP_HAVE_LIBATOMIC)
|
|
|
|
else()
|
|
|
|
# not needed
|
|
|
|
set(LIBOMP_HAVE_LIBATOMIC 0)
|
|
|
|
endif()
|
2016-05-24 01:50:32 +08:00
|
|
|
|
2015-12-01 04:02:59 +08:00
|
|
|
macro(pythonize_bool var)
|
|
|
|
if (${var})
|
|
|
|
set(${var} True)
|
|
|
|
else()
|
|
|
|
set(${var} False)
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
pythonize_bool(LIBOMP_USE_HWLOC)
|
2016-03-22 15:22:49 +08:00
|
|
|
pythonize_bool(LIBOMP_OMPT_SUPPORT)
|
2017-11-01 18:08:30 +08:00
|
|
|
pythonize_bool(LIBOMP_OMPT_OPTIONAL)
|
2016-05-24 01:50:32 +08:00
|
|
|
pythonize_bool(LIBOMP_HAVE_LIBM)
|
2017-02-25 06:15:24 +08:00
|
|
|
pythonize_bool(LIBOMP_HAVE_LIBATOMIC)
|
2015-12-01 04:02:59 +08:00
|
|
|
|
2017-11-30 03:31:52 +08:00
|
|
|
add_openmp_testsuite(check-libomp "Running libomp tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS omp)
|
2019-02-21 20:00:57 +08:00
|
|
|
# Add target check-ompt, but make sure to not add the tests twice to check-openmp.
|
2020-02-07 07:26:10 +08:00
|
|
|
add_openmp_testsuite(check-ompt "Running OMPT tests" ${CMAKE_CURRENT_BINARY_DIR}/ompt EXCLUDE_FROM_CHECK_ALL DEPENDS omp)
|
2015-09-22 04:41:31 +08:00
|
|
|
|
|
|
|
# Configure the lit.site.cfg.in file
|
|
|
|
set(AUTO_GEN_COMMENT "## Autogenerated by libomp configuration.\n# Do not edit!")
|
|
|
|
configure_file(lit.site.cfg.in lit.site.cfg @ONLY)
|