Imported Upstream version 1.25.0
[platform/core/ml/nnfw.git] / infra / nnfw / cmake / packages / LuciConfig.cmake
1 # Assume that luci and related libraries and headers are installed on overlay directory
2
3 set(Luci_FOUND FALSE)
4
5 find_path(LUCI_HEADERS
6     NAMES loco.h luci/IR/CircleNode.h
7     PATHS ${EXT_OVERLAY_DIR}/include)
8
9 macro(_load_library LUCI_NAME)
10     add_library(luci::${LUCI_NAME} SHARED IMPORTED)
11     find_library(LUCI_LIB_PATH_${LUCI_NAME} NAMES luci_${LUCI_NAME} PATHS ${EXT_OVERLAY_DIR}/lib)
12     if (NOT LUCI_LIB_PATH_${LUCI_NAME})
13         return()
14     endif()
15     set_target_properties(luci::${LUCI_NAME} PROPERTIES
16         IMPORTED_LOCATION ${LUCI_LIB_PATH_${LUCI_NAME}}
17         INTERFACE_INCLUDE_DIRECTORIES ${LUCI_HEADERS})
18 endmacro()
19
20 _load_library(env)
21 _load_library(export)
22 _load_library(import)
23 _load_library(lang)
24 _load_library(logex)
25 _load_library(log)
26 _load_library(partition)
27 _load_library(pass)
28 _load_library(plan)
29 _load_library(profile)
30 _load_library(service)
31
32 # Need luci::loco to avoid "DSO missing from command line" link error
33 # TODO Find better way to do this
34 add_library(luci::loco SHARED IMPORTED)
35 find_library(LOCO_LIB_PATH NAMES loco PATHS ${EXT_OVERLAY_DIR}/lib)
36 if (NOT LOCO_LIB_PATH)
37     return()
38 endif()
39 set_target_properties(luci::loco PROPERTIES
40     IMPORTED_LOCATION ${LOCO_LIB_PATH}
41     INTERFACE_INCLUDE_DIRECTORIES ${LUCI_HEADERS})
42
43 set(Luci_FOUND TRUE)