diff options
author | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2017-11-29 19:31:52 +0000 |
---|---|---|
committer | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2017-11-29 19:31:52 +0000 |
commit | 45e63d9fdc24e98217cb7d67e34d5e6eae9faf31 (patch) | |
tree | dd4c7337771559030e877c3f4f2b5df16a99a556 /openmp/CMakeLists.txt | |
parent | 11755048810d7260a560e4d21778df2ff6cdd190 (diff) |
[CMake] Refactor testing infrastructure
The code for the two OpenMP runtime libraries was very similar.
Move to common CMake file that is included and provides a simple
interface for adding testsuites. Also add a common check-openmp
target that runs all testsuites that have been registered.
Note that this renames all test options to the common OPENMP
namespace, for example OPENMP_TEST_C_COMPILER instead of
LIBOMP_TEST_COMPILER and so on.
Differential Revision: https://reviews.llvm.org/D40082
Diffstat (limited to 'openmp/CMakeLists.txt')
-rw-r--r-- | openmp/CMakeLists.txt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt index ebf9abb98aa..8592c202cd2 100644 --- a/openmp/CMakeLists.txt +++ b/openmp/CMakeLists.txt @@ -19,17 +19,38 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S set(OPENMP_LIBDIR_SUFFIX "" CACHE STRING "suffix of lib installation directory, e.g. 64 => lib64") + # Group test settings. + set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING + "C compiler to use for testing OpenMP runtime libraries.") + set(OPENMP_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING + "C++ compiler to use for testing OpenMP runtime libraries.") set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing.") else() set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR}) # If building in tree, we honor the same install suffix LLVM uses. set(OPENMP_LIBDIR_SUFFIX ${LLVM_LIBDIR_SUFFIX}) + + if (NOT MSVC) + set(OPENMP_TEST_C_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang) + set(OPENMP_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++) + else() + set(OPENMP_TEST_C_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang.exe) + set(OPENMP_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++.exe) + endif() endif() # Check and set up common compiler flags. include(config-ix) include(HandleOpenMPOptions) +# Set up testing infrastructure. +include(OpenMPTesting) + +set(OPENMP_TEST_FLAGS "" CACHE STRING + "Extra compiler flags to send to the test compiler.") +set(OPENMP_TEST_OPENMP_FLAGS "-fopenmp" CACHE STRING + "OpenMP compiler flag to use for testing OpenMP runtime libraries.") + # Build host runtime library. add_subdirectory(runtime) @@ -55,3 +76,6 @@ if (OPENMP_ENABLE_LIBOMPTARGET) add_subdirectory(libomptarget) endif() + +# Now that we have seen all testuites, create the check-openmp target. +construct_check_openmp_target() |