Skip to content

Commit a1a8b15

Browse files
committed
Added missing bindings
2 parents 4d0819f + 79b7231 commit a1a8b15

131 files changed

Lines changed: 3723 additions & 772 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,31 @@ jobs:
2626

2727
# Job which builds docstrings for the rest of the wheel builds
2828
build-docstrings:
29-
runs-on: macos-latest
29+
runs-on: ubuntu-latest
3030
steps:
3131
- name: Cache .hunter folder
3232
uses: actions/cache@v2
3333
with:
3434
path: ~/.hunter
35-
key: hunter-macos-latest
35+
key: hunter-ubuntu-latest
3636
- name: List .hunter cache directory
3737
run: ls -a -l ~/.hunter/_Base/ || true
3838
- uses: actions/checkout@v2
3939
with:
4040
submodules: 'recursive'
4141
- name: Set up Python
4242
uses: actions/setup-python@v2
43-
with:
43+
with:
4444
python-version: 3.8
4545
- name: Install dependencies
4646
run: |
4747
python -m pip install --upgrade pip
48-
brew install libusb
49-
python -m pip install git+git://github.com/luxonis/pybind11_mkdoc.git@master
48+
sudo apt install libusb-1.0-0-dev
49+
python -m pip install -r docs/requirements_mkdoc.txt
5050
- name: Configure project
5151
run: cmake -S . -B build -DDEPTHAI_PYTHON_FORCE_DOCSTRINGS=ON -DDEPTHAI_PYTHON_DOCSTRINGS_OUTPUT="$PWD/docstrings/depthai_python_docstring.hpp"
5252
- name: Build target 'pybind11_mkdoc'
53-
run: cmake --build build --target pybind11_mkdoc --parallel
53+
run: cmake --build build --target pybind11_mkdoc --parallel 8
5454
- name: Upload docstring artifacts
5555
uses: actions/upload-artifact@v2
5656
with:
@@ -62,7 +62,7 @@ jobs:
6262
build-linux-armhf:
6363
needs: build-docstrings
6464
runs-on: luxonis-armhf
65-
container:
65+
container:
6666
image: registry.gitlab.com/luxonis/depthai-crosscompile/debian-buster
6767
# Mount local hunter cache directory, instead of transfering to Github and back
6868
volumes:
@@ -73,7 +73,7 @@ jobs:
7373
- uses: actions/checkout@v2
7474
with:
7575
submodules: 'recursive'
76-
76+
7777
- uses: actions/download-artifact@v2
7878
with:
7979
name: 'docstrings'
@@ -129,7 +129,7 @@ jobs:
129129

130130
- name: Set up Python ${{ matrix.python-version }}
131131
uses: actions/setup-python@v2
132-
with:
132+
with:
133133
python-version: ${{ matrix.python-version }}
134134
architecture: ${{ matrix.python-architecture }}
135135
- name: Append build hash if not a tagged commit
@@ -182,7 +182,7 @@ jobs:
182182

183183
- name: Set up Python ${{ matrix.python-version }}
184184
uses: actions/setup-python@v2
185-
with:
185+
with:
186186
python-version: ${{ matrix.python-version }}
187187
- name: Append build hash if not a tagged commit
188188
if: startsWith(github.ref, 'refs/tags/v') != true
@@ -197,7 +197,7 @@ jobs:
197197
- name: Building wheels
198198
run: python -m pip wheel . -w ./wheelhouse/ --verbose
199199
- name: Auditing wheels
200-
run: ci/repair-whl-macos.sh `pwd`/wheelhouse/* `pwd`/wheelhouse/audited
200+
run: ci/repair-whl-macos.sh `pwd`/wheelhouse/* `pwd`/wheelhouse/audited
201201
- name: Archive wheel artifacts
202202
uses: actions/upload-artifact@v2
203203
with:
@@ -247,7 +247,7 @@ jobs:
247247
- name: Build and install depthai-core
248248
run: |
249249
cmake -S depthai-core/ -B build_core -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$PWD/cmake/toolchain/pic.cmake
250-
cmake --build build_core --target install --parallel
250+
cmake --build build_core --target install --parallel 8
251251
echo "DEPTHAI_INSTALLATION_DIR=$PWD/build_core/install/" >> $GITHUB_ENV
252252
253253
- name: Append build hash if not a tagged commit
@@ -309,7 +309,7 @@ jobs:
309309
- name: Build and install depthai-core
310310
run: |
311311
cmake -S depthai-core/ -B build_core -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$PWD/cmake/toolchain/pic.cmake
312-
cmake --build build_core --target install --parallel
312+
cmake --build build_core --target install --parallel 8
313313
echo "DEPTHAI_INSTALLATION_DIR=$PWD/build_core/install/" >> $GITHUB_ENV
314314
315315
- name: Append build hash if not a tagged commit
@@ -336,12 +336,12 @@ jobs:
336336
if: startsWith(github.ref, 'refs/tags/v')
337337
needs: [build-linux-armhf, build-windows-x86_64, build-macos-x86_64, build-linux-x86_64, build-linux-arm64]
338338
runs-on: ubuntu-latest
339-
339+
340340
steps:
341341
- uses: actions/checkout@v2
342342
with:
343343
submodules: 'recursive'
344-
344+
345345
- name: Get tag version
346346
id: tag
347347
uses: battila7/get-version-action@v2

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ _builds/
2525

2626
#git
2727
*.orig
28+
*_REMOTE_*
29+
*_LOCAL_*
30+
*_BACKUP_*
31+
*_BASE_*
2832

2933
#ci
3034
wheelhouse/

.readthedocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ submodules:
1818
sphinx:
1919
builder: dirhtml
2020
configuration: docs/source/conf.py
21+
fail_on_warning: true
2122

2223
# Build documentation with MkDocs
2324
#mkdocs:

CMakeLists.txt

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ endif()
3131
set(TARGET_NAME depthai)
3232
project(depthai VERSION "0") # revision of bindings [depthai-core].[rev]
3333

34+
# Set default build type depending on context
35+
set(default_build_type "Release")
36+
if(EXISTS "${CMAKE_SOURCE_DIR}/.git" AND NOT DEFINED ENV{CI})
37+
set(default_build_type "Debug")
38+
endif()
39+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
40+
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
41+
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
42+
# Set the possible values of build type for cmake-gui
43+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
44+
endif()
45+
3446
# Add module paths
3547
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
3648
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/depthai-core/cmake")
@@ -63,13 +75,13 @@ endif()
6375
hunter_add_package(pybind11)
6476

6577
# Disable LTO if MINGW compiler
66-
if(MINGW)
78+
if(MINGW)
6779
set(PYBIND11_LTO_CXX_FLAGS "" CACHE STRING "" FORCE)
6880
endif()
6981
find_package(pybind11 CONFIG REQUIRED)
7082

7183
# Add files for python module
72-
pybind11_add_module(${TARGET_NAME}
84+
pybind11_add_module(${TARGET_NAME}
7385
src/py_bindings.cpp
7486
src/XLinkConnectionBindings.cpp
7587
src/DeviceBindings.cpp
@@ -93,8 +105,8 @@ endif()
93105

94106
if(DEPTHAI_PYTHON_DOCSTRINGS_OUTPUT)
95107
# If output is specified set both input and output to same the path
96-
set(docstring_input_path ${DEPTHAI_PYTHON_DOCSTRINGS_OUTPUT})
97-
set(docstring_output_path ${DEPTHAI_PYTHON_DOCSTRINGS_OUTPUT})
108+
set(docstring_input_path ${DEPTHAI_PYTHON_DOCSTRINGS_OUTPUT})
109+
set(docstring_output_path ${DEPTHAI_PYTHON_DOCSTRINGS_OUTPUT})
98110
else()
99111
# If input docstrings explicitly specified, use those and disable building
100112
if(DEPTHAI_PYTHON_DOCSTRINGS_INPUT)
@@ -103,11 +115,11 @@ else()
103115
set(DEPTHAI_PYTHON_BUILD_DOCSTRINGS OFF CACHE BOOL "Generate docstrings from header files if module 'pybind11_mkdoc' available" FORCE)
104116
else()
105117
# Otherwise set default location as input
106-
set(docstring_input_path ${DEFAULT_DOCSTRINGS_OUTPUT})
118+
set(docstring_input_path ${DEFAULT_DOCSTRINGS_OUTPUT})
107119
endif()
108120

109121
# Set default output location
110-
set(docstring_output_path ${DEFAULT_DOCSTRINGS_OUTPUT})
122+
set(docstring_output_path ${DEFAULT_DOCSTRINGS_OUTPUT})
111123
endif()
112124

113125
if(DEPTHAI_PYTHON_BUILD_DOCSTRINGS)
@@ -119,11 +131,14 @@ configure_file(cmake/docstring.hpp.in ${DOCSTRINGS_INCLUDE_PLACEHOLDER_PATH})
119131
# Add target to generate docstrings
120132
if (DEPTHAI_PYTHON_BUILD_DOCSTRINGS)
121133
include(pybind11-mkdoc)
122-
134+
123135
# Check if pybind11_mkdoc available and create target
124136
target_pybind11_mkdoc_setup(${docstring_output_path} depthai::core ${DEPTHAI_PYTHON_FORCE_DOCSTRINGS})
125-
126-
if(NOT TARGET pybind11_mkdoc)
137+
138+
if(TARGET pybind11_mkdoc)
139+
# Add dependency to mkdoc target (makes sure that mkdoc is executed, and docstrings available)
140+
add_dependencies(${TARGET_NAME} pybind11_mkdoc)
141+
else()
127142
# Generate default docstrings to OUTPUT path
128143
configure_file(cmake/default_docstring.hpp.in ${docstring_output_path} COPYONLY)
129144
endif()
@@ -136,17 +151,39 @@ endif()
136151
target_include_directories(${TARGET_NAME} PRIVATE src ${DOCSTRINGS_INCLUDE_PLACEHOLDER_DIR})
137152

138153
# Link with libraries
139-
target_link_libraries(${TARGET_NAME}
140-
PUBLIC
154+
target_link_libraries(${TARGET_NAME}
155+
PUBLIC
141156
# pybind11
142157
pybind11::pybind11
143158
depthai::core # Use non-opencv target as we use opencv-python in bindings
144159
hedley
145160
)
146161

147-
# Add default commit hash ('dev') if not build by CI
148-
if(NOT DEFINED ENV{CI} AND NOT DEPTHAI_PYTHON_COMMIT_HASH)
149-
set(DEPTHAI_PYTHON_COMMIT_HASH "dev")
162+
# Find Git
163+
find_package(Git)
164+
165+
# Add build information (commit, date)
166+
set(BUILD_COMMIT "dev")
167+
if(GIT_FOUND)
168+
execute_process(
169+
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
170+
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
171+
OUTPUT_VARIABLE BUILD_COMMIT
172+
ERROR_QUIET
173+
OUTPUT_STRIP_TRAILING_WHITESPACE
174+
)
175+
execute_process(
176+
COMMAND ${GIT_EXECUTABLE} show -s --format=%ci ${BUILD_COMMIT}
177+
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
178+
OUTPUT_VARIABLE BUILD_COMMIT_DATETIME
179+
ERROR_QUIET
180+
OUTPUT_STRIP_TRAILING_WHITESPACE
181+
)
182+
endif()
183+
184+
# Add local commit hash (or 'dev' if unable to retrieve) if not build by CI
185+
if(NOT DEFINED ENV{CI} AND NOT DEPTHAI_PYTHON_COMMIT_HASH)
186+
set(DEPTHAI_PYTHON_COMMIT_HASH ${BUILD_COMMIT})
150187
endif()
151188

152189
# Get version to use
@@ -160,8 +197,15 @@ execute_process(COMMAND ${PYTHON_EXECUTABLE} "-c" "${version_command}"
160197
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
161198
)
162199

163-
# Add version definition
164-
target_compile_definitions(${TARGET_NAME} PRIVATE DEPTHAI_PYTHON_VERSION="${DEPTHAI_PYTHON_VERSION}")
200+
201+
string(TIMESTAMP BUILD_DATETIME "%Y-%m-%d %H:%M:%S +0000" UTC)
202+
target_compile_definitions(${TARGET_NAME}
203+
PRIVATE
204+
DEPTHAI_PYTHON_VERSION="${DEPTHAI_PYTHON_VERSION}"
205+
DEPTHAI_PYTHON_COMMIT_HASH="${BUILD_COMMIT}"
206+
DEPTHAI_PYTHON_COMMIT_DATETIME="${BUILD_COMMIT_DATETIME}"
207+
DEPTHAI_PYTHON_BUILD_DATETIME="${BUILD_DATETIME}"
208+
)
165209

166210
# Set compiler features (c++14), and disables extensions
167211
set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD 14)

0 commit comments

Comments
 (0)