Skip to content

Commit 9de3a2a

Browse files
author
Matevz Morato
committed
README.md updates
1 parent 220bb29 commit 9de3a2a

File tree

1 file changed

+87
-108
lines changed

1 file changed

+87
-108
lines changed

README.md

Lines changed: 87 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# DepthAI C++ Library
22

33
[![Forum](https://img.shields.io/badge/Forum-discuss-orange)](https://discuss.luxonis.com/)
4-
[![Docs](https://img.shields.io/badge/Docs-DepthAI_API-yellow)](https://docs.luxonis.com/projects/api)
4+
[![Docs](https://img.shields.io/badge/Docs-DepthAI_API-yellow)](https://stg.docs.luxonis.com/software/v3/)
55
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
66

7-
Core depthai library for interfacing with Luxonis DepthAI hardware.
7+
DepthAI library for interfacing with Luxonis DepthAI hardware.
88

9-
> ⚠️ This is a `v3_develop` branch of library which is still in active development without a stable API yet.
9+
> ⚠️ This is a `v3.x.y` version of the library which is still in active development without a stable API yet.
1010
1111

1212
## Documentation
13-
Documentation is available over at [Luxonis DepthAI API](https://docs.luxonis.com/projects/api/en/latest/)
13+
Documentation is available over at [Luxonis DepthAI API](https://stg.docs.luxonis.com/software/v3/)
1414

1515
## Disclaimer
1616
DepthAI library doesn't yet provide API stability guarantees. While we take care to properly deprecate old functions, some changes might still be breaking.
@@ -19,11 +19,13 @@ DepthAI library doesn't yet provide API stability guarantees. While we take care
1919
Examples for both C++ and Python are available in the `examples` folder. To get started with them see [README.md](./examples/README.md) for more information.
2020

2121
## Dependencies
22-
- CMake >= 3.14
22+
- CMake >= 3.14 and <4.0
2323
- C/C++17 compiler
2424
- [optional] OpenCV 4 (required if building examples and for record and replay)
2525
- [optional] PCL (required for point cloud example)
2626

27+
> ℹ️ We'll be adding support for CMake 4 shortly.
28+
2729
To install OpenCV:
2830
MacOS: `brew install opencv`
2931
Linux: `sudo apt install libopencv-dev`
@@ -32,9 +34,20 @@ To install PCL:
3234
MacOS: `brew install pcl`
3335
Linux: `sudo apt install libpcl-dev`
3436

35-
## Python specific information
37+
## Using Python bindings
38+
Installing the latest pre-released version of the library can be done with:
39+
```
40+
python3 -m pip install --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-release-local/ --pre -U depthai
41+
```
42+
43+
or by running:
44+
```
45+
python3 examples/python/install_requirements.py on the branch you want to install
46+
```
47+
3648
For more specific information about Python bindings, see [Python README](./bindings/python/README.md).
3749

50+
3851
## Building
3952

4053
Make sure submodules are updated
@@ -45,91 +58,94 @@ git submodule update --init --recursive
4558
Then configure and build
4659

4760
```
48-
cmake -S. -Bbuild
61+
cmake -S . -B build
4962
cmake --build build
5063
```
5164

5265
> ℹ️ To speed up build times, use `cmake --build build --parallel [num CPU cores]` (CMake >= 3.12).
53-
For older versions use: Linux/macOS: `cmake --build build -- -j[num CPU cores]`, MSVC: `cmake --build build -- /MP[num CPU cores]`
54-
55-
> ⚠️ If any CMake commands error with `CMake Error: The source directory "" does not exist.` replace argument `-S` with `-H`
5666
5767
### Dynamic library
5868

59-
To build dynamic version of library configure with following option added
69+
To build a dynamic version of the library configure with the following option added
6070
```
61-
cmake -S. -Bbuild -D'BUILD_SHARED_LIBS=ON'
62-
cmake --build build
71+
cmake -S . -B build -D'BUILD_SHARED_LIBS=ON'
72+
cmake --build build --parallel [num CPU cores]
6373
```
6474

75+
## Installation and Integration
76+
Installation of the DepthAI library is currently only available as a dynamic library. To install the library, use the following command:
6577

66-
### Android
67-
68-
Android is supported to some extent but not actively pursued nor tested. PRs with any improvements are welcome.
69-
70-
Steps:
71-
72-
- Install Android NDK (for example via Android Studio).
73-
- Set the NDK path:
7478
```
75-
export ANDROID_HOME=$HOME/.local/lib/Android
76-
export PATH=$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools
77-
export NDK=$ANDROID_HOME/ndk/23.1.7779620/ # Check version
79+
cmake -S . -B build -D'BUILD_SHARED_LIBS=ON' -D'CMAKE_INSTALL_PREFIX=[path/to/install/dir]'
80+
cmake --build build --target install --parallel [num CPU cores]
7881
```
79-
- Ensure a recent version of cmake (apt version is outdated, install snap install cmake --classic)
80-
- Run cmake, set your ABI and Platform as needed:
82+
83+
### Verifying installation
84+
To verify the installation works as expected, you can test if the integration project compiles and runs.
85+
This is done by running the following command:
8186

8287
```
83-
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-25
84-
cmake --build build
88+
cmake -S tests/integration . -B build_integration -D'CMAKE_PREFIX_PATH=[path/to/install/dir]'
89+
cmake --build build_integration --target test --parallel [num CPU cores]
8590
```
8691

87-
## Integration
88-
92+
### Prebuilt library on Windows
8993
Under releases you may find prebuilt library for Windows, for use in either integration method. See [Releases](https://github.com/luxonis/depthai-core/releases)
9094

91-
### CMake
95+
### Using find_package for integration
9296

93-
Targets available to link to are:
94-
- depthai::core - Core library, without using opencv internally
95-
- depthai::opencv - Core + support for opencv related helper functions (requires OpenCV4)
97+
> ℹ️ Due to a non-trivial dependency tree, the integration with `add_subdirectory` is not supported. Use `find_package` instead.
9698
97-
#### Using find_package
99+
First install the library as described in [Installation and Integration](#installation-and-integration) section.
98100

99-
Build static or dynamic version of library (See: [Building](#building) and optionally [Installing](#installing))
101+
Then in your CMake project, add the following lines to your `CMakeLists.txt` file:
102+
103+
```cmake
104+
105+
# Add `find_package` and `target_link_libraries` to your project
100106
101-
Add `find_package` and `target_link_libraries` to your project
102-
```
103107
find_package(depthai CONFIG REQUIRED)
104108
...
105109
target_link_libraries([my-app] PRIVATE depthai::opencv)
106110
```
107111

108-
And point CMake to either build directory or install directory:
112+
And point CMake to your install directory:
109113
```
110-
-D'depthai_DIR=depthai-core/build'
111-
```
112-
or
113-
```
114-
-D'depthai_DIR=depthai-core/build/install/lib/cmake/depthai'
114+
-D'CMAKE_PREFIX_PATH=[path/to/install/dir]'
115115
```
116116

117-
If library was installed to default search path like `/usr/local` on Linux, specifying `depthai_DIR` isn't necessary as CMake will find it automatically.
118117

119-
#### Using add_subdirectory
118+
If library was installed to default search path like `/usr/local` on Linux, specifying `CMAKE_PREFIX_PATH` isn't necessary as CMake will find it automatically.
119+
120120

121-
This method is more intrusive but simpler as it doesn't require building the library separately.
121+
### Vcpkg integration
122+
For VCPKG integration, check out the example [here](https://github.com/luxonis/depthai_vcpkg_example).
123+
Note that the VCPKG integration is using a custom branch of DepthAI and we plan to integrate the support for it into the main branch in the future and add it to the official VCPKG repository.
122124

123-
Add `add_subdirectory` which points to `depthai-core` folder **before** project command. Then link to any required targets.
125+
126+
### Android
127+
Android is not yet supported on the v3.x.y version of DepthAI. You can still use the v2.x.y version of DepthAI for RVC2 devices or open an issue on this repository to request Android support for v3.x.y.
128+
129+
<!-- Steps:
130+
131+
- Install Android NDK (for example via Android Studio).
132+
- Set the NDK path:
124133
```
125-
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/depthai-core EXCLUDE_FROM_ALL)
126-
...
127-
project(my-app)
128-
...
129-
target_link_libraries([my-app] PRIVATE depthai::opencv)
134+
export ANDROID_HOME=$HOME/.local/lib/Android
135+
export PATH=$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools
136+
export NDK=$ANDROID_HOME/ndk/23.1.7779620/ # Check version
130137
```
138+
- Ensure a recent version of cmake (apt version is outdated, install snap install cmake --classic)
139+
- Run cmake, set your ABI and Platform as needed:
140+
141+
```
142+
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-25
143+
cmake --build build
144+
``` -->
145+
131146

132-
### Non-CMake integration (Visual Studio, Xcode, CodeBlocks, ...)
147+
148+
<!-- ### Non-CMake integration (Visual Studio, Xcode, CodeBlocks, ...)
133149
134150
To integrate into a different build system than CMake, prefered way is compiling as dynamic library and setting correct build options.
135151
1. First build as dynamic library: [Building Dynamic library](#dynamic-library)
@@ -147,18 +163,15 @@ In your non-CMake project (new Visual Studio project, ...)
147163
> ℹ️ Threading library might need to be linked to explicitly.
148164
149165
> ℹ️ Check `build/depthai-core-integration.txt` or `build/depthai-opencv-integration.txt` for up to date define options.
150-
The generated integration file also specifies include paths without requiring installation.
166+
The generated integration file also specifies include paths without requiring installation. -->
151167

152-
## Installing
168+
## CMake options
169+
Many features of the library can be disabled or enabled using CMake options.
170+
One common option when building the library tests and examples is `DEPTHAI_VCPKG_INTERNAL_ONLY=OFF` which installs a predictable version of OpenCV, PCL and other optional dependencies we also use on the libraries interface.
153171

154-
To install specify optional prefix and build target install
155-
```
156-
cmake -S. -Bbuild -D'CMAKE_INSTALL_PREFIX=[path/to/install/dir]'
157-
cmake --build build --target install
158-
```
159-
160-
If `CMAKE_INSTALL_PREFIX` isn't specified, the library is installed under build folder `install`.
172+
> ℹ️ When `DEPTHAI_VCPKG_INTERNAL_ONLY=OFF` is used, the library cannot be installed (apart from being installed in the scope of the vcpkg package manager).
161173
174+
For a full list of options, see `cmake/depthaiOptions.cmake` file.
162175

163176
## Environment variables
164177

@@ -179,7 +192,7 @@ The following environment variables can be set to alter default behavior of the
179192
| DEPTHAI_PLATFORM | Restricts default search to the specified platform. Options: `any`, `rvc2`, `rvc3`, `rvc4`. |
180193
| DEPTHAI_DEVICE_MXID_LIST | Restricts default search to the specified MXIDs. Accepts comma separated list of MXIDs. Lists filter results in an "AND" manner and not "OR" |
181194
| DEPTHAI_DEVICE_ID_LIST | Alias to MXID list. Lists filter results in an "AND" manner and not "OR" |
182-
| DEPTHAI_DEVICE_NAME_LIST | Restricts default search to the specified NAMEs. Accepts comma separated list of NAMEs. Lists filter results in an "AND" manner and not "OR". It also looks for NAMEs outside of the hosts subnet in case of tcpip. |
195+
| DEPTHAI_DEVICE_NAME_LIST | Restricts default search to the specified NAMEs. Accepts comma separated list of NAMEs. Lists filter results in an "AND" manner and not "OR". It also looks for NAMEs outside of the host's subnet in case of tcpip. |
183196
| DEPTHAI_DEVICE_BINARY | Overrides device Firmware binary. Mostly for internal debugging purposes. |
184197
| DEPTHAI_DEVICE_RVC4_FWP | Overrides device RVC4 Firmware binary. Mostly for internal debugging purposes. |
185198
| DEPTHAI_BOOTLOADER_BINARY_USB | Overrides device USB Bootloader binary. Mostly for internal debugging purposes. |
@@ -211,23 +224,25 @@ Then navigate to `build` folder and run `ctest` with specified labels that denot
211224
Currently available labels:
212225
- usb
213226
- poe
227+
- rvc2
228+
- rvc4
214229

215230
```
216231
cd build
217-
# Run tests on USB devices
218-
ctest -L usb
219-
# Run tests on PoE devices
220-
ctest -L poe
232+
# Run tests on RVC2 devices
233+
ctest -L rvc2
234+
# Run tests on RVC4 devices
235+
ctest -L rvc4
221236
```
222237

223238
## Style check
224239

225240
The library uses clang format to enforce a certain coding style.
226241
If a style check is failing, run the `clangformat` target, check the output and push changes.
227242

228-
To use this target clang format must be installed, preferably clang-format-10
243+
To use this target clang format must be installed, preferably clang-format-18
229244
```
230-
sudo apt install clang-format-10
245+
sudo apt install clang-format-18
231246
```
232247

233248
And to apply formatting
@@ -239,59 +254,23 @@ cmake --build build --target clangformat
239254

240255
Doxygen is used to generate documentation. Follow [doxygen download](https://www.doxygen.nl/download.html#srcbin) and install the required binaries for your platform.
241256

242-
After that specify CMake define `-D'DEPTHAI_BUILD_DOCS=ON`' and build the target `doxygen`
257+
After that specify CMake define `-D'DEPTHAI_BUILD_DOCS=ON'` and build the target `doxygen`
243258

244259
## Debugging tips
245260

246261
Debugging can be done using **Visual Studio Code** and either **GDB** or **LLDB** (extension 'CodeLLDB').
247262
LLDB in some cases was much faster to step with and resolved more `incomplete_type` variables than GDB. Your mileage may vary though.
248263

249264

250-
If there is a need to step into **Hunter** libraries, that can be achieved by removing previous built artifacts
251-
```
252-
rm -r ~/.hunter
253-
```
254-
255-
And configuring the project with the following CMake option set to `ON`
256-
```
257-
cmake . -D'HUNTER_KEEP_PACKAGE_SOURCES=ON'
258-
```
259-
260-
This retains the libraries source code, so that debugger can step through it (the paths are already set up correctly)
261-
262-
263265
## Troubleshooting
264266

265267
### Build fails with missing OpenCV dependency
266268

267269
If your build process happen to fail due to OpenCV library not being found, but you have the OpenCV installed, please
268-
run build with additional `-D'OpenCV_DIR=...`' flag (replacing default Ubuntu path `/usr/lib/x86_64-linux-gnu/cmake/opencv4` with yours)
270+
run build with additional `-D'OpenCV_DIR=...` flag (replacing default Ubuntu path `/usr/lib/x86_64-linux-gnu/cmake/opencv4` with yours)
269271

270272
```
271273
cmake -S. -Bbuild -D'OpenCV_DIR=/usr/lib/x86_64-linux-gnu/cmake/opencv4'
272274
```
273275

274276
Now the build process should correctly discover your OpenCV installation
275-
276-
### Hunter
277-
Hunter is a CMake-only dependency manager for C/C++ projects.
278-
279-
If you are stuck with error message which mentions external libraries (subdirectory of `.hunter`) like the following:
280-
```
281-
/usr/bin/ld: /home/[user]/.hunter/_Base/062a19a/ccfed35/a84a713/Install/lib/liblzma.a(stream_flags_decoder.c.o): warning: relocation against `lzma_footer_magic' in read-only section `.text'
282-
```
283-
284-
Try erasing the **Hunter** cache folder.
285-
286-
Linux/MacOS:
287-
```
288-
rm -r ~/.hunter
289-
```
290-
Windows:
291-
```
292-
del C:/.hunter
293-
```
294-
or
295-
```
296-
del C:/[user]/.hunter
297-
```

0 commit comments

Comments
 (0)