diff --git a/scripts/cmake/tensorflow_lite_micro.cmake b/scripts/cmake/tensorflow_lite_micro.cmake index 4866fec0a71bc654c088853b5f76fe0c4ea5c14e..0aba0a95215aeec9ce06f56e6b6b87e64e6aa59f 100644 --- a/scripts/cmake/tensorflow_lite_micro.cmake +++ b/scripts/cmake/tensorflow_lite_micro.cmake @@ -94,7 +94,7 @@ function(build_tflite_micro_cmake) endif() # Create an alias to use in other parts of the project. - add_library(tensorflow-lite-micro ALIAS tflu) + add_library(google::tensorflow-lite-micro ALIAS tflu) endfunction() function(build_tflite_micro_makefile) @@ -229,12 +229,17 @@ function(build_tflite_micro_makefile) target_include_directories(tensorflow-lite-micro INTERFACE - ${TENSORFLOW_SRC_PATH}) + ${TENSORFLOW_SRC_PATH} + ${TENSORFLOW_SRC_PATH}/tensorflow/lite/micro/tools/make/downloads/flatbuffers/include + ${TENSORFLOW_SRC_PATH}/tensorflow/lite/micro/tools/make/downloads/gemmlowp) target_compile_definitions(tensorflow-lite-micro INTERFACE TF_LITE_STATIC_MEMORY) + # Create an alias to use in other parts of the project. + add_library(google::tensorflow-lite-micro ALIAS tensorflow-lite-micro) + endfunction() build_tflite_micro_cmake() diff --git a/source/application/api/fwk/tflm/CMakeLists.txt b/source/application/api/fwk/tflm/CMakeLists.txt index 8eba9cd0ff30e57ac6f13c8356da7e1b6e18812d..6db9b1fb175af70bed53b3a9329c606e74d9568e 100644 --- a/source/application/api/fwk/tflm/CMakeLists.txt +++ b/source/application/api/fwk/tflm/CMakeLists.txt @@ -31,7 +31,12 @@ if (NOT "TensorFlowLiteMicro" STREQUAL ${ML_FRAMEWORK}) endif() # Include the TensorFlow Lite Micro build target -include(tensorflow_lite_micro) +# if the target is not available. An external project +# including this project can provide its own version +# of the target. +if (NOT TARGET google::tensorflow-lite-micro) + include(tensorflow_lite_micro) +endif() # Create static library add_library(${ML_FWK_TFLM_TARGET} STATIC @@ -51,15 +56,13 @@ add_library(${ML_FWK_TFLM_TARGET} STATIC ## Include directories - public target_include_directories(${ML_FWK_TFLM_TARGET} PUBLIC - include - ${TENSORFLOW_SRC_PATH}/tensorflow/lite/micro/tools/make/downloads/flatbuffers/include - ${TENSORFLOW_SRC_PATH}/tensorflow/lite/micro/tools/make/downloads/gemmlowp) + include) # Link time library targets: target_link_libraries(${ML_FWK_TFLM_TARGET} PUBLIC - mlek_log # Logging functions - ml-framework-iface # ML framework interface - tensorflow-lite-micro) # TensorFlow Lite Micro library + mlek_log # Logging functions + ml-framework-iface # ML framework interface + google::tensorflow-lite-micro) # TensorFlow Lite Micro library target_compile_definitions(${ML_FWK_TFLM_TARGET} INTERFACE MLEK_FWK_TFLM=1) diff --git a/source/math/CMakeLists.txt b/source/math/CMakeLists.txt index 9d9d0ada5ae7b29ad22249d5a89852e1a62a1a88..f6003f89c7891a1ab5049175f2df96702b605236 100644 --- a/source/math/CMakeLists.txt +++ b/source/math/CMakeLists.txt @@ -35,7 +35,13 @@ target_include_directories(arm_math PUBLIC include) target_link_libraries(arm_math PRIVATE mlek_log) if (${CMAKE_CROSSCOMPILING}) - include(cmsis-dsp) + # If CMSIS-DSP target doesn't exist, include the MLEK default + # configuration. An external project that wants to re-use this + # module is expected to declare this target before including + # this project + if (NOT TARGET arm::cmsis-dsp) + include(cmsis-dsp) + endif() target_link_libraries(arm_math PUBLIC arm::cmsis-dsp) endif ()