[Openmp-commits] [PATCH] D39052: [CMake] Re-enable libomptarget and restrict tests to Clang 6.0.0

Jonas Hahnfeld via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Nov 22 09:15:46 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL318847: [CMake] Re-enable libomptarget and restrict tests to Clang 6.0.0 (authored by Hahnfeld).

Changed prior to commit:
  https://reviews.llvm.org/D39052?vs=119475&id=123954#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39052

Files:
  openmp/trunk/CMakeLists.txt
  openmp/trunk/libomptarget/test/CMakeLists.txt


Index: openmp/trunk/CMakeLists.txt
===================================================================
--- openmp/trunk/CMakeLists.txt
+++ openmp/trunk/CMakeLists.txt
@@ -5,10 +5,7 @@
 add_subdirectory(runtime)
 
 
-# The tests currently don't pass if the generic ELF plugin is built.
-# TODO: Fix the tests and enable libomptarget by default on supported
-#       architectures and platforms.
-set(ENABLE_LIBOMPTARGET OFF)
+set(ENABLE_LIBOMPTARGET ON)
 # Currently libomptarget cannot be compiled on Windows or MacOS X.
 # Since the device plugins are only supported on Linux anyway,
 # there is no point in trying to compile libomptarget on other OSes.
Index: openmp/trunk/libomptarget/test/CMakeLists.txt
===================================================================
--- openmp/trunk/libomptarget/test/CMakeLists.txt
+++ openmp/trunk/libomptarget/test/CMakeLists.txt
@@ -27,6 +27,29 @@
     "C compiler to use for testing OpenMP offloading library")
   set(LIBOMPTARGET_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING
     "C++ compiler to use for testing OpenMP offloading library")
+
+  if (NOT(${LIBOMPTARGET_TEST_C_COMPILER} MATCHES "clang" AND ${LIBOMPTARGET_TEST_CXX_COMPILER} MATCHES "clang"))
+    libomptarget_say("Can only test with Clang compiler!")
+    libomptarget_warning_say("The check-libomptarget target will not be available!")
+    return()
+  endif()
+
+  execute_process(
+    COMMAND ${LIBOMPTARGET_TEST_C_COMPILER} --version
+    OUTPUT_VARIABLE TEST_COMPILER_VERSION)
+  string(REGEX MATCH "version ([0-9.]+)" TEST_COMPILER_VERSION ${TEST_COMPILER_VERSION})
+  if (NOT(TEST_COMPILER_VERSION))
+    libomptarget_say("Unable to determine Clang compiler version!")
+    libomptarget_warning_say("The check-libomptarget target will not be available!")
+    return()
+  endif()
+  set(TEST_COMPILER_VERSION ${CMAKE_MATCH_1})
+  if (TEST_COMPILER_VERSION VERSION_LESS 6.0.0)
+    libomptarget_say("Clang compiler version does not implement all codegen, please update to 6.0.0!")
+    libomptarget_warning_say("The check-libomptarget target will not be available!")
+    return()
+  endif()
+
   set(LIBOMPTARGET_TEST_OPENMP_FLAG -fopenmp CACHE STRING
     "OpenMP compiler flag to use for testing OpenMP offloading library")
   find_program(LIBOMPTARGET_LLVM_LIT_EXECUTABLE


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39052.123954.patch
Type: text/x-patch
Size: 2307 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20171122/cfa28830/attachment.bin>


More information about the Openmp-commits mailing list