@@ -3,27 +3,28 @@ cmake_minimum_required(VERSION 3.5)
33set (EXTRA_COMPONENT_DIRS static_images)
44include ($ENV{IDF_PATH} /tools/cmake/project.cmake)
55
6+ # Helper function to set required environment variables as per configuration set by user
67function (add_bsp SDKCONFIG BSP)
78 string (REGEX MATCH "CONFIG_${BSP} =y" REGEX_RESULT ${SDKCONFIG} )
89 if (REGEX_RESULT)
9- set (ENV{${BSP} } 1)
10+ set (ENV{${BSP} } 1) # If the config option is set then set corresponding environment variable to 1
1011 endif ()
1112endfunction ()
1213
13- # 1. Define all variables used in main/idf_component.yml
14+ # 1. Define all variables used in main/idf_component.yml and set them to zero
1415set (ENV{TFLITE_USE_BSP_S3_EYE} 0)
1516set (ENV{TFLITE_USE_BSP_KORVO_2} 0)
1617set (ENV{TFLITE_USE_BSP_KALUGA} 0)
1718
18- # 2. Set correct var to 'target'
19+ # 2. Set correct var to 1
1920# This is a workaround idf-component-manager limitation, where only
20- # target and idf_version can be in the if-clause
21+ # target, idf_version and environment variables can be in the if-clause
2122if (EXISTS ${CMAKE_CURRENT_LIST_DIR} /sdkconfig)
2223 file (READ ${CMAKE_CURRENT_LIST_DIR} /sdkconfig SDKCONFIG_RULE)
2324
24- add_bsp("${SDKCONFIG_RULE} " "TFLITE_USE_BSP_S3_EYE" )
25- add_bsp("${SDKCONFIG_RULE} " "TFLITE_USE_BSP_KORVO_2" )
26- add_bsp("${SDKCONFIG_RULE} " "TFLITE_USE_BSP_KALUGA" )
25+ add_bsp("${SDKCONFIG_RULE} " "TFLITE_USE_BSP_S3_EYE" ) # Check for CONFIG_TFLITE_USE_BSP_S3_EYE option in sdkconfig
26+ add_bsp("${SDKCONFIG_RULE} " "TFLITE_USE_BSP_KORVO_2" ) # Check for CONFIG_TFLITE_USE_BSP_KORVO_2 option in sdkconfig
27+ add_bsp("${SDKCONFIG_RULE} " "TFLITE_USE_BSP_KALUGA" ) # Check for CONFIG_TFLITE_USE_BSP_KALUGA option in sdkconfig
2728endif ()
2829
2930project (person_detection)
0 commit comments