flang-compiler / f18-llvm-project

Fork of llvm/llvm-project for f18. In sync with f18-mlir and f18.
http://llvm.org
28 stars 16 forks source link

[flang][cmake] Make CMake copy "omp_lib.h" into the build directory #1567

Closed banach-space closed 2 years ago

banach-space commented 2 years ago

Any header or module file in the Flang source directory is of no use to the compiler unless it is copied into the build directory. Indeed, all compiler search paths are relative to the compiler executable (flang-new in our case). Hence, "omp_lib.h" should be copied into the build directory alongside other compiler-provided files that can be "included" (header files) or "used" (module files).

For now, "omp_lib.h" is copied into "/include/flang/OpenMP". We may decide to change this in future. For example, Clang copies a bunch of runtime headers into “/lib/clang/”. We could also consider using a similar header from a different sub-project.

Flang's driver search path is updated accordingly. A rule for "installing" the "omp_lib.h" header is yet to be added (we will also need to determine the suitable location for this).

Differential Revision: https://reviews.llvm.org/D122015

kiranchandramohan commented 2 years ago

We need this patch to add enable OpenMP for SNAP and add it to CI which is a Milestone target for the OpenMP team. We will cover the right place for the header in a separate ticket/patch (https://github.com/llvm/llvm-project/issues/54800).

Merging.