summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeCheckCompilerFlagCommonPatterns.cmake2
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake25
-rw-r--r--Modules/CMakeFortranCompilerId.F.in9
-rw-r--r--Modules/CMakeParseImplicitIncludeInfo.cmake15
-rw-r--r--Modules/CMakePlatformId.h.in6
-rw-r--r--Modules/Compiler/Fujitsu-C.cmake20
-rw-r--r--Modules/Compiler/Fujitsu-CXX.cmake47
-rw-r--r--Modules/Compiler/Fujitsu-DetermineCompiler.cmake17
-rw-r--r--Modules/Compiler/Fujitsu-Fortran.cmake16
-rw-r--r--Modules/Compiler/Fujitsu.cmake33
-rw-r--r--Modules/Platform/Linux-Fujitsu-CXX.cmake8
-rw-r--r--Modules/Platform/Linux-Fujitsu.cmake17
12 files changed, 210 insertions, 5 deletions
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
index 2dc75d6..05174de 100644
--- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
+++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
@@ -8,7 +8,7 @@
macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
set(${_VAR}
- FAIL_REGEX "[Uu]nrecogni[sz]ed .*option" # GNU, NAG
+ FAIL_REGEX "[Uu]nrecogni[sz]ed .*option" # GNU, NAG, Fujitsu
FAIL_REGEX "switch .* is no longer supported" # GNU
FAIL_REGEX "unknown .*option" # Clang
FAIL_REGEX "optimization flag .* not supported" # Clang
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index f406e5a..017c51a 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -165,6 +165,25 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endif()
endif()
+ # The Fujitsu compiler does not always convey version information through
+ # preprocessor symbols so we extract through command line info
+ if (CMAKE_${lang}_COMPILER_ID STREQUAL "Fujitsu")
+ if(NOT CMAKE_${lang}_COMPILER_VERSION)
+ execute_process(
+ COMMAND "${CMAKE_${lang}_COMPILER}" -V
+ OUTPUT_VARIABLE output
+ ERROR_VARIABLE output
+ RESULT_VARIABLE result
+ TIMEOUT 10
+ )
+ if (result EQUAL 0)
+ if (output MATCHES [[Fujitsu [^ ]* Compiler ([0-9]+\.[0-9]+\.[0-9]+)]])
+ set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_MATCH_1}")
+ endif()
+ endif()
+ endif()
+ endif()
+
# if the format is unknown after all files have been checked, put "Unknown" in the cache
if(NOT CMAKE_EXECUTABLE_FORMAT)
set(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format")
@@ -830,8 +849,10 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}")
endif()
if("${info}" MATCHES "INFO:compiler_version_internal\\[([^]\"]*)\\]")
- string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION_INTERNAL "${CMAKE_MATCH_1}")
- string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION_INTERNAL "${COMPILER_VERSION_INTERNAL}")
+ set(COMPILER_VERSION_INTERNAL "${CMAKE_MATCH_1}")
+ string(REGEX REPLACE "^0+([0-9]+)" "\\1" COMPILER_VERSION_INTERNAL "${COMPILER_VERSION_INTERNAL}")
+ string(REGEX REPLACE "\\.0+([0-9]+)" ".\\1" COMPILER_VERSION_INTERNAL "${COMPILER_VERSION_INTERNAL}")
+ string(STRIP "${COMPILER_VERSION_INTERNAL}" COMPILER_VERSION_INTERNAL)
endif()
foreach(comp MAJOR MINOR PATCH TWEAK)
foreach(digit 1 2 3 4 5 6 7 8 9)
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
index 0a3db4c..0b92b6a 100644
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -136,6 +136,15 @@
#define COMPILER_VERSION_MAJOR DEC(__NAG_COMPILER_RELEASE/10)
#define COMPILER_VERSION_MINOR DEC(__NAG_COMPILER_RELEASE % 10)
#define COMPILER_VERSION_PATCH DEC(__NAG_COMPILER_BUILD)
+#elif defined(__FUJITSU)
+ PRINT *, 'INFO:compiler[Fujitsu]'
+# if defined(__FRT_major__)
+# define COMPILER_VERSION_MAJOR DEC(__FRT_major__)
+# define COMPILER_VERSION_MINOR DEC(__FRT_minor__)
+# define COMPILER_VERSION_PATCH DEC(__FRT_patchlevel__)
+# elif defined(__FRT_version__)
+ PRINT *, 'INFO:compiler_version['//__FRT_version__//']'
+# endif
#else
PRINT *, 'INFO:compiler[]'
#endif
diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake
index 7cd7548..a8e6ac0 100644
--- a/Modules/CMakeParseImplicitIncludeInfo.cmake
+++ b/Modules/CMakeParseImplicitIncludeInfo.cmake
@@ -146,6 +146,21 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var)
endif()
endif()
+ # Fujitsu compiler
+ if(CMAKE_${lang}_COMPILER_ID STREQUAL "Fujitsu" AND
+ line MATCHES "/ccpcom")
+ string(REGEX MATCHALL " (-I *|--sys_include=|--preinclude +)(\"[^\"]+\"|[^ \"]+)" incs "${line}")
+ foreach(inc IN LISTS incs)
+ string(REGEX REPLACE " (-I *|--sys_include=|--preinclude +)(\"[^\"]+\"|[^ \"]+)" "\\2" idir "${inc}")
+ list(APPEND rv "${idir}")
+ endforeach()
+ if(rv)
+ string(APPEND log " got implicit includes via fujitsu ccpcom parser!\n")
+ else()
+ string(APPEND log " warning: fujitsu ccpcom parse failed!\n")
+ endif()
+ endif()
+
if(log)
set(${log_var} "${log}" PARENT_SCOPE)
else()
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index 1dc12c0..3ae9f49 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -256,8 +256,12 @@
('0' + ((n)>>4 & 0xF)), \
('0' + ((n) & 0xF))
+/* Construct a string literal encoding the version number. */
+#ifdef COMPILER_VERSION
+char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
+
/* Construct a string literal encoding the version number components. */
-#ifdef COMPILER_VERSION_MAJOR
+#elif defined(COMPILER_VERSION_MAJOR)
char const info_version[] = {
'I', 'N', 'F', 'O', ':',
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
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()
diff --git a/Modules/Platform/Linux-Fujitsu-CXX.cmake b/Modules/Platform/Linux-Fujitsu-CXX.cmake
new file mode 100644
index 0000000..d72dd49
--- /dev/null
+++ b/Modules/Platform/Linux-Fujitsu-CXX.cmake
@@ -0,0 +1,8 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details
+
+include(Platform/Linux-Fujitsu)
+__linux_compiler_fujitsu(CXX)
+
+# Special sauce to propagate the -std=xxx flag when linking
+set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION ON)
diff --git a/Modules/Platform/Linux-Fujitsu.cmake b/Modules/Platform/Linux-Fujitsu.cmake
new file mode 100644
index 0000000..be11b0a
--- /dev/null
+++ b/Modules/Platform/Linux-Fujitsu.cmake
@@ -0,0 +1,17 @@
+# 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(__LINUX_COMPILER_FUJITSU)
+ return()
+endif()
+set(__LINUX_COMPILER_FUJITSU 1)
+
+macro(__linux_compiler_fujitsu lang)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+endmacro()