-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathCMakeLists.txt
50 lines (40 loc) · 1.79 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
idf_build_get_property(component_targets __COMPONENT_TARGETS)
if ("___idf_espressif__esp-dl" IN_LIST component_targets)
idf_component_get_property(espdl_dir espressif__esp-dl COMPONENT_DIR)
elseif("___idf_esp-dl" IN_LIST component_targets)
idf_component_get_property(espdl_dir esp-dl COMPONENT_DIR)
endif()
set(cmake_dir ${espdl_dir}/fbs_loader/cmake)
include(${cmake_dir}/utilities.cmake)
set(src_dirs .)
set(include_dirs .)
set(requires esp-dl)
set(packed_model ${BUILD_DIR}/espdl_models/pedestrian_detect.espdl)
idf_component_register(SRC_DIRS ${src_dirs} INCLUDE_DIRS ${include_dirs} REQUIRES ${requires})
if (NOT CONFIG_PEDESTRIAN_DETECT_MODEL_IN_SDCARD)
if (IDF_TARGET STREQUAL "esp32s3")
set(models_dir ${COMPONENT_DIR}/models/s3)
elseif (IDF_TARGET STREQUAL "esp32p4")
set(models_dir ${COMPONENT_DIR}/models/p4)
endif()
file(MAKE_DIRECTORY ${BUILD_DIR}/espdl_models)
set(models)
if(CONFIG_PEDESTRIAN_DETECT_PICO_S8_V1)
list(APPEND models ${models_dir}/pedestrian_detect_pico_s8_v1.espdl)
endif()
set(pack_model_exe ${espdl_dir}/fbs_loader/pack_espdl_models.py)
add_custom_command(
OUTPUT ${packed_model}
COMMENT "Move and Pack models..."
COMMAND python ${pack_model_exe} --model_path ${models} --out_file ${packed_model}
DEPENDS ${models}
VERBATIM)
if(CONFIG_PEDESTRIAN_DETECT_MODEL_IN_FLASH_RODATA)
target_add_aligned_binary_data(${COMPONENT_LIB} ${packed_model} BINARY)
endif()
if(CONFIG_PEDESTRIAN_DETECT_MODEL_IN_FLASH_PARTITION)
add_custom_target(pedestrian_detect_model ALL DEPENDS ${packed_model})
add_dependencies(flash pedestrian_detect_model)
esptool_py_flash_to_partition(flash "pedestrian_det" ${packed_model})
endif()
endif()