[Openmp-commits] [openmp] [OpenMP] Remove standalone build mode (PR #149878)
Michael Kruse via Openmp-commits
openmp-commits at lists.llvm.org
Thu Jan 8 01:33:50 PST 2026
https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/149878
>From a8c6df74c71c7aad97f232278133f54fadc222c9 Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Mon, 21 Jul 2025 21:10:16 +0200
Subject: [PATCH 1/3] [OpenMP] Remove standalone build
---
openmp/CMakeLists.txt | 112 ++++++------------
openmp/cmake/OpenMPTesting.cmake | 174 +++++++---------------------
openmp/runtime/CMakeLists.txt | 136 ++++++++--------------
openmp/runtime/src/CMakeLists.txt | 8 +-
openmp/runtime/test/CMakeLists.txt | 1 -
openmp/runtime/test/lit.cfg | 2 +-
openmp/runtime/test/lit.site.cfg.in | 1 -
7 files changed, 127 insertions(+), 307 deletions(-)
diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt
index c206386fa6b61..e2d4a35128986 100644
--- a/openmp/CMakeLists.txt
+++ b/openmp/CMakeLists.txt
@@ -9,85 +9,49 @@ list(INSERT CMAKE_MODULE_PATH 0
"${LLVM_COMMON_CMAKE_UTILS}/Modules"
)
-# llvm/runtimes/ will set OPENMP_STANDALONE_BUILD.
-if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
- set(OPENMP_STANDALONE_BUILD TRUE)
- project(openmp C CXX ASM)
-else()
- set(OPENMP_STANDALONE_BUILD FALSE)
-endif()
-
# Must go below project(..)
include(GNUInstallDirs)
-if (OPENMP_STANDALONE_BUILD)
- # CMAKE_BUILD_TYPE was not set, default to Release.
- if (NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Release)
- endif()
-
- # Group common settings.
- set(OPENMP_ENABLE_WERROR FALSE CACHE BOOL
- "Enable -Werror flags to turn warnings into errors for supporting compilers.")
- set(OPENMP_LIBDIR_SUFFIX "" CACHE STRING
- "Suffix of lib installation directory, e.g. 64 => lib64")
- # Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR.
- set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}" CACHE STRING
+set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
+
+# When building in tree we install the runtime according to the LLVM settings.
+if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ set(OPENMP_INSTALL_LIBDIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE STRING
+ "Path where built openmp libraries should be installed.")
+else()
+ set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}" CACHE STRING
"Path where built OpenMP libraries should be installed.")
+endif()
- # 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_TEST_Fortran_COMPILER ${CMAKE_Fortran_COMPILER} CACHE STRING
- "FORTRAN compiler to use for testing OpenMP runtime libraries.")
- set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing.")
-
- set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
- set(CMAKE_CXX_STANDARD_REQUIRED NO)
- set(CMAKE_CXX_EXTENSIONS NO)
+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_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
-
- # When building in tree we install the runtime according to the LLVM settings.
- if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
- set(OPENMP_INSTALL_LIBDIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE STRING
- "Path where built openmp libraries should be installed.")
- else()
- set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}" CACHE STRING
- "Path where built OpenMP libraries should be installed.")
- endif()
-
- 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()
-
- # Check for flang
- if (NOT MSVC)
- set(OPENMP_TEST_Fortran_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/flang)
- else()
- set(OPENMP_TEST_Fortran_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/flang.exe)
- endif()
-
- # Set fortran test compiler if flang is found
- if (EXISTS "${OPENMP_TEST_Fortran_COMPILER}")
- message("Using local flang build at ${OPENMP_TEST_Fortran_COMPILER}")
- else()
- unset(OPENMP_TEST_Fortran_COMPILER)
- endif()
-
- # If not standalone, set CMAKE_CXX_STANDARD but don't set the global cache value,
- # only set it locally for OpenMP.
- set(CMAKE_CXX_STANDARD 17)
- set(CMAKE_CXX_STANDARD_REQUIRED NO)
- set(CMAKE_CXX_EXTENSIONS NO)
+ set(OPENMP_TEST_C_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang.exe)
+ set(OPENMP_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++.exe)
endif()
+# Check for flang
+if (NOT MSVC)
+ set(OPENMP_TEST_Fortran_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/flang)
+else()
+ set(OPENMP_TEST_Fortran_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/flang.exe)
+endif()
+
+# Set fortran test compiler if flang is found
+if (EXISTS "${OPENMP_TEST_Fortran_COMPILER}")
+ message("Using local flang build at ${OPENMP_TEST_Fortran_COMPILER}")
+else()
+ unset(OPENMP_TEST_Fortran_COMPILER)
+endif()
+
+# If not standalone, set CMAKE_CXX_STANDARD but don't set the global cache value,
+# only set it locally for OpenMP.
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED NO)
+set(CMAKE_CXX_EXTENSIONS NO)
+
+
# Check and set up common compiler flags.
include(config-ix)
include(HandleOpenMPOptions)
@@ -139,10 +103,8 @@ if (OPENMP_ENABLE_OMPT_TOOLS)
endif()
# Propagate OMPT support to offload
-if(NOT ${OPENMP_STANDALONE_BUILD})
- set(LIBOMP_HAVE_OMPT_SUPPORT ${LIBOMP_HAVE_OMPT_SUPPORT} PARENT_SCOPE)
- set(LIBOMP_OMP_TOOLS_INCLUDE_DIR ${LIBOMP_OMP_TOOLS_INCLUDE_DIR} PARENT_SCOPE)
-endif()
+set(LIBOMP_HAVE_OMPT_SUPPORT ${LIBOMP_HAVE_OMPT_SUPPORT} PARENT_SCOPE)
+set(LIBOMP_OMP_TOOLS_INCLUDE_DIR ${LIBOMP_OMP_TOOLS_INCLUDE_DIR} PARENT_SCOPE)
option(OPENMP_MSVC_NAME_SCHEME "Build dll with MSVC naming scheme." OFF)
diff --git a/openmp/cmake/OpenMPTesting.cmake b/openmp/cmake/OpenMPTesting.cmake
index 14cc5c67d84c2..9511b29294b7c 100644
--- a/openmp/cmake/OpenMPTesting.cmake
+++ b/openmp/cmake/OpenMPTesting.cmake
@@ -1,77 +1,14 @@
# Keep track if we have all dependencies.
set(ENABLE_CHECK_TARGETS TRUE)
-# Function to find required dependencies for testing.
-function(find_standalone_test_dependencies)
- find_package (Python3 COMPONENTS Interpreter)
-
- if (NOT Python3_Interpreter_FOUND)
- message(STATUS "Could not find Python.")
- message(WARNING "The check targets will not be available!")
- set(ENABLE_CHECK_TARGETS FALSE PARENT_SCOPE)
- return()
- else()
- set(Python3_EXECUTABLE ${Python3_EXECUTABLE} PARENT_SCOPE)
- endif()
-
- # Find executables.
- find_program(OPENMP_LLVM_LIT_EXECUTABLE
- NAMES llvm-lit.py llvm-lit lit.py lit
- PATHS ${OPENMP_LLVM_TOOLS_DIR})
- if (NOT OPENMP_LLVM_LIT_EXECUTABLE)
- message(STATUS "Cannot find llvm-lit.")
- message(STATUS "Please put llvm-lit in your PATH, set OPENMP_LLVM_LIT_EXECUTABLE to its full path, or point OPENMP_LLVM_TOOLS_DIR to its directory.")
- message(WARNING "The check targets will not be available!")
- set(ENABLE_CHECK_TARGETS FALSE PARENT_SCOPE)
- return()
- endif()
-
- find_program(OPENMP_FILECHECK_EXECUTABLE
- NAMES FileCheck
- PATHS ${OPENMP_LLVM_TOOLS_DIR})
- if (NOT OPENMP_FILECHECK_EXECUTABLE)
- message(STATUS "Cannot find FileCheck.")
- message(STATUS "Please put FileCheck in your PATH, set OPENMP_FILECHECK_EXECUTABLE to its full path, or point OPENMP_LLVM_TOOLS_DIR to its directory.")
- message(WARNING "The check targets will not be available!")
- set(ENABLE_CHECK_TARGETS FALSE PARENT_SCOPE)
- return()
- endif()
-
- find_program(OPENMP_NOT_EXECUTABLE
- NAMES not
- PATHS ${OPENMP_LLVM_TOOLS_DIR})
- if (NOT OPENMP_NOT_EXECUTABLE)
- message(STATUS "Cannot find 'not'.")
- message(STATUS "Please put 'not' in your PATH, set OPENMP_NOT_EXECUTABLE to its full path, or point OPENMP_LLVM_TOOLS_DIR to its directory.")
- message(WARNING "The check targets will not be available!")
- set(ENABLE_CHECK_TARGETS FALSE PARENT_SCOPE)
- return()
- endif()
-endfunction()
-
-if (${OPENMP_STANDALONE_BUILD})
- find_standalone_test_dependencies()
-
- # Set lit arguments.
- set(DEFAULT_LIT_ARGS "-sv --show-unsupported --show-xfail")
- if (MSVC OR XCODE)
- set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --no-progress-bar")
- endif()
- if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")
- set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --time-tests --timeout=3000")
- endif()
- set(OPENMP_LIT_ARGS "${DEFAULT_LIT_ARGS}" CACHE STRING "Options for lit.")
- separate_arguments(OPENMP_LIT_ARGS)
+if (NOT TARGET "FileCheck")
+ message(STATUS "Cannot find 'FileCheck'.")
+ message(WARNING "The check targets will not be available!")
+ set(ENABLE_CHECK_TARGETS FALSE)
else()
- if (NOT TARGET "FileCheck")
- message(STATUS "Cannot find 'FileCheck'.")
- message(WARNING "The check targets will not be available!")
- set(ENABLE_CHECK_TARGETS FALSE)
- else()
- set(OPENMP_FILECHECK_EXECUTABLE ${LLVM_RUNTIME_OUTPUT_INTDIR}/FileCheck)
- endif()
- set(OPENMP_NOT_EXECUTABLE ${LLVM_RUNTIME_OUTPUT_INTDIR}/not)
+ set(OPENMP_FILECHECK_EXECUTABLE ${LLVM_RUNTIME_OUTPUT_INTDIR}/FileCheck)
endif()
+set(OPENMP_NOT_EXECUTABLE ${LLVM_RUNTIME_OUTPUT_INTDIR}/not)
# Macro to extract information about compiler from file. (no own scope)
macro(extract_test_compiler_information lang file)
@@ -118,50 +55,29 @@ function(set_test_compiler_information dir)
endif()
endfunction()
-if (${OPENMP_STANDALONE_BUILD})
- # Detect compiler that should be used for testing.
- # We cannot use ExternalProject_Add() because its configuration runs when this
- # project is built which is too late for detecting the compiler...
- file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/DetectTestCompiler)
- execute_process(
- COMMAND ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${CMAKE_CURRENT_LIST_DIR}/DetectTestCompiler
- -DCMAKE_C_COMPILER=${OPENMP_TEST_C_COMPILER}
- -DCMAKE_CXX_COMPILER=${OPENMP_TEST_CXX_COMPILER}
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/DetectTestCompiler
- OUTPUT_VARIABLE DETECT_COMPILER_OUT
- ERROR_VARIABLE DETECT_COMPILER_ERR
- RESULT_VARIABLE DETECT_COMPILER_RESULT)
- if (DETECT_COMPILER_RESULT)
- message(STATUS "Could not detect test compilers.")
- message(WARNING "The check targets will not be available!")
- set(ENABLE_CHECK_TARGETS FALSE)
- else()
- set_test_compiler_information(${CMAKE_CURRENT_BINARY_DIR}/DetectTestCompiler)
- endif()
+
+# Set the information that we know.
+set(OPENMP_TEST_COMPILER_ID "Clang")
+# Cannot use CLANG_VERSION because we are not guaranteed that this is already set.
+set(OPENMP_TEST_COMPILER_VERSION "${LLVM_VERSION}")
+set(OPENMP_TEST_COMPILER_VERSION_MAJOR "${LLVM_VERSION_MAJOR}")
+set(OPENMP_TEST_COMPILER_VERSION_MAJOR_MINOR "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}")
+# Unfortunately the top-level cmake/config-ix.cmake file mangles CMake's
+# CMAKE_THREAD_LIBS_INIT variable from the FindThreads package, so work
+# around that, until it is fixed there.
+if("${CMAKE_THREAD_LIBS_INIT}" STREQUAL "-lpthread")
+ set(OPENMP_TEST_COMPILER_THREAD_FLAGS "-pthread")
else()
- # Set the information that we know.
- set(OPENMP_TEST_COMPILER_ID "Clang")
- # Cannot use CLANG_VERSION because we are not guaranteed that this is already set.
- set(OPENMP_TEST_COMPILER_VERSION "${LLVM_VERSION}")
- set(OPENMP_TEST_COMPILER_VERSION_MAJOR "${LLVM_VERSION_MAJOR}")
- set(OPENMP_TEST_COMPILER_VERSION_MAJOR_MINOR "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}")
- # Unfortunately the top-level cmake/config-ix.cmake file mangles CMake's
- # CMAKE_THREAD_LIBS_INIT variable from the FindThreads package, so work
- # around that, until it is fixed there.
- if("${CMAKE_THREAD_LIBS_INIT}" STREQUAL "-lpthread")
- set(OPENMP_TEST_COMPILER_THREAD_FLAGS "-pthread")
- else()
- set(OPENMP_TEST_COMPILER_THREAD_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
- endif()
- if(TARGET tsan)
- set(OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS 1)
- else()
- set(OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS 0)
- endif()
- set(OPENMP_TEST_COMPILER_HAS_OMP_H 1)
- set(OPENMP_TEST_COMPILER_OPENMP_FLAGS "-fopenmp ${OPENMP_TEST_COMPILER_THREAD_FLAGS}")
- set(OPENMP_TEST_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS 1)
+ set(OPENMP_TEST_COMPILER_THREAD_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
endif()
+if(TARGET tsan)
+ set(OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS 1)
+else()
+ set(OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS 0)
+endif()
+set(OPENMP_TEST_COMPILER_HAS_OMP_H 1)
+set(OPENMP_TEST_COMPILER_OPENMP_FLAGS "-fopenmp ${OPENMP_TEST_COMPILER_THREAD_FLAGS}")
+set(OPENMP_TEST_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS 1)
set(OPENMP_TEST_ENABLE_TSAN "${OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS}" CACHE BOOL
"Whether to enable tests using tsan")
@@ -212,31 +128,21 @@ function(add_openmp_testsuite target comment)
set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_DEPENDS ${ARG_DEPENDS})
endif()
- if (${OPENMP_STANDALONE_BUILD})
- set(LIT_ARGS ${OPENMP_LIT_ARGS} ${ARG_ARGS})
- add_custom_target(${target}
- COMMAND ${Python3_EXECUTABLE} ${OPENMP_LLVM_LIT_EXECUTABLE} ${LIT_ARGS} ${ARG_UNPARSED_ARGUMENTS}
- COMMENT ${comment}
- DEPENDS ${ARG_DEPENDS}
- USES_TERMINAL
+ if (ARG_EXCLUDE_FROM_CHECK_ALL)
+ add_lit_testsuite(${target}
+ ${comment}
+ ${ARG_UNPARSED_ARGUMENTS}
+ EXCLUDE_FROM_CHECK_ALL
+ DEPENDS clang FileCheck not ${ARG_DEPENDS}
+ ARGS ${ARG_ARGS}
)
else()
- if (ARG_EXCLUDE_FROM_CHECK_ALL)
- add_lit_testsuite(${target}
- ${comment}
- ${ARG_UNPARSED_ARGUMENTS}
- EXCLUDE_FROM_CHECK_ALL
- DEPENDS clang FileCheck not ${ARG_DEPENDS}
- ARGS ${ARG_ARGS}
- )
- else()
- add_lit_testsuite(${target}
- ${comment}
- ${ARG_UNPARSED_ARGUMENTS}
- DEPENDS clang FileCheck not ${ARG_DEPENDS}
- ARGS ${ARG_ARGS}
- )
- endif()
+ add_lit_testsuite(${target}
+ ${comment}
+ ${ARG_UNPARSED_ARGUMENTS}
+ DEPENDS clang FileCheck not ${ARG_DEPENDS}
+ ARGS ${ARG_ARGS}
+ )
endif()
endfunction()
diff --git a/openmp/runtime/CMakeLists.txt b/openmp/runtime/CMakeLists.txt
index b6c4759ec03f7..33b8de6ffe26f 100644
--- a/openmp/runtime/CMakeLists.txt
+++ b/openmp/runtime/CMakeLists.txt
@@ -25,64 +25,52 @@ include(LibompGetArchitecture)
include(LibompHandleFlags)
include(LibompDefinitions)
-# Determine the target architecture
-if(${OPENMP_STANDALONE_BUILD})
- # If adding a new architecture, take a look at cmake/LibompGetArchitecture.cmake
- libomp_get_architecture(LIBOMP_DETECTED_ARCH)
- set(LIBOMP_ARCH ${LIBOMP_DETECTED_ARCH} CACHE STRING
- "The architecture to build for (x86_64/i386/arm/ppc/ppc64/ppc64le/aarch64/aarch64_32/mic/mips/mips64/riscv64/loongarch64/ve/s390x/sparc/sparcv9/wasm32).")
- # Should assertions be enabled? They are on by default.
- set(LIBOMP_ENABLE_ASSERTIONS TRUE CACHE BOOL
- "enable assertions?")
- string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
-else() # Part of LLVM build
- # Determine the native architecture from LLVM.
- string(TOLOWER "${LLVM_TARGET_ARCH}" LIBOMP_NATIVE_ARCH)
- if( LIBOMP_NATIVE_ARCH STREQUAL "host" )
- string(REGEX MATCH "^[^-]*" LIBOMP_NATIVE_ARCH ${LLVM_HOST_TRIPLE})
- endif ()
- if(LIBOMP_NATIVE_ARCH MATCHES "i[2-6]86")
- set(LIBOMP_ARCH i386)
- elseif(LIBOMP_NATIVE_ARCH STREQUAL "x86")
- set(LIBOMP_ARCH i386)
- elseif(LIBOMP_NATIVE_ARCH STREQUAL "amd64")
- set(LIBOMP_ARCH x86_64)
- elseif(LIBOMP_NATIVE_ARCH STREQUAL "x86_64")
- set(LIBOMP_ARCH x86_64)
- elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc64le")
- set(LIBOMP_ARCH ppc64le)
- elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc64")
- set(LIBOMP_ARCH ppc64)
- elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc")
- set(LIBOMP_ARCH ppc)
- elseif(LIBOMP_NATIVE_ARCH MATCHES "aarch64_32")
- set(LIBOMP_ARCH aarch64_32)
- elseif(LIBOMP_NATIVE_ARCH MATCHES "aarch64")
- set(LIBOMP_ARCH aarch64)
- elseif(LIBOMP_NATIVE_ARCH MATCHES "arm64")
- set(LIBOMP_ARCH aarch64)
- elseif(LIBOMP_NATIVE_ARCH MATCHES "arm")
- set(LIBOMP_ARCH arm)
- elseif(LIBOMP_NATIVE_ARCH MATCHES "riscv64")
- set(LIBOMP_ARCH riscv64)
- elseif(LIBOMP_NATIVE_ARCH MATCHES "loongarch64")
- set(LIBOMP_ARCH loongarch64)
- elseif(LIBOMP_NATIVE_ARCH MATCHES "ve")
- set(LIBOMP_ARCH ve)
- elseif(LIBOMP_NATIVE_ARCH MATCHES "s390x")
- set(LIBOMP_ARCH s390x)
- elseif(LIBOMP_NATIVE_ARCH MATCHES "sparcv9")
- set(LIBOMP_ARCH sparcv9)
- elseif(LIBOMP_NATIVE_ARCH MATCHES "sparc")
- set(LIBOMP_ARCH sparc)
- elseif(LIBOMP_NATIVE_ARCH MATCHES "wasm")
- set(LIBOMP_ARCH wasm32)
- else()
- # last ditch effort
- libomp_get_architecture(LIBOMP_ARCH)
- endif ()
- set(LIBOMP_ENABLE_ASSERTIONS ${LLVM_ENABLE_ASSERTIONS})
-endif()
+# Determine the native architecture from LLVM.
+string(TOLOWER "${LLVM_TARGET_ARCH}" LIBOMP_NATIVE_ARCH)
+if( LIBOMP_NATIVE_ARCH STREQUAL "host" )
+ string(REGEX MATCH "^[^-]*" LIBOMP_NATIVE_ARCH ${LLVM_HOST_TRIPLE})
+endif ()
+if(LIBOMP_NATIVE_ARCH MATCHES "i[2-6]86")
+ set(LIBOMP_ARCH i386)
+elseif(LIBOMP_NATIVE_ARCH STREQUAL "x86")
+ set(LIBOMP_ARCH i386)
+elseif(LIBOMP_NATIVE_ARCH STREQUAL "amd64")
+ set(LIBOMP_ARCH x86_64)
+elseif(LIBOMP_NATIVE_ARCH STREQUAL "x86_64")
+ set(LIBOMP_ARCH x86_64)
+elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc64le")
+ set(LIBOMP_ARCH ppc64le)
+elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc64")
+ set(LIBOMP_ARCH ppc64)
+elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc")
+ set(LIBOMP_ARCH ppc)
+elseif(LIBOMP_NATIVE_ARCH MATCHES "aarch64_32")
+ set(LIBOMP_ARCH aarch64_32)
+elseif(LIBOMP_NATIVE_ARCH MATCHES "aarch64")
+ set(LIBOMP_ARCH aarch64)
+elseif(LIBOMP_NATIVE_ARCH MATCHES "arm64")
+ set(LIBOMP_ARCH aarch64)
+elseif(LIBOMP_NATIVE_ARCH MATCHES "arm")
+ set(LIBOMP_ARCH arm)
+elseif(LIBOMP_NATIVE_ARCH MATCHES "riscv64")
+ set(LIBOMP_ARCH riscv64)
+elseif(LIBOMP_NATIVE_ARCH MATCHES "loongarch64")
+ set(LIBOMP_ARCH loongarch64)
+elseif(LIBOMP_NATIVE_ARCH MATCHES "ve")
+ set(LIBOMP_ARCH ve)
+elseif(LIBOMP_NATIVE_ARCH MATCHES "s390x")
+ set(LIBOMP_ARCH s390x)
+elseif(LIBOMP_NATIVE_ARCH MATCHES "sparcv9")
+ set(LIBOMP_ARCH sparcv9)
+elseif(LIBOMP_NATIVE_ARCH MATCHES "sparc")
+ set(LIBOMP_ARCH sparc)
+elseif(LIBOMP_NATIVE_ARCH MATCHES "wasm")
+ set(LIBOMP_ARCH wasm32)
+else()
+ # last ditch effort
+ libomp_get_architecture(LIBOMP_ARCH)
+endif ()
+set(LIBOMP_ENABLE_ASSERTIONS ${LLVM_ENABLE_ASSERTIONS})
# Time profiling support
set(LIBOMP_PROFILING_SUPPORT ${OPENMP_ENABLE_LIBOMP_PROFILING})
@@ -435,38 +423,6 @@ set(LIBOMP_LIB_FILE ${LIBOMP_LIB_NAME}${LIBOMP_LIBRARY_SUFFIX})
set(LIBOMP_INSTALL_ALIASES TRUE CACHE BOOL
"Install libgomp and libiomp5 library aliases for backwards compatibility")
-# Print configuration after all variables are set.
-if(${OPENMP_STANDALONE_BUILD})
- libomp_say("Operating System -- ${CMAKE_SYSTEM_NAME}")
- libomp_say("Target Architecture -- ${LIBOMP_ARCH}")
- if(${MIC})
- libomp_say("Intel(R) MIC Architecture -- ${LIBOMP_MIC_ARCH}")
- endif()
- libomp_say("Build Type -- ${CMAKE_BUILD_TYPE}")
- libomp_say("Library Kind -- ${LIBOMP_LIBRARY_KIND}")
- libomp_say("Library Type -- ${LIBOMP_LIB_TYPE}")
- libomp_say("Fortran Modules -- ${LIBOMP_FORTRAN_MODULES}")
- # will say development if all zeros
- if(${LIBOMP_VERSION_BUILD} STREQUAL 00000000)
- set(LIBOMP_BUILD Development)
- else()
- set(LIBOMP_BUILD ${LIBOMP_VERSION_BUILD})
- endif()
- libomp_say("Build -- ${LIBOMP_BUILD}")
- libomp_say("Use Stats-gathering -- ${LIBOMP_STATS}")
- libomp_say("Use Debugger-support -- ${LIBOMP_USE_DEBUGGER}")
- libomp_say("Use ITT notify -- ${LIBOMP_USE_ITT_NOTIFY}")
- libomp_say("Use OMPT-support -- ${LIBOMP_OMPT_SUPPORT}")
- if(${LIBOMP_OMPT_SUPPORT})
- libomp_say("Use OMPT-optional -- ${LIBOMP_OMPT_OPTIONAL}")
- endif()
- libomp_say("Use OMPD-support -- ${LIBOMP_OMPD_SUPPORT}")
- libomp_say("Use Adaptive locks -- ${LIBOMP_USE_ADAPTIVE_LOCKS}")
- libomp_say("Use quad precision -- ${LIBOMP_USE_QUAD_PRECISION}")
- libomp_say("Use Hwloc library -- ${LIBOMP_USE_HWLOC}")
- libomp_say("Use OMPX-taskgraph -- ${LIBOMP_OMPX_TASKGRAPH}")
-endif()
-
add_subdirectory(src)
add_subdirectory(test)
diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt
index 698e185d9c4dd..df96b4b37bacc 100644
--- a/openmp/runtime/src/CMakeLists.txt
+++ b/openmp/runtime/src/CMakeLists.txt
@@ -176,7 +176,7 @@ libomp_get_ldflags(LIBOMP_CONFIGURED_LDFLAGS)
libomp_get_libflags(LIBOMP_CONFIGURED_LIBFLAGS)
# Build libomp library. Add LLVMSupport dependency if building in-tree with libomptarget profiling enabled.
-if(OPENMP_STANDALONE_BUILD OR (NOT OPENMP_ENABLE_LIBOMP_PROFILING))
+if(NOT OPENMP_ENABLE_LIBOMP_PROFILING)
add_library(omp ${LIBOMP_LIBRARY_KIND} ${LIBOMP_SOURCE_FILES})
set_property(TARGET omp PROPERTY FOLDER "OpenMP/Libraries")
# Linking command will include libraries in LIBOMP_CONFIGURED_LIBFLAGS
@@ -430,10 +430,8 @@ add_dependencies(libomp-micro-tests libomp-test-deps)
# `omp` needs to be exported if in-tree build.
set(export_to_llvmexports)
-if (NOT OPENMP_STANDALONE_BUILD)
- get_target_export_arg(omp LLVM export_to_llvmexports)
- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS omp)
-endif()
+get_target_export_arg(omp LLVM export_to_llvmexports)
+set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS omp)
# Install rules
# We want to install libomp in ${DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}
diff --git a/openmp/runtime/test/CMakeLists.txt b/openmp/runtime/test/CMakeLists.txt
index a7790804542b7..54044965656c2 100644
--- a/openmp/runtime/test/CMakeLists.txt
+++ b/openmp/runtime/test/CMakeLists.txt
@@ -33,7 +33,6 @@ pythonize_bool(LIBOMP_OMPT_OPTIONAL)
pythonize_bool(LIBOMP_OMPX_TASKGRAPH)
pythonize_bool(LIBOMP_HAVE_LIBM)
pythonize_bool(LIBOMP_HAVE_LIBATOMIC)
-pythonize_bool(OPENMP_STANDALONE_BUILD)
pythonize_bool(OPENMP_TEST_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS)
pythonize_bool(OPENMP_TEST_COMPILER_HAS_OMP_H)
diff --git a/openmp/runtime/test/lit.cfg b/openmp/runtime/test/lit.cfg
index ca32985fe6c48..118f33a37537b 100644
--- a/openmp/runtime/test/lit.cfg
+++ b/openmp/runtime/test/lit.cfg
@@ -197,7 +197,7 @@ config.substitutions.append(("%clang", config.test_c_compiler))
config.substitutions.append(("%openmp_flags", config.test_openmp_flags))
# %flags-use-compiler-omp-h allows us to use the test compiler's omp.h file which
# may have different definitions of structures than our omp.h file.
-if config.is_standalone_build and config.test_compiler_has_omp_h:
+if config.test_compiler_has_omp_h:
config.substitutions.append(("%flags-use-compiler-omp-h",
config.test_flags_use_compiler_omp_h))
else:
diff --git a/openmp/runtime/test/lit.site.cfg.in b/openmp/runtime/test/lit.site.cfg.in
index fc65289e4ce64..879bf064f8d48 100644
--- a/openmp/runtime/test/lit.site.cfg.in
+++ b/openmp/runtime/test/lit.site.cfg.in
@@ -19,7 +19,6 @@ config.has_ompt = @LIBOMP_OMPT_SUPPORT@ and @LIBOMP_OMPT_OPTIONAL@
config.has_ompx_taskgraph = @LIBOMP_OMPX_TASKGRAPH@
config.has_libm = @LIBOMP_HAVE_LIBM@
config.has_libatomic = @LIBOMP_HAVE_LIBATOMIC@
-config.is_standalone_build = @OPENMP_STANDALONE_BUILD@
config.has_omit_frame_pointer_flag = @OPENMP_TEST_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS@
config.target_arch = "@LIBOMP_ARCH@"
config.compiler_frontend_variant = "@CMAKE_C_COMPILER_FRONTEND_VARIANT@"
>From 3453f5143febb7cadf824ddf579833c9af04197a Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Mon, 21 Jul 2025 21:24:26 +0200
Subject: [PATCH 2/3] Add release notes
---
openmp/docs/ReleaseNotes.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/openmp/docs/ReleaseNotes.rst b/openmp/docs/ReleaseNotes.rst
index 6c1a46caf1d81..89a43e3becd7c 100644
--- a/openmp/docs/ReleaseNotes.rst
+++ b/openmp/docs/ReleaseNotes.rst
@@ -20,6 +20,9 @@ from the `LLVM releases web site <https://llvm.org/releases/>`_.
Non-comprehensive list of changes in this release
=================================================
+- Removed the standalone build mode. It is redundant with the runtimes default
+ build.
+
Device Runtime
--------------
- Changed the OpenMP DeviceRTL to use 'generic' IR. The
>From b8d382c221e8bdb2792621e39878a984543bf2e6 Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Thu, 8 Jan 2026 10:33:20 +0100
Subject: [PATCH 3/3] cleanup
---
openmp/CMakeLists.txt | 33 ++++++++++++++---------------
openmp/cmake/OpenMPTesting.cmake | 7 +++---
openmp/docs/SupportAndFAQ.rst | 16 ++++++++++++++
openmp/tools/omptest/CMakeLists.txt | 2 +-
4 files changed, 36 insertions(+), 22 deletions(-)
diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt
index 1859a805bee0e..dd4c28047f932 100644
--- a/openmp/CMakeLists.txt
+++ b/openmp/CMakeLists.txt
@@ -12,16 +12,16 @@ list(INSERT CMAKE_MODULE_PATH 0
# Must go below project(..)
include(GNUInstallDirs)
- set(LLVM_TREE_AVAILABLE False)
-
- # Usually <llvm-project>/runtimes/CMakeLists.txt sets LLVM_TREE_AVAILABLE and
- # we assume it is not available otherwise. The exception is that we are in an
- # LLVM_ENABLE_PROJECTS=openmp build, the LLVM tree is actually available.
- # Note that this build mode has been deprecated.
- # See https://github.com/llvm/llvm-project/issues/124014
- if (NOT LLVM_RUNTIMES_BUILD AND "openmp" IN_LIST LLVM_ENABLE_PROJECTS)
- set(LLVM_TREE_AVAILABLE True)
- endif ()
+set(LLVM_TREE_AVAILABLE False)
+
+# Usually <llvm-project>/runtimes/CMakeLists.txt sets LLVM_TREE_AVAILABLE and
+# we assume it is not available otherwise. The exception is that we are in an
+# LLVM_ENABLE_PROJECTS=openmp build, the LLVM tree is actually available.
+# Note that this build mode has been deprecated.
+# See https://github.com/llvm/llvm-project/issues/124014
+if (NOT LLVM_RUNTIMES_BUILD AND "openmp" IN_LIST LLVM_ENABLE_PROJECTS)
+ set(LLVM_TREE_AVAILABLE True)
+endif ()
set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
@@ -35,11 +35,11 @@ else()
endif()
if (NOT MSVC)
- set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang)
- set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++)
+ set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang)
+ set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++)
else()
- set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang.exe)
- set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++.exe)
+ set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang.exe)
+ set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++.exe)
endif()
# Set fortran test compiler if flang is found
@@ -55,7 +55,6 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED NO)
set(CMAKE_CXX_EXTENSIONS NO)
-
# Check and set up common compiler flags.
include(config-ix)
include(HandleOpenMPOptions)
@@ -120,8 +119,8 @@ else()
endif()
# Propagate OMPT support to offload
-set(LIBOMP_HAVE_OMPT_SUPPORT ${LIBOMP_HAVE_OMPT_SUPPORT} PARENT_SCOPE)
-set(LIBOMP_OMP_TOOLS_INCLUDE_DIR ${LIBOMP_OMP_TOOLS_INCLUDE_DIR} PARENT_SCOPE)
+ set(LIBOMP_HAVE_OMPT_SUPPORT ${LIBOMP_HAVE_OMPT_SUPPORT} PARENT_SCOPE)
+ set(LIBOMP_OMP_TOOLS_INCLUDE_DIR ${LIBOMP_OMP_TOOLS_INCLUDE_DIR} PARENT_SCOPE)
option(OPENMP_MSVC_NAME_SCHEME "Build dll with MSVC naming scheme." OFF)
diff --git a/openmp/cmake/OpenMPTesting.cmake b/openmp/cmake/OpenMPTesting.cmake
index fb6b004e3ee52..0f2999175173f 100644
--- a/openmp/cmake/OpenMPTesting.cmake
+++ b/openmp/cmake/OpenMPTesting.cmake
@@ -1,12 +1,12 @@
# Keep track if we have all dependencies.
set(ENABLE_CHECK_TARGETS TRUE)
-if (NOT TARGET "FileCheck")
+if (TARGET FileCheck)
+ set(OPENMP_FILECHECK_EXECUTABLE ${LLVM_RUNTIME_OUTPUT_INTDIR}/FileCheck)
+else()
message(STATUS "Cannot find 'FileCheck'.")
message(WARNING "The check targets will not be available!")
set(ENABLE_CHECK_TARGETS FALSE)
-else()
- set(OPENMP_FILECHECK_EXECUTABLE ${LLVM_RUNTIME_OUTPUT_INTDIR}/FileCheck)
endif()
set(OPENMP_NOT_EXECUTABLE ${LLVM_RUNTIME_OUTPUT_INTDIR}/not)
@@ -55,7 +55,6 @@ function(set_test_compiler_information dir)
endif()
endfunction()
-
# Set the information that we know.
set(OPENMP_TEST_COMPILER_ID "Clang")
# Cannot use CLANG_VERSION because we are not guaranteed that this is already set.
diff --git a/openmp/docs/SupportAndFAQ.rst b/openmp/docs/SupportAndFAQ.rst
index f5a84784c8de8..6762bd1c3ac64 100644
--- a/openmp/docs/SupportAndFAQ.rst
+++ b/openmp/docs/SupportAndFAQ.rst
@@ -90,6 +90,22 @@ invocation.
For Nvidia offload, please see :ref:`build_nvidia_offload_capable_compiler`.
For AMDGPU offload, please see :ref:`build_amdgpu_offload_capable_compiler`.
+For a standalone build, users are expected to use the LLVM runtimes build..
+
+.. code-block:: sh
+
+ $> cd llvm-project # The llvm-project checkout
+ $> mkdir build
+ $> cd build
+ $> cmake ../runtimes -G Ninja \
+ -DLLVM_BINARY_DIR="${PATH_TO_LLVM}"
+ -DLLVM_ENABLE_RUNTIMES="openmp;offload"
+ -DLIBOMPTEST_BUILD_STANDALONE=1
+ -DCMAKE_BUILD_TYPE=<Debug|Release> \ # Select build type
+ -DCMAKE_INSTALL_PREFIX=<PATH> \ # Where the libraries will live
+ -DOPENMP_LLVM_TOOLS_DIR=<PATH> \ # Where FileCheck and lit testing tools live.
+ $> ninja install
+
.. note::
The compiler that generates the offload code should be the same (version) as
the compiler that builds the OpenMP device runtimes. The OpenMP host runtime
diff --git a/openmp/tools/omptest/CMakeLists.txt b/openmp/tools/omptest/CMakeLists.txt
index b313f223c354c..b04cb3a056cf5 100644
--- a/openmp/tools/omptest/CMakeLists.txt
+++ b/openmp/tools/omptest/CMakeLists.txt
@@ -9,7 +9,7 @@ project(omptest LANGUAGES CXX)
option(LIBOMPTEST_BUILD_STANDALONE
"Build ompTest 'standalone', i.e. w/o GoogleTest."
- ${OPENMP_STANDALONE_BUILD})
+ OFF)
option(LIBOMPTEST_BUILD_UNITTESTS
"Build ompTest's unit tests, requires GoogleTest." OFF)
option(LIBOMPTEST_INSTALL_COMPONENTS
More information about the Openmp-commits
mailing list