mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 19:00:54 -06:00
Diab: Add WindRiver Systems's Diab C/C++ toolchain
Teach CMake to recognize Diab versions 5.9.x.x and above. Closes: #26666
This commit is contained in:
8
Help/release/dev/diab-compiler-support.rst
Normal file
8
Help/release/dev/diab-compiler-support.rst
Normal file
@@ -0,0 +1,8 @@
|
||||
diab-compiler-support
|
||||
---------------------
|
||||
|
||||
* `Diab compilers from Wind River Systems`_, versions 5.9.x+, are now
|
||||
supported with :variable:`compiler id <CMAKE_<LANG>_COMPILER_ID>` ``Diab``
|
||||
for languages ``ASM``, ``C``, and ``CXX``.
|
||||
|
||||
.. _`Diab compilers from Wind River Systems`: https://www.windriver.com/resource/wind-river-diab-compiler-product-overview
|
||||
@@ -19,6 +19,7 @@ Value Name
|
||||
``Clang`` `LLVM Clang`_
|
||||
``Cray`` Cray Compiler
|
||||
``CrayClang`` Cray Clang-based Compiler
|
||||
``Diab`` `Wind River Systems Diab Compiler`_
|
||||
``Embarcadero``, ``Borland`` `Embarcadero`_
|
||||
``Flang`` `Classic Flang Fortran Compiler`_
|
||||
``LLVMFlang`` `LLVM Flang Fortran Compiler`_
|
||||
@@ -71,3 +72,4 @@ languages.
|
||||
.. _Tiny C Compiler: https://bellard.org/tcc
|
||||
.. _Tasking Compiler Toolsets: https://www.tasking.com
|
||||
.. _Texas Instruments Clang-based Compilers: https://www.ti.com/tool/download/ARM-CGT-CLANG
|
||||
.. _Wind River Systems Diab Compiler: https://www.windriver.com/resource/wind-river-diab-compiler-product-overview
|
||||
|
||||
@@ -89,6 +89,7 @@ function(compiler_id_detection outvar lang)
|
||||
MSVC
|
||||
ADSP
|
||||
IAR
|
||||
Diab
|
||||
)
|
||||
if ("x${lang}" STREQUAL "xC")
|
||||
list(APPEND ordered_compilers
|
||||
|
||||
@@ -110,6 +110,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_IAR )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_IAR "IAR Assembler")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Diab)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Diab "-V" )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Diab "Wind River Systems")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS ARMCC)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ARMCC )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMCC "(ARM Compiler)|(ARM Assembler)|(Arm Compiler)")
|
||||
|
||||
3
Modules/Compiler/Diab-ASM.cmake
Normal file
3
Modules/Compiler/Diab-ASM.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
include(Compiler/Diab)
|
||||
|
||||
__compiler_diab(ASM)
|
||||
9
Modules/Compiler/Diab-C.cmake
Normal file
9
Modules/Compiler/Diab-C.cmake
Normal file
@@ -0,0 +1,9 @@
|
||||
include(Compiler/Diab)
|
||||
|
||||
__compiler_diab(C)
|
||||
|
||||
# c89/90 is both -Xdialect-c89
|
||||
set(CMAKE_C89_STANDARD_COMPILE_OPTION "-Xdialect-c89")
|
||||
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-Xdialect-c89")
|
||||
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-Xdialect-c99")
|
||||
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-Xdialect-c11")
|
||||
12
Modules/Compiler/Diab-CXX.cmake
Normal file
12
Modules/Compiler/Diab-CXX.cmake
Normal file
@@ -0,0 +1,12 @@
|
||||
include(Compiler/Diab)
|
||||
|
||||
__compiler_diab(CXX)
|
||||
|
||||
# Diab C++98 is named as -Xdialect-c++03
|
||||
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-Xdialect-c++03")
|
||||
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-Xdialect-c++11")
|
||||
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-Xdialect-c++14")
|
||||
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-Xdialect-c++17")
|
||||
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-Xdialect-c++20")
|
||||
|
||||
__compiler_check_default_language_standard(CXX 4.0 98 5.0 11)
|
||||
10
Modules/Compiler/Diab-DetermineCompiler.cmake
Normal file
10
Modules/Compiler/Diab-DetermineCompiler.cmake
Normal file
@@ -0,0 +1,10 @@
|
||||
# Diab Toolchain. Works only for versions 5.9.x or higher.
|
||||
set(_compiler_id_pp_test "defined(__DCC__) && defined(_DIAB_TOOL)")
|
||||
|
||||
set(_compiler_id_version_compute "
|
||||
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__VERSION_MAJOR_NUMBER__)
|
||||
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__VERSION_MINOR_NUMBER__)
|
||||
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__VERSION_ARCH_FEATURE_NUMBER__)
|
||||
# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__VERSION_BUG_FIX_NUMBER__)
|
||||
"
|
||||
)
|
||||
15
Modules/Compiler/Diab-FindBinUtils.cmake
Normal file
15
Modules/Compiler/Diab-FindBinUtils.cmake
Normal file
@@ -0,0 +1,15 @@
|
||||
# Find the archiver for the compiler architecture, which is always in the same
|
||||
# directory as the compiler.
|
||||
if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL "")
|
||||
message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set")
|
||||
endif()
|
||||
|
||||
get_filename_component(__diab_path "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" DIRECTORY)
|
||||
|
||||
find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR
|
||||
NAMES dar
|
||||
HINTS ${__diab_path}
|
||||
NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH
|
||||
DOC "Diab Archiver"
|
||||
)
|
||||
mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR)
|
||||
33
Modules/Compiler/Diab.cmake
Normal file
33
Modules/Compiler/Diab.cmake
Normal file
@@ -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_Diab)
|
||||
return()
|
||||
endif()
|
||||
set(__COMPILER_Diab 1)
|
||||
|
||||
include(Compiler/CMakeCommonCompilerMacros)
|
||||
|
||||
macro(__compiler_diab lang)
|
||||
set(CMAKE_${lang}_VERBOSE_FLAG "-#")
|
||||
set(CMAKE_${lang}_OUTPUT_EXTENSION ".o")
|
||||
|
||||
string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
|
||||
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
|
||||
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -O -Xsize-opt")
|
||||
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -XO")
|
||||
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -XO -g3")
|
||||
|
||||
set(__DIAB_AR "${CMAKE_${lang}_COMPILER_AR}")
|
||||
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "\"${__DIAB_AR}\" -r <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_${lang}_ARCHIVE_CREATE "\"${__DIAB_AR}\" -r <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
|
||||
set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
|
||||
set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
|
||||
set(CMAKE_${lang}_COMPILE_OPTIONS_IPO -XO -Xwhole-program-optim)
|
||||
endmacro()
|
||||
|
||||
set(CMAKE_EXECUTABLE_SUFFIX "")
|
||||
set(CMAKE_LIBRARY_PATH_TERMINATOR "")
|
||||
set(CMAKE_LIBRARY_PATH_FLAG "")
|
||||
Reference in New Issue
Block a user