forked from luxonis/depthai-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdepthaiDependencies.cmake
93 lines (79 loc) · 3.1 KB
/
depthaiDependencies.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
if(CONFIG_MODE)
set(_DEPTHAI_PREFIX_PATH_ORIGINAL ${CMAKE_PREFIX_PATH})
set(_DEPTHAI_FIND_ROOT_PATH_MODE_PACKAGE_ORIGINAL ${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE})
# Fixes Android NDK build, where prefix path is ignored as its not inside sysroot
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE "BOTH")
# Sets where to search for packages about to follow
set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/${_IMPORT_PREFIX}" ${CMAKE_PREFIX_PATH})
set(_QUIET "QUIET")
else()
set(DEPTHAI_SHARED_LIBS ${BUILD_SHARED_LIBS})
hunter_add_package(nlohmann_json)
if(NOT DEPTHAI_XLINK_LOCAL)
hunter_add_package(XLink)
endif()
hunter_add_package(BZip2)
hunter_add_package(FP16)
hunter_add_package(libarchive-luxonis)
hunter_add_package(spdlog)
hunter_add_package(ZLIB)
if(DEPTHAI_ENABLE_BACKWARD)
hunter_add_package(Backward)
endif()
hunter_add_package(libnop)
endif()
# If library was build as static, find all dependencies
if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS))
# BZip2 (for bspatch)
find_package(BZip2 ${_QUIET} CONFIG REQUIRED)
# FP16 for conversions
find_package(FP16 ${_QUIET} CONFIG REQUIRED)
# libarchive for firmware packages
find_package(archive_static ${_QUIET} CONFIG REQUIRED)
find_package(lzma ${_QUIET} CONFIG REQUIRED)
# ZLIB for compressing Apps
find_package(ZLIB CONFIG REQUIRED)
# spdlog for library and device logging
find_package(spdlog ${_QUIET} CONFIG REQUIRED)
# Backward
if(DEPTHAI_ENABLE_BACKWARD)
# Disable automatic check for additional stack unwinding libraries
# Just use the default compiler one
set(STACK_DETAILS_AUTO_DETECT FALSE CACHE BOOL "Auto detect backward's stack details dependencies")
find_package(Backward ${_QUIET} CONFIG REQUIRED)
unset(STACK_DETAILS_AUTO_DETECT)
endif()
endif()
# Add threads (c++)
find_package(Threads ${_QUIET} REQUIRED)
# Nlohmann JSON
find_package(nlohmann_json 3.6.0 ${_QUIET} CONFIG REQUIRED)
# libnop for serialization
find_package(libnop ${_QUIET} CONFIG REQUIRED)
# XLink
if(DEPTHAI_XLINK_LOCAL AND (NOT CONFIG_MODE))
set(_BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}")
set(BUILD_SHARED_LIBS OFF)
add_subdirectory("${DEPTHAI_XLINK_LOCAL}" ${CMAKE_CURRENT_BINARY_DIR}/XLink)
set(BUILD_SHARED_LIBS "${_BUILD_SHARED_LIBS_SAVED}")
unset(_BUILD_SHARED_LIBS_SAVED)
list(APPEND targets_to_export XLink)
else()
find_package(XLink ${_QUIET} CONFIG REQUIRED HINTS "${CMAKE_CURRENT_LIST_DIR}/XLink" "${CMAKE_CURRENT_LIST_DIR}/../XLink")
endif()
# OpenCV 4 - (optional, quiet always)
find_package(OpenCV 4 QUIET CONFIG)
# include optional dependency cmake
if(DEPTHAI_DEPENDENCY_INCLUDE)
include(${DEPTHAI_DEPENDENCY_INCLUDE} OPTIONAL)
endif()
# Cleanup
if(CONFIG_MODE)
set(CMAKE_PREFIX_PATH ${_DEPTHAI_PREFIX_PATH_ORIGINAL})
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ${_DEPTHAI_FIND_ROOT_PATH_MODE_PACKAGE_ORIGINAL})
unset(_DEPTHAI_PREFIX_PATH_ORIGINAL)
unset(_DEPTHAI_FIND_ROOT_PATH_MODE_PACKAGE_ORIGINAL)
unset(_QUIET)
else()
set(DEPTHAI_SHARED_LIBS)
endif()