Skip to content

Commit 7386704

Browse files
author
Minh Hai Chu
authored
Update CMakeLists.txt in tvmlib
1 parent 4ede6f2 commit 7386704

File tree

1 file changed

+30
-15
lines changed
  • target_sw/app/micro_kws_esp32devboard_perf/components/tvm-lib

1 file changed

+30
-15
lines changed

target_sw/app/micro_kws_esp32devboard_perf/components/tvm-lib/CMakeLists.txt

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,36 +21,51 @@ cmake_minimum_required(VERSION 3.5)
2121
SET(TVM_SRC ${CONFIG_TVM_DIR})
2222
SET(TVM_CRT_CONFIG_DIR ${CONFIG_TVM_CRT_CONFIG_DIR})
2323

24+
# If TVM_SRC is not configured, use the bundled runtime
25+
IF ("${TVM_SRC}" STREQUAL "" OR "${TVM_SRC}" STREQUAL "$(TVM_SRC)")
26+
SET(TVM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/runtime)
27+
ENDIF()
28+
2429
IF (NOT ${TVM_SRC} STREQUAL "")
2530

2631
SET(TVM_ALIGNMENT_BYTES 4)
2732

2833
# cmake-format: off
2934
SET(TVM_HEADERS
3035
${TVM_SRC}/include
31-
${TVM_SRC}/3rdparty/dlpack/include
32-
${TVM_SRC}/apps/bundle_deploy
33-
${TVM_SRC}/src/runtime/crt/include
3436
)
37+
38+
IF(EXISTS "${TVM_SRC}/3rdparty/dlpack/include")
39+
LIST(APPEND TVM_HEADERS
40+
${TVM_SRC}/3rdparty/dlpack/include
41+
${TVM_SRC}/apps/bundle_deploy
42+
${TVM_SRC}/src/runtime/crt/include
43+
)
44+
SET(TVM_CRT_PATH "${TVM_SRC}/src/runtime/crt")
45+
ELSE()
46+
SET(TVM_CRT_PATH "${TVM_SRC}/src/runtime/crt")
47+
ENDIF()
3548
# cmake-format: on
3649

37-
IF(TVM_CRT_CONFIG_DIR)
50+
# Add crt_config directory
51+
IF(TVM_CRT_CONFIG_DIR AND NOT "${TVM_CRT_CONFIG_DIR}" STREQUAL "")
3852
LIST(APPEND TVM_HEADERS ${TVM_CRT_CONFIG_DIR})
39-
# ELSE()
40-
# LIST(APPEND TVM_HEADERS ${TVM_SRC}/apps/bundle_deploy/crt_config)
53+
ELSE()
54+
# Use bundled crt_config
55+
LIST(APPEND TVM_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/crt_config)
4156
ENDIF()
4257

4358
idf_component_register(
4459
SRCS
45-
${TVM_SRC}/src/runtime/crt/common/crt_backend_api.c
46-
${TVM_SRC}/src/runtime/crt/memory/stack_allocator.c
47-
${TVM_SRC}/src/runtime/crt/common/crt_runtime_api.c
48-
${TVM_SRC}/src/runtime/crt/common/func_registry.c
49-
${TVM_SRC}/src/runtime/crt/memory/page_allocator.c
50-
${TVM_SRC}/src/runtime/crt/common/ndarray.c
51-
${TVM_SRC}/src/runtime/crt/common/packed_func.c
52-
${TVM_SRC}/src/runtime/crt/graph_executor/graph_executor.c
53-
${TVM_SRC}/src/runtime/crt/graph_executor/load_json.c
60+
${TVM_CRT_PATH}/common/crt_backend_api.c
61+
${TVM_CRT_PATH}/memory/stack_allocator.c
62+
${TVM_CRT_PATH}/common/crt_runtime_api.c
63+
${TVM_CRT_PATH}/common/func_registry.c
64+
${TVM_CRT_PATH}/memory/page_allocator.c
65+
${TVM_CRT_PATH}/common/ndarray.c
66+
${TVM_CRT_PATH}/common/packed_func.c
67+
${TVM_CRT_PATH}/graph_executor/graph_executor.c
68+
${TVM_CRT_PATH}/graph_executor/load_json.c
5469
INCLUDE_DIRS
5570
${TVM_HEADERS}
5671
)

0 commit comments

Comments
 (0)