Skip to content

Commit ce78062

Browse files
committed
Recognize Flang as a compiler and ask for resource dir
1 parent 346f2b7 commit ce78062

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

openmp/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ else()
8585
set(CMAKE_CXX_EXTENSIONS NO)
8686
endif()
8787

88+
# Enabling Fortran if it is needed
89+
if(${LIBOMP_FORTRAN_MODULES})
90+
enable_language(Fortran)
91+
endif()
92+
8893
# Check and set up common compiler flags.
8994
include(config-ix)
9095
include(HandleOpenMPOptions)
@@ -114,6 +119,21 @@ option(OPENMP_ENABLE_LIBOMP_PROFILING "Enable time profiling for libomp." OFF)
114119
# Header install location
115120
if(${OPENMP_STANDALONE_BUILD})
116121
set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}")
122+
message("MK: CMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID}")
123+
if(CMAKE_Fortran_COMPILER_ID MATCHES "Flang")
124+
execute_process(
125+
OUTPUT_STRIP_TRAILING_WHITESPACE
126+
COMMAND ${CMAKE_Fortran_COMPILER} --print-resource-dir
127+
RESULT_VARIABLE COMMAND_RETURN_CODE
128+
OUTPUT_VARIABLE FORTRAN_COMPILER_RESOURCE_DIR
129+
)
130+
# TODO: This must not be hard-coded, but needs to come from Flang!
131+
set(LIBOMP_MODULES_INSTALL_PATH "${FORTRAN_COMPILER_RESOURCE_DIR}")
132+
message("MK: 1 LIBOMP_MODULES_INSTALL_PATH=${LIBOMP_MODULES_INSTALL_PATH}")
133+
else()
134+
set(LIBOMP_MODULES_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}")
135+
message("MK: 2 LIBOMP_MODULES_INSTALL_PATH=${CMAKE_INSTALL_INCLUDEDIR}")
136+
endif()
117137
else()
118138
include(GetClangResourceDir)
119139
get_clang_resource_dir(LIBOMP_HEADERS_INSTALL_PATH SUBDIR include)

openmp/runtime/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,6 @@ set(LIBOMP_TOOLS_DIR ${LIBOMP_BASE_DIR}/tools)
262262
set(LIBOMP_INC_DIR ${LIBOMP_SRC_DIR}/include)
263263
set(LIBOMP_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
264264

265-
# Enabling Fortran if it is needed
266-
if(${LIBOMP_FORTRAN_MODULES})
267-
enable_language(Fortran)
268-
endif()
269265
# Enable MASM Compiler if it is needed (Windows only)
270266
if(WIN32)
271267
enable_language(ASM_MASM)

0 commit comments

Comments
 (0)