mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 15:26:47 +00:00

This reverts commit d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6. Adds the patch by @hans from https://github.com/llvm/llvm-project/issues/62719 This patch fixes the Windows build. d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6 reverted the reviews D144509 [CMake] Bumps minimum version to 3.20.0. This partly undoes D137724. This change has been discussed on discourse https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193 Note this does not remove work-arounds for older CMake versions, that will be done in followup patches. D150532 [OpenMP] Compile assembly files as ASM, not C Since CMake 3.20, CMake explicitly passes "-x c" (or equivalent) when compiling a file which has been set as having the language C. This behaviour change only takes place if "cmake_minimum_required" is set to 3.20 or newer, or if the policy CMP0119 is set to new. Attempting to compile assembly files with "-x c" fails, however this is workarounded in many cases, as OpenMP overrides this with "-x assembler-with-cpp", however this is only added for non-Windows targets. Thus, after increasing cmake_minimum_required to 3.20, this breaks compiling the GNU assembly for Windows targets; the GNU assembly is used for ARM and AArch64 Windows targets when building with Clang. This patch unbreaks that. D150688 [cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump The build uses other mechanism to select the runtime. Fixes #62719 Reviewed By: #libc, Mordante Differential Revision: https://reviews.llvm.org/D151344
========================= LLVM OpenMP CMake Modules ========================= This directory contains CMake modules for OpenMP. These can be included into a project to include different OpenMP features. .. contents:: :local: Find OpenMP Target Support ========================== This module will attempt to find OpenMP target offloading support for a given device. The module will attempt to compile a test program using known compiler flags for each requested architecture. If successful, the flags required for offloading will be loaded into the ``OpenMPTarget::OpenMPTarget_<device>`` target or the ``OpenMPTarget_<device>_FLAGS`` variable. Currently supported target devices are ``NVPTX`` and ``AMDGPU``. This module is still under development so some features may be missing. To use this module, simply add the path to CMake's current module path and call ``find_package``. The module will be installed with your OpenMP installation by default. Including OpenMP offloading support in an application should now only require a few additions. .. code-block:: cmake cmake_minimum_required(VERSION 3.20.0) project(offloadTest VERSION 1.0 LANGUAGES CXX) list(APPEND CMAKE_MODULE_PATH "${PATH_TO_OPENMP_INSTALL}/lib/cmake/openmp") find_package(OpenMPTarget REQUIRED NVPTX) add_executable(offload) target_link_libraries(offload PRIVATE OpenMPTarget::OpenMPTarget_NVPTX) target_sources(offload PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/Main.cpp) Using this module requires at least CMake version 3.20.0. Supported languages are C and C++ with Fortran support planned in the future. If your application requires building for a specific device architecture you can set the ``OpenMPTarget_<device>_ARCH=<flag>`` variable. Compiler support is best for Clang but this module should work for other compiler vendors such as IBM or GNU.