diff options
author | Chuck Atkins <chuck.atkins@kitware.com> | 2020-12-22 20:07:20 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-03-30 14:32:53 (GMT) |
commit | 3c867cff4a98bb198211e3d9f8494fbb478a29e4 (patch) | |
tree | e8fb2a3671d292ff21430df67e95000f20a63bce /Modules/Compiler | |
parent | d5ab6a53edef5f259f9b9446943dcc5113898b51 (diff) | |
download | CMake-3c867cff4a98bb198211e3d9f8494fbb478a29e4.zip CMake-3c867cff4a98bb198211e3d9f8494fbb478a29e4.tar.gz CMake-3c867cff4a98bb198211e3d9f8494fbb478a29e4.tar.bz2 |
Fujitsu: Add support for the Fujitsu compiler in Trad mode
Co-Author: Yuichiro Utsumi <utsumi.yuichiro@jp.fujitsu.com>
Diffstat (limited to 'Modules/Compiler')
-rw-r--r-- | Modules/Compiler/Fujitsu-C.cmake | 20 | ||||
-rw-r--r-- | Modules/Compiler/Fujitsu-CXX.cmake | 47 | ||||
-rw-r--r-- | Modules/Compiler/Fujitsu-DetermineCompiler.cmake | 17 | ||||
-rw-r--r-- | Modules/Compiler/Fujitsu-Fortran.cmake | 16 | ||||
-rw-r--r-- | Modules/Compiler/Fujitsu.cmake | 33 |
5 files changed, 132 insertions, 1 deletions
diff --git a/Modules/Compiler/Fujitsu-C.cmake b/Modules/Compiler/Fujitsu-C.cmake new file mode 100644 index 0000000..0e0f1dc --- /dev/null +++ b/Modules/Compiler/Fujitsu-C.cmake @@ -0,0 +1,20 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. +include(Compiler/Fujitsu) +__compiler_fujitsu(C) + +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4) + set(CMAKE_C89_STANDARD_COMPILE_OPTION -std=c89) + set(CMAKE_C89_EXTENSION_COMPILE_OPTION -std=gnu89) + set(CMAKE_C89_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_C99_STANDARD_COMPILE_OPTION -std=c99) + set(CMAKE_C99_EXTENSION_COMPILE_OPTION -std=gnu99) + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_C11_STANDARD_COMPILE_OPTION -std=c11) + set(CMAKE_C11_EXTENSION_COMPILE_OPTION -std=gnu11) + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) +endif() + +__compiler_check_default_language_standard(C 4 11) diff --git a/Modules/Compiler/Fujitsu-CXX.cmake b/Modules/Compiler/Fujitsu-CXX.cmake new file mode 100644 index 0000000..0f42196 --- /dev/null +++ b/Modules/Compiler/Fujitsu-CXX.cmake @@ -0,0 +1,47 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. +include(Compiler/Fujitsu) +__compiler_fujitsu(CXX) + +#set(CMAKE_PCH_EXTENSION .pch) +#set(CMAKE_PCH_EPILOGUE "#pragma hdrstop") +#set(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH --no_pch_messages -include <PCH_HEADER> --use_pch <PCH_FILE>) +#set(CMAKE_CXX_COMPILE_OPTIONS_CREATE_PCH --no_pch_messages -include <PCH_HEADER> --create_pch <PCH_FILE>) + +# The Fujitsu compiler offers both a 98 and 03 mode. These two are +# essentially interchangeable as 03 simply provides clarity to some 98 +# ambiguyity. +# +# Re: Stroustrup's C++ FAQ: +# What is the difference between C++98 and C++03? +# From a programmer's view there is none. The C++03 revision of the +# standard was a bug fix release for implementers to ensure greater +# consistency and portability. In particular, tutorial and reference +# material describing C++98 and C++03 can be used interchangeably by all +# except compiler writers and standards gurus. +# +# Since CMake doesn't actually have an 03 mode and they're effectively +# interchangeable then we're just going to explicitly use 03 mode in the +# compiler when 98 is requested. + +# The version matching is messy here. The std support seems to be related to +# the compiler tweak version derived from the patch id in the version string. + +if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 4) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -std=c++03) + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -std=gnu++03) + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -std=c++11) + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -std=gnu++11) + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION -std=c++14) + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -std=gnu++14) + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_CXX17_STANDARD_COMPILE_OPTION -std=c++17) + set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION -std=gnu++17) +endif() + +__compiler_check_default_language_standard(CXX 4 14) diff --git a/Modules/Compiler/Fujitsu-DetermineCompiler.cmake b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake index 73ee38c..a8c655d 100644 --- a/Modules/Compiler/Fujitsu-DetermineCompiler.cmake +++ b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake @@ -1,2 +1,17 @@ -set(_compiler_id_pp_test "defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)") +set(_compiler_id_pp_test "defined(__FUJITSU) && !defined(__CLANG_FUJITSU)") + +set(_compiler_id_version_compute " +# if defined(__FCC_version__) +# define @PREFIX@COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__FCC_major__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__FCC_minor__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__fcc_version) +# elif defined(__FCC_VERSION) +# define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__FCC_VERSION) +# endif +") diff --git a/Modules/Compiler/Fujitsu-Fortran.cmake b/Modules/Compiler/Fujitsu-Fortran.cmake new file mode 100644 index 0000000..0f687bc --- /dev/null +++ b/Modules/Compiler/Fujitsu-Fortran.cmake @@ -0,0 +1,16 @@ +include(Compiler/Fujitsu) +__compiler_fujitsu(Fortran) + +set(CMAKE_Fortran_SUBMODULE_SEP ".") +set(CMAKE_Fortran_SUBMODULE_EXT ".smod") + +set(CMAKE_Fortran_PREPROCESS_SOURCE + "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -Cpp -E <SOURCE> > <PREPROCESSED_SOURCE>") +set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-Cpp") + +set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-Fixed") +set(CMAKE_Fortran_FORMAT_FREE_FLAG "-Free") + +string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT "") + +set(CMAKE_Fortran_MODDIR_FLAG "-M ") diff --git a/Modules/Compiler/Fujitsu.cmake b/Modules/Compiler/Fujitsu.cmake new file mode 100644 index 0000000..13bc57c --- /dev/null +++ b/Modules/Compiler/Fujitsu.cmake @@ -0,0 +1,33 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# This module is shared by multiple languages; use include blocker. +if(__COMPILER_FUJITSU) + return() +endif() +set(__COMPILER_FUJITSU 1) + +include(Compiler/CMakeCommonCompilerMacros) + +macro(__compiler_fujitsu lang) + set(CMAKE_${lang}_VERBOSE_FLAG "-###") + + # Initial configuration flags + string(APPEND CMAKE_${lang}_FLAGS_INIT " ") + string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -O0") + string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG") + + # PIC flags + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") + + # Passing link options to the compiler + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",") + + # How to actually call the compiler + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E $<$<COMPILE_LANGUAGE:Fortran>:-Cpp> <SOURCE> > <PREPROCESSED_SOURCE>") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") +endmacro() |