diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeCompilerIdDetection.cmake | 1 | ||||
-rw-r--r-- | Modules/CMakeDetermineASMCompiler.cmake | 4 | ||||
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 5 | ||||
-rw-r--r-- | Modules/CMakeDetermineCXXCompiler.cmake | 5 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 3 | ||||
-rw-r--r-- | Modules/CMakePlatformId.h.in | 8 | ||||
-rw-r--r-- | Modules/Compiler/TIClang-ASM.cmake | 9 | ||||
-rw-r--r-- | Modules/Compiler/TIClang-C-FeatureTests.cmake | 1 | ||||
-rw-r--r-- | Modules/Compiler/TIClang-C.cmake | 23 | ||||
-rw-r--r-- | Modules/Compiler/TIClang-CXX-FeatureTests.cmake | 1 | ||||
-rw-r--r-- | Modules/Compiler/TIClang-CXX.cmake | 25 | ||||
-rw-r--r-- | Modules/Compiler/TIClang-DetermineCompiler.cmake | 10 | ||||
-rw-r--r-- | Modules/Compiler/TIClang.cmake | 30 |
13 files changed, 124 insertions, 1 deletions
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index e4fa43f..2817d37 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -80,6 +80,7 @@ function(compiler_id_detection outvar lang) ARMCC AppleClang ARMClang + TIClang ) list(APPEND ordered_compilers Clang diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index 6d7d17e..2042e64 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -102,6 +102,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI "-h") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI "Texas Instruments") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TIClang ) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TIClang "--version") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TIClang "(TI (.*) Clang Compiler)") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS IAR) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_IAR ) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_IAR "IAR Assembler") diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 8beebc5..73b6cee 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -166,6 +166,11 @@ if (NOT _CMAKE_TOOLCHAIN_PREFIX) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) set(_CMAKE_TOOLCHAIN_SUFFIX ${CMAKE_MATCH_4}) set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_6}) + elseif(CMAKE_C_COMPILER_ID MATCHES "TIClang") + if (COMPILER_BASENAME MATCHES "^(.+)?clang(\\.exe)?$") + set(_CMAKE_TOOLCHAIN_PREFIX "${CMAKE_MATCH_1}") + set(_CMAKE_TOOLCHAIN_SUFFIX "${CMAKE_MATCH_2}") + endif() elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") if(CMAKE_C_COMPILER_TARGET) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-) diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 40934ec..891ba6e 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -171,6 +171,11 @@ if (NOT _CMAKE_TOOLCHAIN_PREFIX) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) set(_CMAKE_TOOLCHAIN_SUFFIX ${CMAKE_MATCH_3}) set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_5}) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "TIClang") + if (COMPILER_BASENAME MATCHES "^(.+)?clang(\\.exe)?$") + set(_CMAKE_TOOLCHAIN_PREFIX "${CMAKE_MATCH_1}") + set(_CMAKE_TOOLCHAIN_SUFFIX "${CMAKE_MATCH_2}") + endif() elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_CXX_COMPILER_TARGET) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 25aacca..1cf1e79 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -280,7 +280,8 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) endif() elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xGNU" OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xAppleClang" - OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xFujitsuClang") + OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xFujitsuClang" + OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xTIClang") set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "GNU") elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC") set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "MSVC") diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index 32b7166..fd0367e 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -219,6 +219,14 @@ # define ARCHITECTURE_ID "" # endif +#elif defined(__clang__) && defined(__ti__) +# if defined(__ARM_ARCH) +# define ARCHITECTURE_ID "Arm" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + #elif defined(__TI_COMPILER_VERSION__) # if defined(__TI_ARM__) # define ARCHITECTURE_ID "ARM" diff --git a/Modules/Compiler/TIClang-ASM.cmake b/Modules/Compiler/TIClang-ASM.cmake new file mode 100644 index 0000000..6bb07e3 --- /dev/null +++ b/Modules/Compiler/TIClang-ASM.cmake @@ -0,0 +1,9 @@ +include(Compiler/TIClang) + +set(CMAKE_ASM_OUTPUT_EXTENSION ".o") +set(CMAKE_ASM_OUTPUT_EXTENSION_REPLACE 1) + +set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -c -o <OBJECT> <SOURCE>") +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS S;s;asm;msa) + +__compiler_ticlang(ASM) diff --git a/Modules/Compiler/TIClang-C-FeatureTests.cmake b/Modules/Compiler/TIClang-C-FeatureTests.cmake new file mode 100644 index 0000000..ef79229 --- /dev/null +++ b/Modules/Compiler/TIClang-C-FeatureTests.cmake @@ -0,0 +1 @@ +include(Compiler/Clang-C-FeatureTests) diff --git a/Modules/Compiler/TIClang-C.cmake b/Modules/Compiler/TIClang-C.cmake new file mode 100644 index 0000000..2721fef --- /dev/null +++ b/Modules/Compiler/TIClang-C.cmake @@ -0,0 +1,23 @@ +include(Compiler/Clang-C) +include(Compiler/TIClang) +__compiler_ticlang(C) + +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_C) + # dependencies are computed by the compiler itself + set(CMAKE_C_DEPFILE_FORMAT gcc) + set(CMAKE_C_DEPENDS_USE_COMPILER TRUE) +endif() + +set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") +set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") +set(CMAKE_C90_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) diff --git a/Modules/Compiler/TIClang-CXX-FeatureTests.cmake b/Modules/Compiler/TIClang-CXX-FeatureTests.cmake new file mode 100644 index 0000000..e038e80 --- /dev/null +++ b/Modules/Compiler/TIClang-CXX-FeatureTests.cmake @@ -0,0 +1 @@ +include(Compiler/Clang-CXX-FeatureTests) diff --git a/Modules/Compiler/TIClang-CXX.cmake b/Modules/Compiler/TIClang-CXX.cmake new file mode 100644 index 0000000..860bb42 --- /dev/null +++ b/Modules/Compiler/TIClang-CXX.cmake @@ -0,0 +1,25 @@ +include(Compiler/Clang-CXX) +include(Compiler/TIClang) +__compiler_ticlang(CXX) + +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_CXX) + # dependencies are computed by the compiler itself + set(CMAKE_CXX_DEPFILE_FORMAT gcc) + set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) +endif() + +set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98") +set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98") +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_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") diff --git a/Modules/Compiler/TIClang-DetermineCompiler.cmake b/Modules/Compiler/TIClang-DetermineCompiler.cmake new file mode 100644 index 0000000..2447fdf --- /dev/null +++ b/Modules/Compiler/TIClang-DetermineCompiler.cmake @@ -0,0 +1,10 @@ +# TI Clang-based Toolchains +set(_compiler_id_pp_test "defined(__clang__) && defined(__ti__)") + +set(_compiler_id_version_compute " + # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ti_major__) + # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ti_minor__) + # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ti_patchlevel__)") + +string(APPEND _compiler_id_version_compute " +# define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__ti_version__)") diff --git a/Modules/Compiler/TIClang.cmake b/Modules/Compiler/TIClang.cmake new file mode 100644 index 0000000..4965e62 --- /dev/null +++ b/Modules/Compiler/TIClang.cmake @@ -0,0 +1,30 @@ +if(__COMPILER_TICLANG) + return() +endif() +set(__COMPILER_TICLANG TRUE) + +include(Compiler/CMakeCommonCompilerMacros) + +# get linker supported cpu list +macro(__compiler_ticlang lang) + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-Xlinker ") + + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") + + set(CMAKE_${lang}_COMPILE_OBJECT "<CMAKE_${lang}_COMPILER> -c <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") + + set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_${lang}_COMPILER> <FLAGS> -Xlinker --output_file=<TARGET> -Xlinker --map_file=<TARGET_NAME>.map -Xlinker --rom_model <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>") + + set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <OBJECTS>") + set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <OBJECTS>") + set(CMAKE_${lang}_ARCHIVE_FINISH "") + + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP) +endmacro() + +set(CMAKE_EXECUTABLE_SUFFIX ".out") +set(CMAKE_LIBRARY_PATH_FLAG "-Wl,--search_path=") +set(CMAKE_LINK_LIBRARY_FLAG "-Wl,--library=") |