summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorKshitij Sisodia <kshitij.sisodia@arm.com>2022-05-06 09:13:03 +0100
committerKshitij Sisodia <kshitij.sisodia@arm.com>2022-05-06 17:11:41 +0100
commitaa4bcb14d0cbee910331545dd2fc086b58c37170 (patch)
treee67a43a43f61c6f8b6aad19018b0827baf7e31a6 /CMakeLists.txt
parentfcca863bafd5f33522bc14c23dde4540e264ec94 (diff)
downloadml-embedded-evaluation-kit-aa4bcb14d0cbee910331545dd2fc086b58c37170.tar.gz
MLECO-3183: Refactoring application sources
Platform agnostic application sources are moved into application api module with their own independent CMake projects. Changes for MLECO-3080 also included - they create CMake projects individial API's (again, platform agnostic) that dependent on the common logic. The API for KWS_API "joint" API has been removed and now the use case relies on individual KWS, and ASR API libraries. Change-Id: I1f7748dc767abb3904634a04e0991b74ac7b756d Signed-off-by: Kshitij Sisodia <kshitij.sisodia@arm.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt36
1 files changed, 27 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a80554..e501a54 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -115,6 +115,9 @@ add_subdirectory(${PROFILER_DIR} ${CMAKE_BINARY_DIR}/profiler)
# Include the tensorflow build target
include(${CMAKE_SCRIPTS_DIR}/tensorflow.cmake)
+# Add the common API library target (tensorflow-lite-micro target is needed)
+add_subdirectory(${SRC_PATH}/application/api/common ${CMAKE_BINARY_DIR}/api/common)
+
# Include directories for application module:
set(APPLICATION_INCLUDE_DIRS
${SRC_PATH}/application/tensorflow-lite-micro/include
@@ -125,11 +128,6 @@ file(GLOB_RECURSE SRC_APPLICATION
"${SRC_PATH}/application/main/*.cc"
"${SRC_PATH}/application/main/*.cpp"
"${SRC_PATH}/application/main/*.c"
- "${SRC_PATH}/application/main/**/*.cc"
- "${SRC_PATH}/application/main/**/*.cpp"
- "${SRC_PATH}/application/main/**/*.c"
- "${SRC_PATH}/application/tensorflow-lite-micro/**/*.cc"
- "${SRC_PATH}/application/tensorflow-lite-micro/*.cc"
)
list(FILTER SRC_APPLICATION EXCLUDE REGEX ".*main\\.c.*$")
set(SRC_MAIN "${SRC_PATH}/application/main/Main.cc")
@@ -183,6 +181,7 @@ foreach(use_case ${USE_CASES})
file(GLOB UC_CMAKE_FILE
"${SRC_USE_CASE}/${use_case}/*.cmake")
+ # Include the use case cmake file.
include(${UC_CMAKE_FILE})
file(GLOB_RECURSE UC_SRC
@@ -207,7 +206,7 @@ foreach(use_case ${USE_CASES})
"${${use_case}_COMPILE_DEFS}")
endif()
- set(UC_LIB_NAME lib${TARGET_NAME})
+ set(UC_LIB_NAME ${use_case})
# Consolidated application static lib:
add_library(${UC_LIB_NAME} STATIC
@@ -218,12 +217,11 @@ foreach(use_case ${USE_CASES})
target_include_directories(${UC_LIB_NAME} PUBLIC
${APPLICATION_INCLUDE_DIRS}
${UC_INCLUDE}
- ${INC_GEN_DIR}
- ${TENSORFLOW_SRC_PATH}/tensorflow/lite/micro/tools/make/downloads/flatbuffers/include)
+ ${INC_GEN_DIR})
# Set the activation buffer size
target_compile_definitions(${UC_LIB_NAME} PUBLIC
- "ACTIVATION_BUF_SZ=${${use_case}_ACTIVATION_BUF_SZ}")
+ "ACTIVATION_BUF_SZ=${${use_case}_ACTIVATION_BUF_SZ}")
target_link_libraries(${UC_LIB_NAME} PUBLIC
log
@@ -232,6 +230,26 @@ foreach(use_case ${USE_CASES})
profiler
tensorflow-lite-micro)
+ # If an API exists for this use case, include the projects here and add to
+ # the library list.
+ foreach(API_TO_USE ${${use_case}_API_LIST})
+
+ # If the required target doesn't yet exist, include the project here:
+ if (NOT TARGET ${API_TO_USE}_api)
+ add_subdirectory(
+ ${SRC_PATH}/application/api/use_case/${API_TO_USE} # Source path
+ ${CMAKE_BINARY_DIR}/api/use_case/${API_TO_USE}) # Binary path
+ endif()
+
+ # Check if the target now exists
+ if (TARGET ${API_TO_USE}_api)
+ message(STATUS "Using ${API_TO_USE}_api for ${use_case}")
+ target_link_libraries(${UC_LIB_NAME} PUBLIC ${API_TO_USE}_api)
+ else()
+ message(FATAL_ERROR "${API_TO_USE}_api target not found!")
+ endif()
+ endforeach()
+
add_executable(${TARGET_NAME} ${SRC_MAIN})
target_link_libraries(${TARGET_NAME} PUBLIC ${UC_LIB_NAME})