Skip to content

Commit a39c5f7

Browse files
committed
Replace LIBOMP_FORTRAN_MODULES with RUNTIMES_FLANG_MODULES_ENABLED
For some reason there were to different flags to build the Fortran modules: 1. LIBOMP_FORTRAN_MODULES=ON and CMAKE_Fortran_COMPILER 2. LIBOMP_FORTRAN_MODULES_COMPILER When using the second, LIBOMP_FORTRAN_MODULES would be off. Trying to keep the option available causes build failures by misinterpretation.
1 parent da3a850 commit a39c5f7

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

openmp/CMakeLists.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,8 @@ endif ()
124124
set(OPENMP_TEST_Fortran_COMPILER "${OPENMP_TEST_Fortran_COMPILER_default}" CACHE STRING
125125
"Fortran compiler to use for testing OpenMP runtime libraries.")
126126

127-
if (LLVM_RUNTIMES_BUILD)
128-
set(LIBOMP_FORTRAN_MODULES "${RUNTIMES_FLANG_MODULES_ENABLED}" CACHE BOOL
129-
"Create Fortran module files? (requires fortran compiler)")
130-
else ()
131-
set(LIBOMP_FORTRAN_MODULES FALSE)
127+
if (CMAKE_Fortran_COMPILER AND NOT LLVM_RUNTIMES_BUILD)
128+
message(WARNING "Building omp_lib.mod requires using LLVM_ENABLE_RUNTIMES=flang-rt\\\;openmp")
132129
endif ()
133130

134131
# Set up testing infrastructure.
@@ -163,10 +160,10 @@ else()
163160
get_clang_resource_dir(LIBOMP_HEADERS_INSTALL_PATH SUBDIR include)
164161
endif()
165162

166-
if(LIBOMP_FORTRAN_MODULES)
163+
if(LIBOMP_FORTRUNTIMES_FLANG_MODULES_ENABLEDRAN_MODULES)
167164
add_subdirectory(module)
168165
else()
169-
message(STATUS "Building omp_lib.mod disabled by LIBOMP_FORTRAN_MODULES='${LIBOMP_FORTRAN_MODULES}'; libomp-mod does nothing")
166+
message(STATUS "Building omp_lib.mod disabled by RUNTIMES_FLANG_MODULES_ENABLED='${RUNTIMES_FLANG_MODULES_ENABLED}'; libomp-mod does nothing")
170167
add_custom_target(libomp-mod)
171168
endif()
172169

openmp/README.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ variable.
9696

9797
**CMAKE_Fortran_COMPILER** = <Fortran compiler name>
9898
Specify the Fortran compiler. This option is only needed when
99-
**LIBOMP_FORTRAN_MODULES** is ``ON`` (see below). So typically, a Fortran
99+
**RUNTIMES_FLANG_MODULES_ENABLED** is ``ON``. So typically, a Fortran
100100
compiler is not needed during the build.
101101

102102
**CMAKE_ASM_MASM_COMPILER** = ``ml|ml64``
@@ -166,9 +166,6 @@ Options for ``libomp``
166166

167167
Static libraries are not supported on Windows*.
168168

169-
**LIBOMP_FORTRAN_MODULES** = ``OFF|ON``
170-
Create the Fortran modules (requires Fortran compiler).
171-
172169
macOS* Fat Libraries
173170
""""""""""""""""""""
174171
On macOS* machines, it is possible to build universal (or fat) libraries which
@@ -343,7 +340,7 @@ Advanced Builds with Various Options
343340

344341
.. code-block:: console
345342
346-
$ cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort -DLIBOMP_FORTRAN_MODULES=on ..
343+
$ cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort -DRUNTIMES_FLANG_MODULES_ENABLED=on ..
347344
348345
- Have CMake find the C/C++ compiler and specify additional flags for the
349346
preprocessor and C++ compiler.

openmp/module/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ add_library(libomp-mod OBJECT
2121
)
2222
set_target_properties(libomp-mod PROPERTIES FOLDER "OpenMP/Fortran Modules")
2323

24+
# The following requests explicit building of the Fortran module files
25+
# Workaround for gfortran to build modules with the
26+
# omp_sched_monotonic integer parameter
2427
if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
25-
target_compile_options(libomp-mod PRIVATE -fno-range-check)
26-
endif()
28+
target_compile_options(libomp-mod PRIVATE -fno-range-check)
29+
endif ()
2730

2831
flang_module_target(libomp-mod PUBLIC)
2932
if (FORTRAN_MODULE_DEPS)

openmp/runtime/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ if(${OPENMP_STANDALONE_BUILD})
422422
libomp_say("Build Type -- ${CMAKE_BUILD_TYPE}")
423423
libomp_say("Library Kind -- ${LIBOMP_LIBRARY_KIND}")
424424
libomp_say("Library Type -- ${LIBOMP_LIB_TYPE}")
425-
libomp_say("Fortran Modules -- ${LIBOMP_FORTRAN_MODULES}")
425+
libomp_say("Fortran Modules -- ${RUNTIMES_FLANG_MODULES_ENABLED}")
426426
# will say development if all zeros
427427
if(${LIBOMP_VERSION_BUILD} STREQUAL 00000000)
428428
set(LIBOMP_BUILD Development)

openmp/runtime/cmake/LibompExports.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ if(${LIBOMP_OMPT_SUPPORT})
6464
COMMAND ${CMAKE_COMMAND} -E copy omp-tools.h ${LIBOMP_EXPORTS_CMN_DIR}
6565
)
6666
endif()
67-
if(${LIBOMP_FORTRAN_MODULES})
67+
if(RUNTIMES_FLANG_MODULES_ENABLED)
6868
# We cannot attach a POST_BUILD command to libomp-mod, so instead attach it
6969
# to omp and ensure that libomp-mod is built before by adding a dependency
7070
add_custom_command(TARGET omp POST_BUILD

0 commit comments

Comments
 (0)