Skip to content

Commit 61bb2e6

Browse files
committed
depthai-core: init at 3.0.0-beta.1
1 parent a4796c3 commit 61bb2e6

9 files changed

Lines changed: 808 additions & 0 deletions
Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
From 2a30d778794bf5a1e6ca1ddac231a214294dd0b0 Mon Sep 17 00:00:00 2001
2+
From: Petr Hodina <petr.hodina@luxonis.com>
3+
Date: Wed, 28 May 2025 11:02:03 +0200
4+
Subject: [PATCH 1/3] nixos specific patches
5+
6+
7+
diff --git a/CMakeLists.txt b/CMakeLists.txt
8+
index 91dddd03d..531553f27 100644
9+
--- a/CMakeLists.txt
10+
+++ b/CMakeLists.txt
11+
@@ -118,6 +118,7 @@ set(PROJECT_EXPORT_GROUP "${PROJECT_NAME}Targets")
12+
13+
## Check if cloned or sources
14+
find_package(Git)
15+
+find_package(foxglove-websocket)
16+
if(GIT_FOUND)
17+
execute_process(
18+
COMMAND ${GIT_EXECUTABLE} rev-parse --show-toplevel
19+
@@ -407,8 +408,8 @@ if(DEPTHAI_BUILD_ZOO_HELPER)
20+
nlohmann_json::nlohmann_json
21+
fmt::fmt
22+
yaml-cpp::yaml-cpp
23+
- CURL::libcurl
24+
- cpr::cpr
25+
+ curl
26+
+ cpr
27+
)
28+
target_compile_definitions(zoo_helper PRIVATE DEPTHAI_ENABLE_CURL)
29+
add_executable(zoo_helper ${ZOO_HELPER_SOURCES})
30+
@@ -679,9 +680,6 @@ endif()
31+
target_link_libraries(${TARGET_CORE_NAME}
32+
PUBLIC
33+
nlohmann_json::nlohmann_json
34+
- libnop
35+
- INTERFACE
36+
- XLinkPublic
37+
PRIVATE
38+
fmt::fmt
39+
yaml-cpp::yaml-cpp
40+
@@ -692,10 +690,8 @@ target_link_libraries(${TARGET_CORE_NAME}
41+
LibArchive::LibArchive
42+
ZLIB::ZLIB
43+
httplib::httplib
44+
- semver::semver
45+
magic_enum::magic_enum
46+
- liblzma::liblzma
47+
- lz4::lz4
48+
+ lz4
49+
)
50+
51+
if(DEPTHAI_ENABLE_MP4V2)
52+
@@ -713,9 +709,9 @@ if(DEPTHAI_ENABLE_PROTOBUF)
53+
endif()
54+
55+
if(DEPTHAI_ENABLE_REMOTE_CONNECTION)
56+
- target_link_libraries(${TARGET_CORE_NAME} PRIVATE
57+
- foxglove-websocket::foxglove-websocket
58+
- )
59+
+ target_link_libraries(${TARGET_CORE_NAME} PRIVATE
60+
+ foxglove_websocket
61+
+ )
62+
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_REMOTE_CONNECTION)
63+
endif()
64+
65+
@@ -727,8 +723,8 @@ endif()
66+
67+
if(DEPTHAI_ENABLE_CURL)
68+
target_link_libraries(${TARGET_CORE_NAME} PRIVATE
69+
- CURL::libcurl
70+
- cpr::cpr
71+
+ curl
72+
+ cpr
73+
)
74+
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_CURL)
75+
endif()
76+
@@ -750,12 +746,12 @@ target_compile_definitions(${TARGET_CORE_NAME}
77+
if(DEPTHAI_ENABLE_LIBUSB)
78+
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_LIBUSB)
79+
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_HAVE_LIBUSB_SUPPORT)
80+
+ target_link_libraries(depthai-core PRIVATE PkgConfig::LIBUSB)
81+
set(DEPTHAI_HAVE_LIBUSB_SUPPORT ON)
82+
endif()
83+
84+
if(DEPTHAI_XTENSOR_SUPPORT)
85+
target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_XTENSOR_SUPPORT)
86+
- target_link_libraries(${TARGET_CORE_NAME} PUBLIC xtensor)
87+
endif()
88+
89+
# Specify available FW
90+
@@ -813,7 +809,7 @@ macro(add_runtime_dependencies depending_target dependency)
91+
endif()
92+
endmacro()
93+
# Add libusb dll in build time
94+
-add_runtime_dependencies(${TARGET_CORE_NAME} usb-1.0)
95+
+add_runtime_dependencies(${TARGET_CORE_NAME} PkgConfig::LIBUSB)
96+
97+
########################
98+
# OpenCV Support 2
99+
@@ -1048,7 +1044,7 @@ if(DEPTHAI_SANITIZE)
100+
if(DEPTHAI_XLINK_LOCAL)
101+
add_sanitizers(XLink)
102+
if(XLINK_LIBUSB_LOCAL)
103+
- add_sanitizers(usb-1.0)
104+
+ add_sanitizers(PkgConfig::LIBUSB)
105+
endif()
106+
endif()
107+
endif()
108+
@@ -1144,12 +1140,11 @@ include(CMakePackageConfigHelpers)
109+
110+
# Add additional targets to export group
111+
if(NOT BUILD_SHARED_LIBS)
112+
- list(APPEND targets_to_export ${DEPTHAI_RESOURCE_LIBRARY_NAME} cmrc-base XLink)
113+
+ list(APPEND targets_to_export ${DEPTHAI_RESOURCE_LIBRARY_NAME} cmrc-base)
114+
if(DEPTHAI_ENABLE_PROTOBUF)
115+
list(APPEND targets_to_export messages)
116+
endif()
117+
if(DEPTHAI_ENABLE_REMOTE_CONNECTION)
118+
- list(APPEND targets_to_export foxglove_websocket)
119+
endif()
120+
endif()
121+
122+
diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake
123+
index 3a44e70f2..01d39912a 100644
124+
--- a/cmake/depthaiDependencies.cmake
125+
+++ b/cmake/depthaiDependencies.cmake
126+
@@ -47,7 +47,6 @@ if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS))
127+
endif()
128+
# libarchive for firmware packages
129+
find_package(LibArchive ${_QUIET} REQUIRED)
130+
- find_package(liblzma ${_QUIET} CONFIG REQUIRED)
131+
# httplib for Gate communication
132+
find_package(httplib ${_QUIET} CONFIG REQUIRED)
133+
# ZLIB for compressing Apps
134+
@@ -168,24 +167,13 @@ set(BUILD_SHARED_LIBS OFF)
135+
set(XLINK_ENABLE_LIBUSB ${DEPTHAI_ENABLE_LIBUSB} CACHE BOOL "Enable libusb" FORCE)
136+
set(XLINK_INSTALL_PUBLIC_ONLY ON CACHE BOOL "Install only public headers" FORCE)
137+
if(DEPTHAI_ENABLE_LIBUSB)
138+
- find_package(usb-1.0 ${_QUIET} CONFIG REQUIRED)
139+
+ find_package(PkgConfig REQUIRED)
140+
+ pkg_check_modules(LIBUSB REQUIRED IMPORTED_TARGET libusb-1.0)
141+
endif()
142+
if(DEPTHAI_XLINK_LOCAL AND (NOT CONFIG_MODE))
143+
add_subdirectory("${DEPTHAI_XLINK_LOCAL}" ${CMAKE_CURRENT_BINARY_DIR}/XLink)
144+
else()
145+
- FetchContent_Declare(
146+
- XLink
147+
- GIT_REPOSITORY https://github.com/luxonis/XLink.git
148+
- GIT_TAG 87785828fabdb1718760bb0a044405d5bbfbb3a2
149+
- )
150+
-
151+
- FetchContent_MakeAvailable(
152+
- XLink
153+
- )
154+
endif()
155+
-set(BUILD_SHARED_LIBS "${_BUILD_SHARED_LIBS_SAVED}")
156+
-unset(_BUILD_SHARED_LIBS_SAVED)
157+
-list(APPEND targets_to_export XLinkPublic)
158+
159+
# OpenCV 4 - (optional)
160+
message("DEPTHAI_OPENCV_SUPPORT: ${DEPTHAI_OPENCV_SUPPORT}")
161+
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
162+
index 37894c5ea..e3e093b96 100644
163+
--- a/examples/cpp/CMakeLists.txt
164+
+++ b/examples/cpp/CMakeLists.txt
165+
@@ -34,7 +34,7 @@ function(dai_add_example example_name example_src enable_test use_pcl)
166+
elseif(NOT DEPTHAI_MERGED_TARGET)
167+
set(DEPTHAI_TARGET depthai::opencv)
168+
endif()
169+
- target_link_libraries(${example_name} PRIVATE utility ${DEPTHAI_TARGET} ${OpenCV_LIBS} Threads::Threads)
170+
+ target_link_libraries(${example_name} PRIVATE utility ${DEPTHAI_TARGET} ${OpenCV_LIBS} PkgConfig::LIBUSB Threads::Threads)
171+
# Set compiler features (c++17), and disables extensions (g++17)
172+
set_property(TARGET ${example_name} PROPERTY CXX_STANDARD 17)
173+
set_property(TARGET ${example_name} PROPERTY CXX_STANDARD_REQUIRED ON)
174+
diff --git a/src/pipeline/node/NeuralNetwork.cpp b/src/pipeline/node/NeuralNetwork.cpp
175+
index 17dc177ea..30791dac4 100644
176+
--- a/src/pipeline/node/NeuralNetwork.cpp
177+
+++ b/src/pipeline/node/NeuralNetwork.cpp
178+
@@ -1,6 +1,6 @@
179+
#include "depthai/pipeline/node/NeuralNetwork.hpp"
180+
181+
-#include <magic_enum.hpp>
182+
+#include <magic_enum/magic_enum.hpp>
183+
#include <stdexcept>
184+
185+
#include "common/ModelType.hpp"
186+
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
187+
index b02900cd1..258d6e05b 100644
188+
--- a/tests/CMakeLists.txt
189+
+++ b/tests/CMakeLists.txt
190+
@@ -21,6 +21,8 @@ set(test_env
191+
192+
include(CMakeParseArguments)
193+
194+
+include_directories(${CMAKE_SOURCE_DIR}/src)
195+
+
196+
# Function for adding new tests
197+
function(dai_add_test test_name test_src)
198+
# Parse arguments
199+
@@ -54,7 +56,7 @@ function(dai_add_test test_name test_src)
200+
if(NOT DEPTHAI_MERGED_TARGET)
201+
set(DEPTHAI_TARGET depthai::opencv)
202+
endif()
203+
- target_link_libraries(${test_name} PRIVATE ${DEPTHAI_TARGET} ${OpenCV_LIBS} Catch2::Catch2WithMain Threads::Threads spdlog::spdlog)
204+
+ target_link_libraries(${test_name} PRIVATE ${DEPTHAI_TARGET} ${OpenCV_LIBS} PkgConfig::LIBUSB Catch2::Catch2WithMain Threads::Threads spdlog::spdlog)
205+
206+
# Add sanitizers for tests as well
207+
if(COMMAND add_sanitizers)
208+
diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt
209+
index 178f9fa0e..0a721a527 100644
210+
--- a/tests/integration/CMakeLists.txt
211+
+++ b/tests/integration/CMakeLists.txt
212+
@@ -45,13 +45,13 @@ enable_testing()
213+
# Create target dependant on depthai::core
214+
add_executable(integration-test-core src/main.cpp)
215+
target_link_libraries(integration-test-core PRIVATE depthai::core)
216+
-add_runtime_dependencies(integration-test-core usb-1.0)
217+
+add_runtime_dependencies(integration-test-core PkgConfig::LIBUSB)
218+
add_test(integration-test-core integration-test-core)
219+
220+
# Create target dependant on depthai::opencv (if available)
221+
if(TARGET depthai::opencv)
222+
add_executable(integration-test-opencv src/main.cpp)
223+
target_link_libraries(integration-test-opencv PRIVATE depthai::opencv)
224+
- add_runtime_dependencies(integration-test-opencv usb-1.0)
225+
+ add_runtime_dependencies(integration-test-opencv PkgConfig::LIBUSB)
226+
add_test(integration-test-opencv integration-test-opencv)
227+
endif()
228+
diff --git a/tests/src/ondevice_tests/pipeline/node/neural_network_node_test.cpp b/tests/src/ondevice_tests/pipeline/node/neural_network_node_test.cpp
229+
index 3d43ef80a..b01026511 100644
230+
--- a/tests/src/ondevice_tests/pipeline/node/neural_network_node_test.cpp
231+
+++ b/tests/src/ondevice_tests/pipeline/node/neural_network_node_test.cpp
232+
@@ -1,6 +1,6 @@
233+
#include <catch2/catch_all.hpp>
234+
#include <catch2/catch_test_macros.hpp>
235+
-#include <magic_enum.hpp>
236+
+#include <magic_enum/magic_enum.hpp>
237+
#include <opencv2/videoio.hpp>
238+
239+
#include "depthai/common/CameraBoardSocket.hpp"
240+
diff --git a/tests/src/onhost_tests/naming_test.cpp b/tests/src/onhost_tests/naming_test.cpp
241+
index d4ab66f33..19eb5615a 100644
242+
--- a/tests/src/onhost_tests/naming_test.cpp
243+
+++ b/tests/src/onhost_tests/naming_test.cpp
244+
@@ -1,6 +1,7 @@
245+
#include <catch2/catch_all.hpp>
246+
247+
-#include "../../src/utility/EepromDataParser.hpp"
248+
+#include <utility/Environment.hpp>
249+
+#include <utility/EepromDataParser.hpp>
250+
251+
struct ProductDevice {
252+
std::string oldProductName, productName, deviceName;
253+
--
254+
2.49.0
255+
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
From cfa98aeb77f3b0a5a21be67f476afde6495e8905 Mon Sep 17 00:00:00 2001
2+
From: Petr Hodina <petr.hodina@luxonis.com>
3+
Date: Wed, 28 May 2025 11:03:18 +0200
4+
Subject: [PATCH 2/3] cmake: Add option to enable 3rdparty dependencies
5+
6+
7+
diff --git a/CMakeLists.txt b/CMakeLists.txt
8+
index 531553f27..f8208c238 100644
9+
--- a/CMakeLists.txt
10+
+++ b/CMakeLists.txt
11+
@@ -162,9 +162,12 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
12+
13+
14+
# TODO Remove shared naming
15+
+if(DEPTHAI_ENABLE_3RDPARTY)
16+
set(DEPTHAI_SHARED_3RDPARTY_INCLUDE
17+
${CMAKE_CURRENT_LIST_DIR}/include/3rdparty/
18+
)
19+
+endif()
20+
+
21+
# Add depthai-bootloader-shared
22+
include(${CMAKE_CURRENT_LIST_DIR}/shared/depthai-bootloader-shared.cmake)
23+
24+
diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake
25+
index 01d39912a..c901d56fd 100644
26+
--- a/cmake/depthaiDependencies.cmake
27+
+++ b/cmake/depthaiDependencies.cmake
28+
@@ -104,7 +104,7 @@ if(DEPTHAI_XTENSOR_SUPPORT)
29+
endif()
30+
endif()
31+
32+
-if(DEPTHAI_ENABLE_REMOTE_CONNECTION)
33+
+if(DEPTHAI_ENABLE_REMOTE_CONNECTION AND DEPTHAI_ENABLE_3RDPARTY)
34+
get_filename_component(PARENT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/.. ABSOLUTE)
35+
add_subdirectory("${PARENT_DIRECTORY}/3rdparty/foxglove/ws-protocol/cpp/foxglove-websocket" foxglove-websocket)
36+
endif()
37+
diff --git a/cmake/depthaiOptions.cmake b/cmake/depthaiOptions.cmake
38+
index 297f12ecd..5a5beb7b6 100644
39+
--- a/cmake/depthaiOptions.cmake
40+
+++ b/cmake/depthaiOptions.cmake
41+
@@ -18,6 +18,7 @@ option(DEPTHAI_ENABLE_PROTOBUF "Enable Protobuf support" ON)
42+
option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT})
43+
option(DEPTHAI_ENABLE_KOMPUTE "Enable Kompute support" OFF)
44+
option(DEPTHAI_ENABLE_MP4V2 "Enable video recording using the MP4V2 library" ON)
45+
+option(DEPTHAI_ENABLE_3RDPARTY "Build 3rdparty dependencies" ON)
46+
47+
# ---------- Optional Features (public) -------------
48+
option(DEPTHAI_OPENCV_SUPPORT "Enable optional OpenCV support" ON)
49+
diff --git a/shared/depthai-shared.cmake b/shared/depthai-shared.cmake
50+
index 24ce9b383..650119273 100644
51+
--- a/shared/depthai-shared.cmake
52+
+++ b/shared/depthai-shared.cmake
53+
@@ -4,7 +4,9 @@ else()
54+
set(DEPTHAI_SHARED_FOLDER ${CMAKE_CURRENT_LIST_DIR}/depthai-shared)
55+
endif()
56+
57+
-set(DEPTHAI_SHARED_3RDPARTY_HEADERS_PATH "depthai-shared/3rdparty")
58+
+if(DEPTHAI_ENABLE_3RDPARTY)
59+
+ set(DEPTHAI_SHARED_3RDPARTY_HEADERS_PATH "depthai-shared/3rdparty")
60+
+endif()
61+
62+
set(DEPTHAI_SHARED_SOURCES
63+
${DEPTHAI_SHARED_FOLDER}/src/datatype/DatatypeEnum.cpp
64+
@@ -17,9 +19,11 @@ set(DEPTHAI_SHARED_PUBLIC_INCLUDE
65+
${DEPTHAI_SHARED_FOLDER}/include
66+
)
67+
68+
-set(DEPTHAI_SHARED_3RDPARTY_INCLUDE
69+
- ${DEPTHAI_SHARED_FOLDER}/3rdparty
70+
-)
71+
+if(DEPTHAI_ENABLE_3RDPARTY)
72+
+ set(DEPTHAI_SHARED_3RDPARTY_INCLUDE
73+
+ ${DEPTHAI_SHARED_FOLDER}/3rdparty
74+
+ )
75+
+endif()
76+
77+
set(DEPTHAI_SHARED_INCLUDE
78+
${DEPTHAI_SHARED_FOLDER}/src
79+
--
80+
2.49.0
81+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
From e0ff1705800f007117a07134e761ab815c0cbcf2 Mon Sep 17 00:00:00 2001
2+
From: Petr Hodina <petr.hodina@luxonis.com>
3+
Date: Wed, 28 May 2025 11:25:50 +0200
4+
Subject: [PATCH 3/3] fix include directory tests
5+
6+
7+
diff --git a/tests/src/onhost_tests/env_test.cpp b/tests/src/onhost_tests/env_test.cpp
8+
index ce5b860ad..e1ae1690a 100644
9+
--- a/tests/src/onhost_tests/env_test.cpp
10+
+++ b/tests/src/onhost_tests/env_test.cpp
11+
@@ -3,7 +3,7 @@
12+
#include <string>
13+
#include <vector>
14+
15+
-#include "../../../src/utility/Environment.hpp"
16+
+#include <utility/Environment.hpp>
17+
18+
using namespace dai::utility;
19+
20+
--
21+
2.49.0
22+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 4115bc1f1..1e4104cc0 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -162,11 +162,9 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
6+
7+
8+
# TODO Remove shared naming
9+
-if(DEPTHAI_ENABLE_3RDPARTY)
10+
set(DEPTHAI_SHARED_3RDPARTY_INCLUDE
11+
${CMAKE_CURRENT_LIST_DIR}/include/3rdparty/
12+
)
13+
-endif()
14+
15+
# Add depthai-bootloader-shared
16+
include(${CMAKE_CURRENT_LIST_DIR}/shared/depthai-bootloader-shared.cmake)

0 commit comments

Comments
 (0)