Revert "[OpenMP] Remove standalone build mode (#149878)"
Downstream builds are note sufficiently prepared. This reverts commit 176928cc1371c23d499b474fa95e076b61f776c4.
This commit is contained in:
parent
9a5589900a
commit
e07b9d1504
@ -66,6 +66,14 @@ set(RUNTIMES_ve-unknown-linux-gnu_LIBCXXABI_USE_COMPILER_RT TRUE CACHE BOOL "")
|
||||
# VE uses Compiler-RT from libcxx.
|
||||
set(RUNTIMES_ve-unknown-linux-gnu_LIBCXX_USE_COMPILER_RT TRUE CACHE BOOL "")
|
||||
|
||||
# Pretended standalone build for OpenMP since OpenMP doesn't support
|
||||
# LLVM_ENABLE_PER_TARGET_RUNTIME_DIR yet.
|
||||
# - Use OPENMP_STANDALONE_BUILD
|
||||
# - Define OPENMP_LIBDIR_SUFFIX to pretend per-target openmp directory
|
||||
# - Define OPENMP_LLVM_TOOLS_DIR for test
|
||||
set(RUNTIMES_x86_64-unknown-linux-gnu_OPENMP_STANDALONE_BUILD ON CACHE BOOL "")
|
||||
set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_STANDALONE_BUILD ON CACHE BOOL "")
|
||||
|
||||
# Specify LIBDIR_SUFFIX for OpenMP to install them at following directories.
|
||||
# install/lib/clang/${VERSION}/lib/x86_64-unknown-linux-gnu
|
||||
# install/lib/clang/${VERSION}/lib/ve-unknown-linux-gnu
|
||||
|
||||
@ -10,57 +10,88 @@ 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}")
|
||||
message(FATAL_ERROR [[The legacy standalone build mode has been removed. Please change
|
||||
cmake <llvm-project>/openmp
|
||||
to
|
||||
cmake <llvm-project>/runtimes -DLLVM_ENABLE_RUNTIMES=openmp
|
||||
For more details on building the LLVM OpenMP libraries, see https://openmp.llvm.org/Building.html]])
|
||||
set(OPENMP_STANDALONE_BUILD TRUE)
|
||||
project(openmp C CXX ASM)
|
||||
else()
|
||||
set(OPENMP_STANDALONE_BUILD FALSE)
|
||||
endif()
|
||||
|
||||
# Must go below project(..)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# 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 ()
|
||||
if (OPENMP_STANDALONE_BUILD)
|
||||
set(LLVM_TREE_AVAILABLE False)
|
||||
|
||||
set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
|
||||
# CMAKE_BUILD_TYPE was not set, default to Release.
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
# 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
|
||||
# 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
|
||||
"Path where built OpenMP libraries should be installed.")
|
||||
endif()
|
||||
|
||||
if (NOT MSVC)
|
||||
set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang)
|
||||
set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++)
|
||||
# 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)
|
||||
else()
|
||||
set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang.exe)
|
||||
set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++.exe)
|
||||
endif()
|
||||
# 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 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()
|
||||
set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
|
||||
|
||||
# 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)
|
||||
# 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_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)
|
||||
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)
|
||||
endif()
|
||||
|
||||
# Check and set up common compiler flags.
|
||||
include(config-ix)
|
||||
@ -150,8 +181,10 @@ 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)
|
||||
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()
|
||||
|
||||
option(OPENMP_MSVC_NAME_SCHEME "Build dll with MSVC naming scheme." OFF)
|
||||
|
||||
|
||||
@ -1,14 +1,77 @@
|
||||
# Keep track if we have all dependencies.
|
||||
set(ENABLE_CHECK_TARGETS TRUE)
|
||||
|
||||
if (TARGET FileCheck)
|
||||
set(OPENMP_FILECHECK_EXECUTABLE ${LLVM_TOOLS_BINARY_DIR}/FileCheck)
|
||||
# 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)
|
||||
else()
|
||||
message(STATUS "Cannot find 'FileCheck'.")
|
||||
message(WARNING "The check targets will not be available!")
|
||||
set(ENABLE_CHECK_TARGETS FALSE)
|
||||
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_TOOLS_BINARY_DIR}/FileCheck)
|
||||
endif()
|
||||
set(OPENMP_NOT_EXECUTABLE ${LLVM_TOOLS_BINARY_DIR}/not)
|
||||
endif()
|
||||
set(OPENMP_NOT_EXECUTABLE ${LLVM_TOOLS_BINARY_DIR}/not)
|
||||
|
||||
# Macro to extract information about compiler from file. (no own scope)
|
||||
macro(extract_test_compiler_information lang file)
|
||||
@ -55,28 +118,50 @@ 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.
|
||||
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")
|
||||
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()
|
||||
else()
|
||||
set(OPENMP_TEST_COMPILER_THREAD_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
|
||||
# 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)
|
||||
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")
|
||||
@ -127,21 +212,31 @@ function(add_openmp_testsuite target comment)
|
||||
set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_DEPENDS ${ARG_DEPENDS})
|
||||
endif()
|
||||
|
||||
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}
|
||||
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
|
||||
)
|
||||
else()
|
||||
add_lit_testsuite(${target}
|
||||
${comment}
|
||||
${ARG_UNPARSED_ARGUMENTS}
|
||||
DEPENDS clang FileCheck not ${ARG_DEPENDS}
|
||||
ARGS ${ARG_ARGS}
|
||||
)
|
||||
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()
|
||||
endif()
|
||||
|
||||
if (TARGET flang-rt)
|
||||
|
||||
@ -20,9 +20,6 @@ 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
|
||||
|
||||
@ -19,52 +19,64 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
||||
include(LibompGetArchitecture)
|
||||
include(LibompDefinitions)
|
||||
|
||||
# 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})
|
||||
# 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()
|
||||
|
||||
# Time profiling support
|
||||
set(LIBOMP_PROFILING_SUPPORT ${OPENMP_ENABLE_LIBOMP_PROFILING})
|
||||
@ -417,6 +429,38 @@ 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)
|
||||
add_subdirectory(unittests)
|
||||
|
||||
@ -174,7 +174,7 @@ libomp_get_libflags(LIBOMP_CONFIGURED_LIBFLAGS)
|
||||
|
||||
# Build libomp library. Add LLVMSupport dependency if building in-tree with
|
||||
# libomptarget profiling enabled.
|
||||
if(NOT OPENMP_ENABLE_LIBOMP_PROFILING)
|
||||
if(OPENMP_STANDALONE_BUILD OR (NOT OPENMP_ENABLE_LIBOMP_PROFILING))
|
||||
add_library(omp ${LIBOMP_LIBRARY_KIND} $<TARGET_OBJECTS:obj.omp>)
|
||||
set_property(TARGET omp PROPERTY FOLDER "OpenMP/Libraries")
|
||||
# Linking command will include libraries in LIBOMP_CONFIGURED_LIBFLAGS
|
||||
@ -395,8 +395,10 @@ add_dependencies(libomp-micro-tests libomp-test-deps)
|
||||
|
||||
# `omp` needs to be exported if in-tree build.
|
||||
set(export_to_llvmexports)
|
||||
get_target_export_arg(omp LLVM export_to_llvmexports)
|
||||
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS omp)
|
||||
if (NOT OPENMP_STANDALONE_BUILD)
|
||||
get_target_export_arg(omp LLVM export_to_llvmexports)
|
||||
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS omp)
|
||||
endif()
|
||||
|
||||
# Install rules
|
||||
# We want to install libomp in ${DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}
|
||||
|
||||
@ -33,6 +33,7 @@ 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)
|
||||
|
||||
|
||||
@ -215,7 +215,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.test_compiler_has_omp_h:
|
||||
if config.is_standalone_build and config.test_compiler_has_omp_h:
|
||||
config.substitutions.append(("%flags-use-compiler-omp-h",
|
||||
config.test_flags_use_compiler_omp_h))
|
||||
else:
|
||||
|
||||
@ -20,6 +20,7 @@ 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@"
|
||||
|
||||
@ -6,8 +6,27 @@ if(WIN32 OR STUBS_LIBRARY)
|
||||
return()
|
||||
endif()
|
||||
|
||||
function(standalone_add_gtest success_var)
|
||||
# LLVM_RUNTIMES_BUILD avoids gtest to link to LLVMSupport, which might be
|
||||
# incompable with the platform libomp is compiled for.
|
||||
set(LLVM_RUNTIMES_BUILD 1)
|
||||
if (EXISTS "${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include/gtest/gtest.h")
|
||||
set(${success_var} TRUE PARENT_SCOPE)
|
||||
add_subdirectory("${LLVM_THIRD_PARTY_DIR}/unittest" "${CMAKE_BINARY_DIR}/third-party/runtimes_gtest")
|
||||
else()
|
||||
set(${success_var} FALSE PARENT_SCOPE)
|
||||
message(WARNING "OpenMP unit tests will be skipped as LLVM third-party unittest directory is not available at: ${LLVM_THIRD_PARTY_DIR}/unittest")
|
||||
return()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Make the targets default_gtest and default_gtest_main available.
|
||||
if ("openmp" IN_LIST LLVM_ENABLE_PROJECTS)
|
||||
if (OPENMP_STANDALONE_BUILD)
|
||||
standalone_add_gtest(STANDALONE_UNIT_TESTS)
|
||||
if(NOT STANDALONE_UNIT_TESTS)
|
||||
return()
|
||||
endif()
|
||||
elseif ("openmp" IN_LIST LLVM_ENABLE_PROJECTS)
|
||||
# llvm_gtest should already exist
|
||||
else ()
|
||||
# LLVM_ENABLE_RUNTIMES build
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user