summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake-compile-features.7.rst2
-rw-r--r--Modules/Compiler/TI-C.cmake67
-rw-r--r--Modules/Compiler/TI-CXX.cmake69
-rw-r--r--Modules/Compiler/TI.cmake17
4 files changed, 142 insertions, 13 deletions
diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst
index 05dc038..690d293 100644
--- a/Help/manual/cmake-compile-features.7.rst
+++ b/Help/manual/cmake-compile-features.7.rst
@@ -358,6 +358,7 @@ versions specified for each:
* ``Cray``: Cray Compiler Environment version 8.1+.
* ``PGI``: PGI version 12.10+.
+* ``TI``: Texas Instruments compiler.
* ``XL``: IBM XL version 10.1+.
CMake is currently aware of the :prop_tgt:`C standards <C_STANDARD>` and
@@ -366,7 +367,6 @@ following :variable:`compiler ids <CMAKE_<LANG>_COMPILER_ID>` as of the
versions specified for each:
* all compilers and versions listed above with only meta-features for C++.
-* ``TI``: Texas Instruments compiler.
CMake is currently aware of the :prop_tgt:`CUDA standards <CUDA_STANDARD>` and
their associated meta-features (e.g. ``cuda_std_11``) available from the
diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake
index 8ea01b5..3c97afb 100644
--- a/Modules/Compiler/TI-C.cmake
+++ b/Modules/Compiler/TI-C.cmake
@@ -1,8 +1,67 @@
include(Compiler/TI)
__compiler_ti(C)
-set(CMAKE_C90_STANDARD_COMPILE_OPTION "--c89")
-set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--c89 --relaxed_ansi")
+# Architecture specific
+# C99 versions: https://processors.wiki.ti.com/index.php/C99_Support_in_TI_Compilers
-set(CMAKE_C99_STANDARD_COMPILE_OPTION "--c99")
-set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--c99 --relaxed_ansi")
+if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
+ set(__COMPILER_TI_C99_VERSION_ARM 5.2)
+ set(__COMPILER_TI_C11_VERSION_ARM 18.12)
+
+elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430")
+ set(__COMPILER_TI_C99_VERSION_MSP430 4.3)
+ set(__COMPILER_TI_C11_VERSION_MSP430 18.12)
+
+elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "TMS320C28x")
+ set(__COMPILER_TI_C99_VERSION_TMS320C28x 6.3)
+ set(__COMPILER_TI_C11_VERSION_TMS320C28x 18.9)
+
+elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "TMS320C6x")
+ set(__COMPILER_TI_C99_VERSION_TMS320C6x 7.5)
+
+else()
+ # architecture not handled
+ return()
+
+endif()
+
+
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C99_VERSION_${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}}")
+
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "--c89" "--strict_ansi")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--c89" "--relaxed_ansi")
+
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "--c99" "--strict_ansi")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--c99" "--relaxed_ansi")
+
+ if(DEFINED __COMPILER_TI_C11_VERSION_${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} AND
+ CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C11_VERSION_${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}}")
+
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "--c11" "--strict_ansi")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "--c11" "--relaxed_ansi")
+
+ endif()
+
+else()
+
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "--strict_ansi")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--relaxed_ansi")
+
+endif()
+
+
+# Architecture specific
+
+if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
+ __compiler_check_default_language_standard(C 2.0 90)
+
+elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430")
+ __compiler_check_default_language_standard(C 3.0 90)
+
+elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "TMS320C28x")
+ __compiler_check_default_language_standard(C 4.1 90)
+
+elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "TMS320C6x")
+ __compiler_check_default_language_standard(C 4.45 90)
+
+endif()
diff --git a/Modules/Compiler/TI-CXX.cmake b/Modules/Compiler/TI-CXX.cmake
index c08d9a1..4b6efcd 100644
--- a/Modules/Compiler/TI-CXX.cmake
+++ b/Modules/Compiler/TI-CXX.cmake
@@ -1,2 +1,71 @@
include(Compiler/TI)
__compiler_ti(CXX)
+
+# Architecture specific
+
+if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
+ set(__COMPILER_TI_CXX03_VERSION 5.2)
+ set(__COMPILER_TI_CXX14_VERSION 18.1)
+
+elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430")
+ set(__COMPILER_TI_CXX03_VERSION 4.4)
+ set(__COMPILER_TI_CXX14_VERSION 18.1)
+
+elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "TMS320C28x")
+ set(__COMPILER_TI_CXX03_VERSION 16.9)
+
+elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "TMS320C6x")
+ set(__COMPILER_TI_CXX03_VERSION 8.1)
+ set(__COMPILER_TI_CXX14_VERSION 8.3)
+
+else()
+ # architecture not handled
+ return()
+
+endif()
+
+
+if(DEFINED __COMPILER_TI_CXX14_VERSION AND
+ CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_CXX14_VERSION}")
+
+ # C++03 is not supported anymore
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "--strict_ansi")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "--relaxed_ansi")
+
+ # C++11 was never supported
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "--strict_ansi")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "--relaxed_ansi")
+
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "--c++14" "--strict_ansi")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "--c++14" "--relaxed_ansi")
+
+
+elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_CXX03_VERSION}")
+
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "--c++03" "--strict_ansi")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "--c++03" "--relaxed_ansi")
+
+else()
+
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "--strict_ansi")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "--relaxed_ansi")
+
+endif()
+
+
+# Architecture specific
+# CXX98 versions: https://processors.wiki.ti.com/index.php/C%2B%2B_Support_in_TI_Compilers
+
+if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
+ __compiler_check_default_language_standard(CXX 4.5 98 ${__COMPILER_TI_CXX14_VERSION} 14)
+
+elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430")
+ __compiler_check_default_language_standard(CXX 3.0 98 ${__COMPILER_TI_CXX14_VERSION} 14)
+
+elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "TMS320C28x")
+ __compiler_check_default_language_standard(CXX 5.1 98)
+
+elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "TMS320C6x")
+ __compiler_check_default_language_standard(CXX 6.1 98 ${__COMPILER_TI_CXX14_VERSION} 14)
+
+endif()
diff --git a/Modules/Compiler/TI.cmake b/Modules/Compiler/TI.cmake
index 9f2e813..f631688 100644
--- a/Modules/Compiler/TI.cmake
+++ b/Modules/Compiler/TI.cmake
@@ -8,21 +8,22 @@ if(__COMPILER_TI)
endif()
set(__COMPILER_TI 1)
-macro(__compiler_ti lang)
- string(TOLOWER ${lang} prefix)
- if("x${lang}" STREQUAL "xCXX")
- set(prefix "cpp")
- endif()
+include(Compiler/CMakeCommonCompilerMacros)
+
+set(__COMPILER_TI_SOURCE_FLAG_C "--c_file")
+set(__COMPILER_TI_SOURCE_FLAG_CXX "--cpp_file")
+set(__COMPILER_TI_SOURCE_FLAG_ASM "--asm_file")
+macro(__compiler_ti lang)
set(CMAKE_${lang}_RESPONSE_FILE_FLAG "--cmd_file=")
set(CMAKE_INCLUDE_FLAG_${lang} "--include_path=")
set(CMAKE_DEPFILE_FLAGS_${lang} "--preproc_with_compile --preproc_dependency=<DEPFILE>")
- set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> --preproc_only --${prefix}_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
- set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> --compile_only --skip_assembler --${prefix}_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
+ set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> --preproc_only ${__COMPILER_TI_SOURCE_FLAG_${lang}}=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
+ set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> --compile_only --skip_assembler ${__COMPILER_TI_SOURCE_FLAG_${lang}}=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
- set(CMAKE_${lang}_COMPILE_OBJECT "<CMAKE_${lang}_COMPILER> --compile_only --${prefix}_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<OBJECT>")
+ set(CMAKE_${lang}_COMPILE_OBJECT "<CMAKE_${lang}_COMPILER> --compile_only ${__COMPILER_TI_SOURCE_FLAG_${lang}}=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<OBJECT>")
set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> qr <TARGET> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> qa <TARGET> <OBJECTS>")