1#------------------------------------------------------------------------------- 2# Copyright (c) 2022, Arm Limited. All rights reserved. 3# 4# SPDX-License-Identifier: BSD-3-Clause 5# 6#------------------------------------------------------------------------------- 7 8cmake_minimum_required(VERSION 3.15) 9 10if (NOT USE_KCONFIG_TOOL) 11 return() 12endif() 13 14set(DOTCONFIG_FILE "${CMAKE_BINARY_DIR}/.config") 15set(ROOT_KCONFIG "${CMAKE_SOURCE_DIR}/Kconfig") 16set(PLATFORM_PATH "${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}") 17 18find_package(Python3) 19 20# Call the tfm_kconfig.py 21execute_process( 22 COMMAND 23 ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/kconfig/tfm_kconfig.py 24 -k ${ROOT_KCONFIG} -o ${CMAKE_BINARY_DIR} -u gui -p ${PLATFORM_PATH} 25 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} 26 RESULT_VARIABLE ret 27) 28 29if(NOT ret EQUAL 0) 30 message(FATAL_ERROR "Kconfig tool failed!") 31endif() 32 33# Component configs generated by tfm_kconfig.py 34if (EXISTS "${CMAKE_BINARY_DIR}/project_config.h") 35 set(PROJECT_CONFIG_HEADER_FILE "${CMAKE_BINARY_DIR}/project_config.h" CACHE STRING "User defined header file for TF-M config") 36endif() 37 38# Load project cmake configs generated by tfm_kconfig.py 39if (EXISTS "${CMAKE_BINARY_DIR}/project_config.cmake") 40 include("${CMAKE_BINARY_DIR}/project_config.cmake") 41endif() 42