From 90c6156aa8272ec9811647d9b6c87d7ee4326e35 Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Tue, 5 Feb 2019 11:48:00 -0500 Subject: XLClang: Add a new compiler ID for the clang-based XL compiler --- Modules/CMakeCompilerIdDetection.cmake | 1 + Modules/Compiler/XLClang-C-DetermineCompiler.cmake | 8 ++++++++ Modules/Compiler/XLClang-C.cmake | 17 +++++++++++++++++ .../Compiler/XLClang-CXX-DetermineCompiler.cmake | 8 ++++++++ Modules/Compiler/XLClang-CXX.cmake | 20 ++++++++++++++++++++ Modules/Compiler/XLClang.cmake | 22 ++++++++++++++++++++++ Modules/Platform/AIX-XLClang-C.cmake | 2 ++ Modules/Platform/AIX-XLClang-CXX.cmake | 2 ++ Modules/Platform/AIX-XLClang.cmake | 15 +++++++++++++++ 9 files changed, 95 insertions(+) create mode 100644 Modules/Compiler/XLClang-C-DetermineCompiler.cmake create mode 100644 Modules/Compiler/XLClang-C.cmake create mode 100644 Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake create mode 100644 Modules/Compiler/XLClang-CXX.cmake create mode 100644 Modules/Compiler/XLClang.cmake create mode 100644 Modules/Platform/AIX-XLClang-C.cmake create mode 100644 Modules/Platform/AIX-XLClang-CXX.cmake create mode 100644 Modules/Platform/AIX-XLClang.cmake diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index 7039b8d..96a14f7 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -57,6 +57,7 @@ function(compiler_id_detection outvar lang) HP Compaq zOS + XLClang XL VisualAge PGI diff --git a/Modules/Compiler/XLClang-C-DetermineCompiler.cmake b/Modules/Compiler/XLClang-C-DetermineCompiler.cmake new file mode 100644 index 0000000..4d89921 --- /dev/null +++ b/Modules/Compiler/XLClang-C-DetermineCompiler.cmake @@ -0,0 +1,8 @@ +set(_compiler_id_pp_test "defined(__ibmxl__) && defined(__clang__)") + +set(_compiler_id_version_compute " +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__) +# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__) +") diff --git a/Modules/Compiler/XLClang-C.cmake b/Modules/Compiler/XLClang-C.cmake new file mode 100644 index 0000000..8e8fcf2 --- /dev/null +++ b/Modules/Compiler/XLClang-C.cmake @@ -0,0 +1,17 @@ +include(Compiler/XLClang) +__compiler_xlclang(C) + +if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) + set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") + set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89") + set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x") + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") + endif () +endif() + +__compiler_check_default_language_standard(C 13.1.1 99) diff --git a/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake b/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake new file mode 100644 index 0000000..4d89921 --- /dev/null +++ b/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake @@ -0,0 +1,8 @@ +set(_compiler_id_pp_test "defined(__ibmxl__) && defined(__clang__)") + +set(_compiler_id_version_compute " +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__) +# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__) +") diff --git a/Modules/Compiler/XLClang-CXX.cmake b/Modules/Compiler/XLClang-CXX.cmake new file mode 100644 index 0000000..f535ebc --- /dev/null +++ b/Modules/Compiler/XLClang-CXX.cmake @@ -0,0 +1,20 @@ +include(Compiler/XLClang) +__compiler_xlclang(CXX) + +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") + endif () +endif() + +__compiler_check_default_language_standard(CXX 13.1.1 98) + +set(CMAKE_CXX_COMPILE_OBJECT + " -x c++ -o -c ") diff --git a/Modules/Compiler/XLClang.cmake b/Modules/Compiler/XLClang.cmake new file mode 100644 index 0000000..cdf0fdc --- /dev/null +++ b/Modules/Compiler/XLClang.cmake @@ -0,0 +1,22 @@ +# 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_XLCLANG) + return() +endif() +set(__COMPILER_XLCLANG 1) + +include(Compiler/XL) + +macro(__compiler_xlclang lang) + __compiler_xl(${lang}) + + # Feature flags. + set(CMAKE_${lang}_VERBOSE_FLAG "-V") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIC") + set(CMAKE_${lang}_RESPONSE_FILE_FLAG "@") + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@") +endmacro() diff --git a/Modules/Platform/AIX-XLClang-C.cmake b/Modules/Platform/AIX-XLClang-C.cmake new file mode 100644 index 0000000..f0bedc5 --- /dev/null +++ b/Modules/Platform/AIX-XLClang-C.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-XLClang) +__aix_compiler_xlclang(C) diff --git a/Modules/Platform/AIX-XLClang-CXX.cmake b/Modules/Platform/AIX-XLClang-CXX.cmake new file mode 100644 index 0000000..cceb576 --- /dev/null +++ b/Modules/Platform/AIX-XLClang-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-XLClang) +__aix_compiler_xlclang(CXX) diff --git a/Modules/Platform/AIX-XLClang.cmake b/Modules/Platform/AIX-XLClang.cmake new file mode 100644 index 0000000..c932095 --- /dev/null +++ b/Modules/Platform/AIX-XLClang.cmake @@ -0,0 +1,15 @@ +# 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(__AIX_COMPILER_XLCLANG) + return() +endif() +set(__AIX_COMPILER_XLCLANG 1) + +include(Platform/AIX-XL) + +macro(__aix_compiler_xlclang lang) + __aix_compiler_xl(${lang}) +endmacro() -- cgit v0.12