CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
209 lines
7.6 KiB
CMake
209 lines
7.6 KiB
CMake
cmake_minimum_required(VERSION 3.20.0)
|
|
set(LLVM_SUBPROJECT_TITLE "OpenMP")
|
|
|
|
if(DEFINED LIBOMP_SHARED_LINKER_FLAGS)
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${LIBOMP_SHARED_LINKER_FLAGS}")
|
|
endif()
|
|
|
|
if(DEFINED LIBOMP_INSTALL_RPATH)
|
|
set(CMAKE_INSTALL_RPATH "${LIBOMP_INSTALL_RPATH}")
|
|
endif()
|
|
|
|
# Add cmake directory to search for custom cmake functions.
|
|
#set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
|
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
|
|
include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
|
|
NO_POLICY_SCOPE)
|
|
|
|
# Add path for custom modules
|
|
list(INSERT CMAKE_MODULE_PATH 0
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
|
|
"${LLVM_COMMON_CMAKE_UTILS}/Modules"
|
|
)
|
|
|
|
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]])
|
|
endif()
|
|
|
|
# Must go below project(..)
|
|
include(GNUInstallDirs)
|
|
|
|
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})
|
|
|
|
# When building in tree we install the runtime according to the LLVM settings.
|
|
# TODO: Use common runtimes infrastructure for output and install paths
|
|
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
|
set(OPENMP_TARGET_SUBDIR "${LLVM_DEFAULT_TARGET_TRIPLE}")
|
|
if(OPENMP_LIBDIR_SUBDIR)
|
|
string(APPEND OPENMP_TARGET_SUBDIR "/${OPENMP_LIBDIR_SUBDIR}")
|
|
endif()
|
|
cmake_path(NORMAL_PATH OPENMP_TARGET_SUBDIR)
|
|
set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}/${OPENMP_TARGET_SUBDIR}" 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()
|
|
|
|
set(OPENMP_INSTALL_CFGDIR "lib/cmake" CACHE STRING
|
|
"Path where OpenMP config should be installed")
|
|
|
|
set(OPENMP_TEST_C_COMPILER_default "${LLVM_TOOLS_BINARY_DIR}/clang${CMAKE_EXECUTABLE_SUFFIX}")
|
|
set(OPENMP_TEST_CXX_COMPILER_default "${LLVM_TOOLS_BINARY_DIR}/clang++${CMAKE_EXECUTABLE_SUFFIX}")
|
|
set(OPENMP_TEST_Fortran_COMPILER_default "${LLVM_TOOLS_BINARY_DIR}/flang${CMAKE_EXECUTABLE_SUFFIX}")
|
|
if (NOT TARGET "clang")
|
|
set(OPENMP_TEST_C_COMPILER_default "${CMAKE_C_COMPILER}")
|
|
set(OPENMP_TEST_CXX_COMPILER_default "${CMAKE_CXX_COMPILER}")
|
|
endif()
|
|
if (NOT TARGET "flang")
|
|
if (CMAKE_Fortran_COMPILER)
|
|
set(OPENMP_TEST_Fortran_COMPILER_default "${CMAKE_Fortran_COMPILER}")
|
|
else()
|
|
unset(OPENMP_TEST_Fortran_COMPILER_default)
|
|
endif()
|
|
endif()
|
|
set(OPENMP_TEST_C_COMPILER "${OPENMP_TEST_C_COMPILER_default}" CACHE STRING
|
|
"C compiler to use for testing OpenMP runtime libraries.")
|
|
set(OPENMP_TEST_CXX_COMPILER "${OPENMP_TEST_CXX_COMPILER_default}" CACHE STRING
|
|
"C++ compiler to use for testing OpenMP runtime libraries.")
|
|
set(OPENMP_TEST_Fortran_COMPILER "${OPENMP_TEST_Fortran_COMPILER_default}" CACHE STRING
|
|
"Fortran compiler to use for testing OpenMP runtime libraries.")
|
|
|
|
# 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)
|
|
include(LibompUtils)
|
|
include(LibompHandleFlags)
|
|
|
|
|
|
# Set libomp version
|
|
set(LIBOMP_VERSION_MAJOR 5)
|
|
set(LIBOMP_VERSION_MINOR 0)
|
|
|
|
# Set the OpenMP Year and Month associated with version
|
|
set(LIBOMP_OMP_YEAR_MONTH 201611)
|
|
|
|
# Get the build number from kmp_version.cpp
|
|
libomp_get_build_number("${CMAKE_CURRENT_SOURCE_DIR}/runtime" LIBOMP_VERSION_BUILD)
|
|
math(EXPR LIBOMP_VERSION_BUILD_YEAR "${LIBOMP_VERSION_BUILD}/10000")
|
|
math(EXPR LIBOMP_VERSION_BUILD_MONTH_DAY "${LIBOMP_VERSION_BUILD}%10000")
|
|
|
|
# Currently don't record any timestamps
|
|
set(LIBOMP_BUILD_DATE "No_Timestamp")
|
|
|
|
|
|
set(LIBOMP_FORTRAN_MODULES FALSE CACHE BOOL
|
|
"Create Fortran module files? (requires fortran compiler)")
|
|
|
|
option(LIBOMP_FORTRAN_MODULES_ONLY
|
|
"Build only Fortran modules without libomp runtime library" OFF)
|
|
if(LIBOMP_FORTRAN_MODULES_ONLY)
|
|
set(LIBOMP_FORTRAN_MODULES TRUE)
|
|
endif()
|
|
|
|
# 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 ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING
|
|
"OpenMP compiler flag to use for testing OpenMP runtime libraries.")
|
|
|
|
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.
|
|
# 32-bit systems are not supported either.
|
|
if (APPLE OR WIN32 OR WASM OR NOT "cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES
|
|
OR NOT CMAKE_SIZEOF_VOID_P EQUAL 8 OR "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
|
|
set(ENABLE_LIBOMPTARGET OFF)
|
|
endif()
|
|
|
|
option(OPENMP_ENABLE_LIBOMPTARGET "Enable building libomptarget for offloading."
|
|
${ENABLE_LIBOMPTARGET})
|
|
option(OPENMP_ENABLE_LIBOMP_PROFILING "Enable time profiling for libomp." OFF)
|
|
|
|
# Header install location
|
|
if(NOT LLVM_TREE_AVAILABLE)
|
|
set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}")
|
|
else()
|
|
include(GetClangResourceDir)
|
|
get_clang_resource_dir(LIBOMP_HEADERS_INSTALL_PATH SUBDIR include)
|
|
endif()
|
|
|
|
# Meta-target for building OpenMP runtime artifacts (libraries, device RTL, tools).
|
|
# Subdirectories call openmp_register_meta_dep() for each target they add.
|
|
add_custom_target(openmp ALL
|
|
COMMENT "OpenMP meta-target. Use 'ninja openmp' to build all OpenMP runtime targets."
|
|
)
|
|
|
|
add_custom_target(install-openmp
|
|
COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" --component openmp)
|
|
add_custom_target(install-openmp-stripped
|
|
COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}" --component openmp --strip)
|
|
add_dependencies(install-openmp openmp)
|
|
add_dependencies(install-openmp-stripped openmp)
|
|
|
|
# Use the current compiler target to determine the appropriate runtime to build.
|
|
if("${LLVM_DEFAULT_TARGET_TRIPLE}" MATCHES "^amdgcn|^nvptx|^spirv64" OR
|
|
"${CMAKE_CXX_COMPILER_TARGET}" MATCHES "^amdgcn|^nvptx|^spirv64")
|
|
add_subdirectory(device)
|
|
else()
|
|
add_subdirectory(module)
|
|
|
|
# Build host runtime library, after LIBOMPTARGET variables are set since they
|
|
# are needed to enable time profiling support in the OpenMP runtime.
|
|
if(NOT LIBOMP_FORTRAN_MODULES_ONLY)
|
|
add_subdirectory(runtime)
|
|
endif()
|
|
|
|
set(ENABLE_OMPT_TOOLS ON)
|
|
# Currently tools are not tested well on Windows or MacOS X.
|
|
if (APPLE OR WIN32)
|
|
set(ENABLE_OMPT_TOOLS OFF)
|
|
endif()
|
|
|
|
option(OPENMP_ENABLE_OMPT_TOOLS "Enable building ompt based tools for OpenMP."
|
|
${ENABLE_OMPT_TOOLS})
|
|
if (OPENMP_ENABLE_OMPT_TOOLS)
|
|
add_subdirectory(tools)
|
|
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)
|
|
|
|
option(OPENMP_MSVC_NAME_SCHEME "Build dll with MSVC naming scheme." OFF)
|
|
|
|
# Build libompd.so
|
|
add_subdirectory(libompd)
|
|
|
|
# Build documentation
|
|
add_subdirectory(docs)
|
|
endif()
|
|
|
|
# Now that we have seen all testsuites, create the check-openmp target.
|
|
construct_check_openmp_target()
|