Skip to content

Commit

Permalink
Update rules for Intel OneAPI compiler detection (OpenFAST#727)
Browse files Browse the repository at this point in the history
* Update rules for Intel OneAPI compiler detection

CMake 3.20 differentiates between older Intel compilers and the Intel
OneAPI compilers (which is now detected as `IntelLLVM`). This commit
introduces the necessary changes to CMake logic to allow building using
OneAPI compiler stack with the latest CMake version.

* Update CMake check for Intel compiler (#1)

Co-authored-by: Rafael M Mudafort <rafael.mudafort@nrel.gov>
  • Loading branch information
sayerhs and rafmudaf authored Apr 21, 2021
1 parent 83fa47c commit 92c45b4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ if (FPE_TRAP_ENABLED)
endif (FPE_TRAP_ENABLED)

# Setup dependencies
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel")
find_package(MKL)
endif()
if (MKL_FOUND)
Expand Down
6 changes: 3 additions & 3 deletions cmake/OpenfastFortranOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ macro(set_fast_fortran)

# Abort if we do not have gfortran or Intel Fortran Compiler.
if (NOT (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU" OR
${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel"))
${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel"))
message(FATAL_ERROR "OpenFAST requires either GFortran or Intel Fortran Compiler. Compiler detected by CMake: ${FCNAME}.")
endif()

Expand All @@ -54,7 +54,7 @@ macro(set_fast_fortran)
elseif("${CMAKE_Fortran_COMPILER_VERSION}" VERSION_LESS "4.6.0")
message(FATAL_ERROR "A version of GNU GFortran greater than 4.6.0 is required. GFortran version detected by CMake: ${CMAKE_Fortran_COMPILER_VERSION}.")
endif()
elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel")
if("${CMAKE_Fortran_COMPILER_VERSION}" VERSION_LESS "11")
message(FATAL_ERROR "A version of Intel ifort greater than 11 is required. ifort version detected by CMake: ${CMAKE_Fortran_COMPILER_VERSION}.")
endif()
Expand All @@ -68,7 +68,7 @@ macro(set_fast_fortran)
# Get OS/Compiler specific options
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
set_fast_gfortran()
elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel")
set_fast_intel_fortran()
endif()
endmacro(set_fast_fortran)
Expand Down
6 changes: 3 additions & 3 deletions modules/nwtc-library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ if (CMAKE_BUILD_TYPE MATCHES Debug)
set_source_files_properties(src/NetLib/slatec/NWTC_SLATEC.f90 PROPERTIES COMPILE_FLAGS -frecursive)
set_source_files_properties(src/NetLib/slatec/dqk61.f PROPERTIES COMPILE_FLAGS -frecursive)
set_source_files_properties(src/NetLib/slatec/qk61.f PROPERTIES COMPILE_FLAGS -frecursive)
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel")
if("${CMAKE_Fortran_COMPILER_VERSION}" VERSION_LESS "19")
if (WIN32)
set_source_files_properties(src/NetLib/slatec/NWTC_SLATEC.f90 PROPERTIES COMPILE_FLAGS "/recursive")
Expand Down Expand Up @@ -93,7 +93,7 @@ if(BUILD_OPENFAST_SIMULINK_API)
if (APPLE OR UNIX)
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
set(NWTC_SYS_FILE src/SysMatlabLinuxGnu.f90)
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel")
set(NWTC_SYS_FILE src/SysMatlabLinuxIntel.f90)
endif()
elseif (WIN32)
Expand All @@ -106,7 +106,7 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
elseif (APPLE OR UNIX OR CYGWIN)
set(NWTC_SYS_FILE src/SysGnuLinux.f90)
endif ()
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel")
if (APPLE OR UNIX)
set(NWTC_SYS_FILE src/SysIFL.f90)
elseif (WIN32)
Expand Down
2 changes: 1 addition & 1 deletion share/discon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ endif (NOT CMAKE_BUILD_TYPE)
# set the build flags
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
set_gfortran()
elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel")
set_ifort()
endif()
set(CMAKE_SHARE_LINKER_FLAGS "-shared")
Expand Down

0 comments on commit 92c45b4

Please sign in to comment.