浏览代码

IntelLLVM: Add special case for ifx 2021.1 version extraction

The ifx beta versions forgot to define `__INTEL_LLVM_COMPILER`, and
instead define `__INTEL_COMPILER == 201900`.  Add a special case.

Issue: #22120
Brad King 4 年之前
父节点
当前提交
9c479c7c40
共有 2 个文件被更改,包括 16 次插入5 次删除
  1. 8 5
      Help/release/3.20.rst
  2. 8 0
      Modules/CMakeFortranCompilerId.F.in

+ 8 - 5
Help/release/3.20.rst

@@ -47,11 +47,7 @@ Compilers
   * The ``icx``/``icpx`` C/C++ compilers on Linux, and the ``icx``
   * The ``icx``/``icpx`` C/C++ compilers on Linux, and the ``icx``
     C/C++ compiler on Windows, are fully supported as of oneAPI 2021.1.
     C/C++ compiler on Windows, are fully supported as of oneAPI 2021.1.
 
 
-  * The ``ifx`` Fortran compiler on Linux is partially supported.
-    As of oneAPI 2021.1, ``ifx`` does not define several identification
-    macros, so CMake identifies it as the classic ``Intel`` compiler.
-    This works in many cases because ``ifx`` accepts the same command line
-    parameters as ``ifort``.  A future version of oneAPI may fix this.
+  * The ``ifx`` Fortran compiler on Linux is supported as of oneAPI 2021.1.
 
 
   * The ``ifx`` Fortran compiler on Windows is not yet supported.
   * The ``ifx`` Fortran compiler on Windows is not yet supported.
 
 
@@ -359,3 +355,10 @@ Changes made since CMake 3.20.0 include the following.
   as having major version 2021.  CMake 3.20.1 and below were not aware of a
   as having major version 2021.  CMake 3.20.1 and below were not aware of a
   change to the identification macro version scheme made by Intel starting
   change to the identification macro version scheme made by Intel starting
   in version 2021, and detected the version as 20.2.
   in version 2021, and detected the version as 20.2.
+
+* The Intel oneAPI Fortran compiler is now identified as ``IntelLLVM``.
+  The oneAPI 2021.1 Fortran compiler is missing an identification macro,
+  so CMake 3.20.1 and below identified it as ``Intel``.  CMake now has
+  a special case to recognize oneAPI 2021.1 Fortran as ``IntelLLVM``.
+  The oneAPI 2021.2 Fortran compiler defines the proper identification
+  macro and so is identified as ``IntelLLVM`` by all CMake 3.20 versions.

+ 8 - 0
Modules/CMakeFortranCompilerId.F.in

@@ -36,6 +36,14 @@
 #  define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
 #  define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
 #  define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER     % 100)
 #  define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER     % 100)
 # endif
 # endif
+#elif defined(__INTEL_COMPILER) && __INTEL_COMPILER == 201900
+        PRINT *, 'INFO:compiler[IntelLLVM]'
+! ifx 2021.1 forgot to define __INTEL_LLVM_COMPILER.
+! Instead it defines __INTEL_COMPILER == 201900.
+# define COMPILER_VERSION_MAJOR DEC(2021)
+# define COMPILER_VERSION_MINOR DEC(1)
+# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
+# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
 #elif defined(__INTEL_COMPILER) || defined(__ICC)
 #elif defined(__INTEL_COMPILER) || defined(__ICC)
         PRINT *, 'INFO:compiler[Intel]'
         PRINT *, 'INFO:compiler[Intel]'
 ! __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later.
 ! __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later.