diff options
author | Brad King <brad.king@kitware.com> | 2022-05-26 12:51:48 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-05-26 12:52:02 (GMT) |
commit | 711496b67249b5910bf06c491cf292c6accf7e6d (patch) | |
tree | 68d85e6a600143685bf1590ba5347f86583032b9 | |
parent | 35d975fe4a5726ab901742f30ef53a6551adef43 (diff) | |
parent | 85749766dff084e433f05b23f9b93c28704ab014 (diff) | |
download | CMake-711496b67249b5910bf06c491cf292c6accf7e6d.zip CMake-711496b67249b5910bf06c491cf292c6accf7e6d.tar.gz CMake-711496b67249b5910bf06c491cf292c6accf7e6d.tar.bz2 |
Merge topic 'LLVMFlang-compiler'
85749766df LLVMFlang: Add support for LLVM Flang
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7246
-rw-r--r-- | Help/release/dev/LLVMFlang-compiler.rst | 6 | ||||
-rw-r--r-- | Help/variable/CMAKE_LANG_COMPILER_ID.rst | 3 | ||||
-rw-r--r-- | Modules/CMakeDetermineFortranCompiler.cmake | 1 | ||||
-rw-r--r-- | Modules/CMakeFortranCompilerId.F.in | 7 | ||||
-rw-r--r-- | Modules/Compiler/LLVMFlang-Fortran.cmake | 13 |
5 files changed, 29 insertions, 1 deletions
diff --git a/Help/release/dev/LLVMFlang-compiler.rst b/Help/release/dev/LLVMFlang-compiler.rst new file mode 100644 index 0000000..1d29449 --- /dev/null +++ b/Help/release/dev/LLVMFlang-compiler.rst @@ -0,0 +1,6 @@ +LLVMFlang-compiler +------------------ + +* LLVM's `flang`_ Fortran compiler is now supported, with compiler id ``LLVMFlang``. + +.. _`flang`: https://github.com/llvm/llvm-project/tree/main/flang diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst index cd7d5cd..6a0a1d9 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst @@ -18,7 +18,8 @@ include: Clang = LLVM Clang (clang.llvm.org) Cray = Cray Compiler (cray.com) Embarcadero, Borland = Embarcadero (embarcadero.com) - Flang = Flang LLVM Fortran Compiler + Flang = Classic Flang Fortran Compiler (https://github.com/flang-compiler/flang) + LLVMFlang = LLVM Flang Fortran Compiler (https://github.com/llvm/llvm-project/tree/main/flang) Fujitsu = Fujitsu HPC compiler (Trad mode) FujitsuClang = Fujitsu HPC compiler (Clang mode) G95 = G95 Fortran (g95.org) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 1c4b6ea..650c87a 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -91,6 +91,7 @@ else() set(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77) set(_Fortran_COMPILER_NAMES_PGI pgf95 pgfortran pgf90 pgf77) set(_Fortran_COMPILER_NAMES_Flang flang) + set(_Fortran_COMPILER_NAMES_LLVMFlang flang) set(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90) set(_Fortran_COMPILER_NAMES_XL xlf) set(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 969c841..f5c2ab5 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -154,6 +154,13 @@ # if defined(__FLANG_PATCHLEVEL__) # define COMPILER_VERSION_PATCH DEC(__FLANG_PATCHLEVEL__) # endif +#elif defined(__flang__) + PRINT *, 'INFO:compiler[LLVMFlang]' +# define COMPILER_VERSION_MAJOR DEC(__flang_major__) +# define COMPILER_VERSION_MINOR DEC(__flang_minor__) +# if defined(__flang_patchlevel__) +# define COMPILER_VERSION_PATCH DEC(__flang_patchlevel__) +# endif #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) PRINT *, 'INFO:compiler[VisualAge]' #elif defined(__hpux) || defined(__hpux__) diff --git a/Modules/Compiler/LLVMFlang-Fortran.cmake b/Modules/Compiler/LLVMFlang-Fortran.cmake new file mode 100644 index 0000000..7e9ba5e --- /dev/null +++ b/Modules/Compiler/LLVMFlang-Fortran.cmake @@ -0,0 +1,13 @@ +set(CMAKE_Fortran_SUBMODULE_SEP "-") +set(CMAKE_Fortran_SUBMODULE_EXT ".mod") + +set(CMAKE_Fortran_PREPROCESS_SOURCE + "<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + +set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form") +set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form") + +set(CMAKE_Fortran_MODDIR_FLAG "-module-dir") + +set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp") +set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nocpp") |