Skip to content

Commit 92af955

Browse files
icthemarpe
andauthored
Detail and notes about building the lib. (#281)
* Detail and notes about building the lib. * Add local submodule dependencies to the dependency list. * Break down and structure the build process, depending on the scenario. * Add common issues section along the build process. * Update README.md * Update README.md Co-authored-by: Eric Platon <[email protected]> Co-authored-by: TheMarpe <[email protected]>
1 parent 6441db6 commit 92af955

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,47 @@ See: [depthai-core dependencies](https://github.com/luxonis/depthai-core#depende
3131

3232
### Building
3333

34+
The first time you build, the repository submodules need be initialized:
35+
```
36+
git submodule update --init --recursive
37+
38+
# Tip: You can ask Git to do that automatically:
39+
git config submodule.recurse true
40+
```
41+
42+
Later submodules also need to be updated.
43+
44+
#### Local build with pip
3445
To build and install using pip:
3546
```
3647
python3 -m pip install .
3748
```
3849
Add parameter `-v` to see the output of the building process.
3950

40-
51+
#### Wheel with pip
4152
To build a wheel, execute the following
4253
```
4354
python3 -m pip wheel . -w wheelhouse
4455
```
4556

57+
#### Shared library
4658
To build a shared library from source perform the following:
4759

4860
> ℹ️ To speed up build times, use `cmake --build build --parallel [num CPU cores]` (CMake >= 3.12).
4961
For older versions use: Linux/macOS: `cmake --build build -- -j[num CPU cores]`, MSVC: `cmake --build build -- /MP[num CPU cores]`
5062

5163
```
52-
git submodule update --init --recursive
5364
cmake -H. -Bbuild
5465
cmake --build build
5566
```
5667
To specify custom Python executable to build for, use `cmake -H. -Bbuild -D PYTHON_EXECUTABLE=/full/path/to/python`.
5768

69+
#### Common issues
70+
71+
* Many build fails due to missing dependencies. This also happens when submodules are missing or outdated (`git submodule update --recursive`).
72+
* If libraries and headers are not in standard places, or not on the search paths, CMake reports it cannot find what it needs (e.g. `libusb`). CMake can be hinted at where to look, for exmpale: `CMAKE_LIBRARY_PATH=/opt/local/lib CMAKE_INCLUDE_PATH=/opt/local/include pip install .`
73+
* Some distribution installers may not get the desired library. For example, an install on a RaspberryPi failed, missing `libusb`, as the default installation with APT led to v0.1.3 at the time, whereas the library here required v1.0.
74+
5875

5976
## Running tests
6077

0 commit comments

Comments
 (0)