From 1dccd86935fe7f783f818135f17f197d5144c576 Mon Sep 17 00:00:00 2001 From: Ross Brunton Date: Mon, 9 Jun 2025 16:09:56 +0100 Subject: [PATCH 1/2] [OpenMP] Add `OPENMP_INCLUDE_TESTS` This is a cmake variable which, if set to `OFF`, will disable building of tests. It defaults to the value of `LLVM_INCLUDE_TESTS`. --- openmp/CMakeLists.txt | 10 ++++++++-- openmp/libompd/CMakeLists.txt | 8 ++++---- openmp/runtime/CMakeLists.txt | 4 +++- openmp/tools/archer/CMakeLists.txt | 4 +++- openmp/tools/multiplex/CMakeLists.txt | 4 +++- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt index f3de4bc4ee87b..e87cb2ff7c69e 100644 --- a/openmp/CMakeLists.txt +++ b/openmp/CMakeLists.txt @@ -17,6 +17,8 @@ else() set(OPENMP_STANDALONE_BUILD FALSE) endif() +option(OPENMP_INCLUDE_TESTS "Generate and build openmp tests." ${LLVM_INCLUDE_TESTS}) + # Must go below project(..) include(GNUInstallDirs) @@ -104,7 +106,9 @@ include(config-ix) include(HandleOpenMPOptions) # Set up testing infrastructure. -include(OpenMPTesting) +if(OPENMP_INCLUDE_TESTS) + include(OpenMPTesting) +endif() set(OPENMP_TEST_FLAGS "" CACHE STRING "Extra compiler flags to send to the test compiler.") @@ -164,4 +168,6 @@ add_subdirectory(libompd) add_subdirectory(docs) # Now that we have seen all testsuites, create the check-openmp target. -construct_check_openmp_target() +if(OPENMP_INCLUDE_TESTS) + construct_check_openmp_target() +endif() diff --git a/openmp/libompd/CMakeLists.txt b/openmp/libompd/CMakeLists.txt index e5373318784ce..59b200ec294b5 100644 --- a/openmp/libompd/CMakeLists.txt +++ b/openmp/libompd/CMakeLists.txt @@ -18,9 +18,9 @@ if(LIBOMP_OMPD_SUPPORT) add_subdirectory(src) if(LIBOMP_OMPD_GDB_SUPPORT) add_subdirectory(gdb-plugin) - # GDB is required to run the tests - if (GDB_FOUND) - add_subdirectory(test) - endif() + # GDB is required to run the tests + if (GDB_FOUND AND OPENMP_INCLUDE_TESTS) + add_subdirectory(test) + endif() endif() endif() diff --git a/openmp/runtime/CMakeLists.txt b/openmp/runtime/CMakeLists.txt index 93eb14f10a50a..f8036c3b068fc 100644 --- a/openmp/runtime/CMakeLists.txt +++ b/openmp/runtime/CMakeLists.txt @@ -468,7 +468,9 @@ if(${OPENMP_STANDALONE_BUILD}) endif() add_subdirectory(src) -add_subdirectory(test) +if(OPENMP_INCLUDE_TESTS) + add_subdirectory(test) +endif() # make these variables available for tools: set(LIBOMP_LIBRARY_DIR ${LIBOMP_LIBRARY_DIR} PARENT_SCOPE) diff --git a/openmp/tools/archer/CMakeLists.txt b/openmp/tools/archer/CMakeLists.txt index a1c768c449d04..37a7f92967463 100644 --- a/openmp/tools/archer/CMakeLists.txt +++ b/openmp/tools/archer/CMakeLists.txt @@ -34,5 +34,7 @@ if(LIBOMP_OMPT_SUPPORT AND LIBOMP_ARCHER_SUPPORT) LIBRARY DESTINATION ${OPENMP_INSTALL_LIBDIR} ARCHIVE DESTINATION ${OPENMP_INSTALL_LIBDIR}) - add_subdirectory(tests) + if(OPENMP_INCLUDE_TESTS) + add_subdirectory(tests) + endif() endif() diff --git a/openmp/tools/multiplex/CMakeLists.txt b/openmp/tools/multiplex/CMakeLists.txt index afc7fc5aa44ad..f44aa04f4354c 100644 --- a/openmp/tools/multiplex/CMakeLists.txt +++ b/openmp/tools/multiplex/CMakeLists.txt @@ -6,5 +6,7 @@ if(LIBOMP_OMPT_SUPPORT) install(FILES ompt-multiplex.h DESTINATION "${LIBOMP_HEADERS_INSTALL_PATH}") - add_subdirectory(tests) + if(OPENMP_INCLUDE_TESTS) + add_subdirectory(tests) + endif() endif() From d9dafb012185ba9c85931d6bb004d9f73ad0d858 Mon Sep 17 00:00:00 2001 From: Ross Brunton Date: Fri, 8 Aug 2025 14:17:29 +0100 Subject: [PATCH 2/2] Small cleanup and docs --- openmp/CMakeLists.txt | 4 ++-- openmp/README.rst | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt index e87cb2ff7c69e..e7c034cfce4ee 100644 --- a/openmp/CMakeLists.txt +++ b/openmp/CMakeLists.txt @@ -13,12 +13,12 @@ list(INSERT CMAKE_MODULE_PATH 0 if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") set(OPENMP_STANDALONE_BUILD TRUE) project(openmp C CXX ASM) + option(OPENMP_INCLUDE_TESTS "Generate and build openmp tests." ON) else() set(OPENMP_STANDALONE_BUILD FALSE) + option(OPENMP_INCLUDE_TESTS "Generate and build openmp tests." ${LLVM_INCLUDE_TESTS}) endif() -option(OPENMP_INCLUDE_TESTS "Generate and build openmp tests." ${LLVM_INCLUDE_TESTS}) - # Must go below project(..) include(GNUInstallDirs) diff --git a/openmp/README.rst b/openmp/README.rst index c34d3e8a40d7d..2c741e37d382e 100644 --- a/openmp/README.rst +++ b/openmp/README.rst @@ -123,6 +123,10 @@ Options for all Libraries Compiler to use for testing. Defaults to the compiler that was also used for building. Will default to flang if build is in-tree. +**OPENMP_INCLUDE_TESTS** = ``${LLVM_INCLUDE_TESTS}`` + Enable generation and build of test suite. Defaults to ``LLVM_INCLUDE_TESTS`` + if built as part of LLVM, otherwise defaults to ``ON``. + **OPENMP_LLVM_TOOLS_DIR** = ``/path/to/built/llvm/tools`` Additional path to search for LLVM tools needed by tests.