2020-07-03 12:13:49 +02:00
# SPDX-License-Identifier: Apache-2.0
# Configures CMake for using ccac
2023-05-26 14:23:35 +02:00
find_program ( CMAKE_DTS_PREPROCESSOR ${ ZEPHYR_SDK_CROSS_COMPILE } gcc PATHS ${ ZEPHYR_SDK_INSTALL_DIR } NO_DEFAULT_PATH )
message ( STATUS "Found dts preprocessor: ${CMAKE_DTS_PREPROCESSOR} (Zephyr SDK ${SDK_VERSION})" )
2020-09-03 13:57:45 +02:00
2022-04-26 14:58:24 +02:00
find_program ( CMAKE_C_COMPILER ${ CROSS_COMPILE } ccac PATHS ${ TOOLCHAIN_HOME } NO_DEFAULT_PATH )
find_program ( CMAKE_LLVM_COV ${ CROSS_COMPILE } llvm-cov PATHS ${ TOOLCHAIN_HOME } NO_DEFAULT_PATH )
2021-08-28 00:57:15 +02:00
set ( CMAKE_GCOV "${CMAKE_LLVM_COV} gcov" )
2020-07-03 12:13:49 +02:00
if ( CMAKE_C_COMPILER STREQUAL CMAKE_C_COMPILER-NOTFOUND )
message ( FATAL_ERROR "Zephyr was unable to find the Metaware compiler" )
endif ( )
execute_process (
C O M M A N D $ { C M A K E _ C _ C O M P I L E R } - - v e r s i o n
R E S U L T _ V A R I A B L E r e t
2022-09-13 10:01:11 +02:00
O U T P U T _ V A R I A B L E f u l l _ v e r s i o n _ o u t p u t
2020-07-03 12:13:49 +02:00
)
if ( ret )
message ( FATAL_ERROR " Executing the below command failed. Are permissions set correctly?
2023-12-01 00:55:26 +01:00
' $ { C M A K E _ C _ C O M P I L E R } - - v e r s i o n '
$ { f u l l _ v e r s i o n _ o u t p u t } "
2020-07-03 12:13:49 +02:00
)
2022-09-13 10:01:11 +02:00
else ( )
2022-11-26 19:41:43 +01:00
set ( ARCMWDT_MIN_REQUIRED_VERS "2022.09" )
2022-09-13 10:01:11 +02:00
#
2022-10-26 12:43:51 +02:00
# Regular version has format: "T-2022.06"
2022-09-13 10:01:11 +02:00
# Engineering builds: "ENG-2022.06-001"
2022-10-26 12:43:51 +02:00
# Check-in build: ENG-2022.12-D1039-C39098348
2022-09-13 10:01:11 +02:00
#
2022-10-26 12:43:51 +02:00
string ( REGEX MATCH "\ (ENG|[A-Z])-[0-9][0-9][0-9][0-9]\.[0-9][0-9]+.*"
v e r s _ s t r i n g " $ { f u l l _ v e r s i o n _ o u t p u t } " )
2022-09-13 10:01:11 +02:00
string ( REGEX MATCH "[0-9][0-9][0-9][0-9]\.[0-9][0-9]"
2022-10-26 12:43:51 +02:00
r e d u c e d _ v e r s i o n " $ { v e r s _ s t r i n g } " )
2022-09-13 10:01:11 +02:00
if ( "${reduced_version}" VERSION_LESS ${ ARCMWDT_MIN_REQUIRED_VERS } )
message ( FATAL_ERROR "Could NOT find ccac: Found unsuitable version \" ${ reduced_version } \", but required is at least \"${ARCMWDT_MIN_REQUIRED_VERS}\" ( found ${ CROSS_COMPILE } ccac ) " )
endif ( )
2020-07-03 12:13:49 +02:00
endif ( )