Imported Upstream version 1.18.0
[platform/core/ml/nnfw.git] / compiler / luci-interpreter / pal / linux / pal.cmake
1 macro(initialize_pal)
2     nnas_find_package(TensorFlowSource EXACT 2.6.0 QUIET)
3     nnas_find_package(TensorFlowGEMMLowpSource EXACT 2.6.0 QUIET)
4     nnas_find_package(TensorFlowEigenSource EXACT 2.6.0 QUIET)
5     nnas_find_package(TensorFlowRuySource EXACT 2.6.0 QUIET)
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
27     find_package(Threads REQUIRED)
28
29     set(PAL_INITIALIZED TRUE)
30 endmacro()
31
32 macro(add_pal_to_target TGT)
33     target_include_directories(${TGT} PRIVATE "${PAL}")
34     target_include_directories(${TGT} SYSTEM PRIVATE
35             "${TensorFlowRuySource_DIR}"
36             "${TensorFlowGEMMLowpSource_DIR}"
37             "${TensorFlowEigenSource_DIR}"
38             "${TensorFlowSource_DIR}")
39     target_include_directories(${TGT} PRIVATE ${LUCI_INTERPRETER_PAL_DIR})
40
41     # TODO put it back, I changed my mind.
42     # instead add sources with visitors in this library
43     set(PAL_SOURCES ${TensorFlowSource_DIR}/tensorflow/lite/kernels/internal/quantization_util.cc)
44     add_library(luci_interpreter_linux_pal STATIC ${PAL_SOURCES})
45     set_target_properties(luci_interpreter_linux_pal PROPERTIES POSITION_INDEPENDENT_CODE ON)
46     target_include_directories(luci_interpreter_linux_pal SYSTEM PRIVATE
47             "${TensorFlowRuySource_DIR}"
48             "${TensorFlowGEMMLowpSource_DIR}"
49             "${TensorFlowEigenSource_DIR}"
50             "${TensorFlowSource_DIR}"
51     )
52
53     target_link_libraries(${TGT} PRIVATE Threads::Threads luci_interpreter_linux_pal)
54 endmacro()