24e469f0e43daaf8429f7b2f3b01d1fbdeecd6ef
[platform/core/ml/nnfw.git] / onert-micro / luci-interpreter / pal / mcu / pal.cmake
1 macro(initialize_pal)
2     nnas_find_package(TensorFlowSource EXACT 2.8.0 REQUIRED)
3     nnas_find_package(TensorFlowGEMMLowpSource EXACT 2.8.0 REQUIRED)
4     nnas_find_package(TensorFlowEigenSource EXACT 2.8.0 REQUIRED)
5     nnas_find_package(TensorFlowRuySource EXACT 2.8.0 REQUIRED)
6
7     if (NOT TensorFlowSource_FOUND)
8         message(STATUS "Skipping luci-interpreter: TensorFlow not found")
9         return()
10     endif ()
11
12     if (NOT TensorFlowGEMMLowpSource_FOUND)
13         message(STATUS "Skipping luci-interpreter: gemmlowp not found")
14         return()
15     endif ()
16
17     if (NOT TensorFlowEigenSource_FOUND)
18         message(STATUS "Skipping luci-interpreter: Eigen not found")
19         return()
20     endif ()
21
22     if (NOT TensorFlowRuySource_FOUND)
23         message(STATUS "Skipping luci-interpreter: Ruy not found")
24         return()
25     endif ()
26     #find_package(Threads REQUIRED)
27
28     set(PAL_INITIALIZED TRUE)
29 endmacro()
30
31 macro(add_pal_to_target TGT)
32     target_include_directories(${TGT} PRIVATE "${PAL}")
33     target_include_directories(${TGT} PRIVATE
34             "${TensorFlowRuySource_DIR}"
35             "${TensorFlowGEMMLowpSource_DIR}"
36             "${TensorFlowEigenSource_DIR}"
37             "${TensorFlowSource_DIR}")
38     target_include_directories(${TGT} PRIVATE ${LUCI_INTERPRETER_PAL_DIR})
39
40     # TODO put it back, I changed my mind.
41     # instead add sources with visitors in this library
42     set(PAL_SOURCES ${TensorFlowSource_DIR}/tensorflow/lite/kernels/internal/quantization_util.cc
43             ${TensorFlowSource_DIR}/tensorflow/lite/kernels/internal/tensor_utils.cc
44             ${TensorFlowSource_DIR}/tensorflow/lite/kernels/internal/reference/portable_tensor_utils.cc)
45     add_library(luci_interpreter_mcu_pal STATIC ${PAL_SOURCES})
46     set_target_properties(luci_interpreter_mcu_pal PROPERTIES POSITION_INDEPENDENT_CODE ON)
47     target_include_directories(luci_interpreter_mcu_pal PRIVATE
48             "${TensorFlowRuySource_DIR}"
49             "${TensorFlowGEMMLowpSource_DIR}"
50             "${TensorFlowEigenSource_DIR}"
51             "${TensorFlowSource_DIR}"
52     )
53
54     target_link_libraries(${TGT} PRIVATE luci_interpreter_mcu_pal)
55     #target_link_libraries(${TGT} PRIVATE Threads::Threads luci_interpreter_mcu_pal)
56 endmacro()