aboutsummaryrefslogtreecommitdiff
path: root/final/runtime/test/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'final/runtime/test/CMakeLists.txt')
-rw-r--r--final/runtime/test/CMakeLists.txt37
1 files changed, 37 insertions, 0 deletions
diff --git a/final/runtime/test/CMakeLists.txt b/final/runtime/test/CMakeLists.txt
new file mode 100644
index 0000000..8f367c5
--- /dev/null
+++ b/final/runtime/test/CMakeLists.txt
@@ -0,0 +1,37 @@
+# CMakeLists.txt file for unit testing OpenMP host runtime library.
+include(CheckFunctionExists)
+include(CheckLibraryExists)
+
+# Some tests use math functions
+check_library_exists(m sqrt "" LIBOMP_HAVE_LIBM)
+# 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()
+
+macro(pythonize_bool var)
+ if (${var})
+ set(${var} True)
+ else()
+ set(${var} False)
+ endif()
+endmacro()
+
+pythonize_bool(LIBOMP_USE_HWLOC)
+pythonize_bool(LIBOMP_OMPT_SUPPORT)
+pythonize_bool(LIBOMP_OMPT_OPTIONAL)
+pythonize_bool(LIBOMP_HAVE_LIBM)
+pythonize_bool(LIBOMP_HAVE_LIBATOMIC)
+
+add_openmp_testsuite(check-libomp "Running libomp tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS omp)
+
+# 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)