1# SPDX-License-Identifier: Apache-2.0 2 3# Configures CMake for using ccac 4 5find_program(CMAKE_DTS_PREPROCESSOR ${ZEPHYR_SDK_CROSS_COMPILE}gcc PATHS ${ZEPHYR_SDK_INSTALL_DIR} NO_DEFAULT_PATH) 6message(STATUS "Found dts preprocessor: ${CMAKE_DTS_PREPROCESSOR} (Zephyr SDK ${SDK_VERSION})") 7 8find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}ccac PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) 9find_program(CMAKE_LLVM_COV ${CROSS_COMPILE}llvm-cov PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) 10set(CMAKE_GCOV "${CMAKE_LLVM_COV} gcov") 11 12if(CMAKE_C_COMPILER STREQUAL CMAKE_C_COMPILER-NOTFOUND) 13 message(FATAL_ERROR "Zephyr was unable to find the Metaware compiler") 14endif() 15 16execute_process( 17 COMMAND ${CMAKE_C_COMPILER} --version 18 RESULT_VARIABLE ret 19 OUTPUT_VARIABLE full_version_output 20 ERROR_QUIET 21 ) 22 23if(ret) 24 message(FATAL_ERROR "Executing the below command failed. Are permissions set correctly? 25 '${CMAKE_C_COMPILER} --version'" 26 ) 27else() 28 set(ARCMWDT_MIN_REQUIRED_VERS "2022.09") 29# 30# Regular version has format: "T-2022.06" 31# Engineering builds: "ENG-2022.06-001" 32# Check-in build: ENG-2022.12-D1039-C39098348 33# 34 string(REGEX MATCH "\ (ENG|[A-Z])-[0-9][0-9][0-9][0-9]\.[0-9][0-9]+.*" 35 vers_string "${full_version_output}") 36 37 string(REGEX MATCH "[0-9][0-9][0-9][0-9]\.[0-9][0-9]" 38 reduced_version "${vers_string}") 39 40 if("${reduced_version}" VERSION_LESS ${ARCMWDT_MIN_REQUIRED_VERS}) 41 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)") 42 endif() 43endif() 44