Fix compilation error found in tflite test (#3820)

ps. https://github.com/bytecodealliance/wasm-micro-runtime/pull/3817
This commit is contained in:
liang.he
2024-10-08 09:54:39 +08:00
committed by GitHub
parent 6b4d8aae2a
commit 30539bf50c
12 changed files with 139 additions and 51 deletions

View File

@ -4,13 +4,21 @@
include(FetchContent)
set(CJSON_SOURCE_DIR "${WAMR_ROOT_DIR}/core/deps/cjson")
FetchContent_Declare(
cjson
GIT_REPOSITORY https://github.com/DaveGamble/cJSON.git
GIT_TAG v1.7.18
SOURCE_DIR ${CJSON_SOURCE_DIR}
)
if(EXISTS ${CJSON_SOURCE_DIR})
message("Use existed source code under ${CJSON_SOURCE_DIR}")
FetchContent_Declare(
cjson
SOURCE_DIR ${CJSON_SOURCE_DIR}
)
else()
message("download source code and store it at ${CJSON_SOURCE_DIR}")
FetchContent_Declare(
cjson
GIT_REPOSITORY https://github.com/DaveGamble/cJSON.git
GIT_TAG v1.7.18
SOURCE_DIR ${CJSON_SOURCE_DIR}
)
endif()
set(ENABLE_CJSON_TEST OFF CACHE INTERNAL "Turn off tests")
set(ENABLE_CJSON_UNINSTALL OFF CACHE INTERNAL "Turn off uninstall to avoid targets conflict")

View File

@ -4,13 +4,21 @@
include(FetchContent)
set(LLAMA_SOURCE_DIR "${WAMR_ROOT_DIR}/core/deps/llama.cpp")
FetchContent_Declare(
llamacpp
GIT_REPOSITORY https://github.com/ggerganov/llama.cpp.git
GIT_TAG b3573
SOURCE_DIR ${LLAMA_SOURCE_DIR}
)
if(EXISTS ${LLAMA_SOURCE_DIR})
message("Use existed source code under ${LLAMA_SOURCE_DIR}")
FetchContent_Declare(
llamacpp
SOURCE_DIR ${LLAMA_SOURCE_DIR}
)
else()
message("download source code and store it at ${LLAMA_SOURCE_DIR}")
FetchContent_Declare(
llamacpp
GIT_REPOSITORY https://github.com/ggerganov/llama.cpp.git
GIT_TAG b3573
SOURCE_DIR ${LLAMA_SOURCE_DIR}
)
endif()
set(LLAMA_BUILD_TESTS OFF)
set(LLAMA_BUILD_EXAMPLES OFF)

View File

@ -4,20 +4,32 @@
include(FetchContent)
set(TFLITE_SOURCE_DIR "${WAMR_ROOT_DIR}/core/deps/tensorflow-src")
if(EXISTS ${TFLITE_SOURCE_DIR})
message("Use existed source code under ${TFLITE_SOURCE_DIR}")
FetchContent_Declare(
tensorflow_lite
SOURCE_DIR ${TFLITE_SOURCE_DIR}
SOURCE_SUBDIR tensorflow/lite
)
else()
message("download source code and store it at ${TFLITE_SOURCE_DIR}")
FetchContent_Declare(
tensorflow_lite
GIT_REPOSITORY https://github.com/tensorflow/tensorflow.git
GIT_TAG v2.12.0
GIT_SHALLOW ON
GIT_PROGRESS ON
SOURCE_DIR ${TFLITE_SOURCE_DIR}
SOURCE_SUBDIR tensorflow/lite
PATCH_COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/add_telemetry.patch
)
endif()
FetchContent_Declare(
tensorflow_lite
GIT_REPOSITORY https://github.com/tensorflow/tensorflow.git
GIT_TAG v2.12.0
GIT_SHALLOW ON
GIT_PROGRESS ON
SOURCE_DIR ${TFLITE_SOURCE_DIR}
SOURCE_SUBDIR tensorflow/lite
)
if(WAMR_BUILD_WASI_NN_ENABLE_GPU EQUAL 1)
set(TFLITE_ENABLE_GPU ON)
endif()
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
set(TFLITE_ENABLE_XNNPACK OFF)
endif()

View File

@ -0,0 +1,12 @@
diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt
index c71a3925ac..39591a3bd7 100644
--- a/tensorflow/lite/CMakeLists.txt
+++ b/tensorflow/lite/CMakeLists.txt
@@ -493,6 +493,7 @@ set(TFLITE_PROFILER_SRCS
${TFLITE_SOURCE_DIR}/profiling/root_profiler.h
${TFLITE_SOURCE_DIR}/profiling/root_profiler.cc
${TFLITE_SOURCE_DIR}/profiling/telemetry/profiler.cc
+ ${TFLITE_SOURCE_DIR}/profiling/telemetry/telemetry.cc
)
if(CMAKE_SYSTEM_NAME MATCHES "Android")
list(APPEND TFLITE_PROFILER_SRCS