Avoid re-installing if Tensorflow is already installed for WASI-NN (#2148)
Since the Tensorflow library is already installed in many cases(especially in the case of the embedded system), move the installation code to find_package.
This commit is contained in:
@ -101,26 +101,6 @@ if (WAMR_BUILD_LIB_PTHREAD_SEMAPHORE EQUAL 1)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_WASI_NN EQUAL 1)
|
||||
if (NOT EXISTS "${WAMR_ROOT_DIR}/core/deps/tensorflow-src")
|
||||
execute_process(COMMAND ${WAMR_ROOT_DIR}/core/deps/install_tensorflow.sh
|
||||
RESULT_VARIABLE TENSORFLOW_RESULT
|
||||
)
|
||||
else ()
|
||||
message("Tensorflow is already downloaded.")
|
||||
endif()
|
||||
set(TENSORFLOW_SOURCE_DIR "${WAMR_ROOT_DIR}/core/deps/tensorflow-src")
|
||||
|
||||
if (WASI_NN_ENABLE_GPU EQUAL 1)
|
||||
# Tensorflow specific:
|
||||
# * https://www.tensorflow.org/lite/guide/build_cmake#available_options_to_build_tensorflow_lite
|
||||
set (TFLITE_ENABLE_GPU ON)
|
||||
endif ()
|
||||
|
||||
include_directories (${CMAKE_CURRENT_BINARY_DIR}/flatbuffers/include)
|
||||
include_directories (${TENSORFLOW_SOURCE_DIR})
|
||||
add_subdirectory(
|
||||
"${TENSORFLOW_SOURCE_DIR}/tensorflow/lite"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/tensorflow-lite" EXCLUDE_FROM_ALL)
|
||||
include (${IWASM_DIR}/libraries/wasi-nn/wasi_nn.cmake)
|
||||
endif ()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user