Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
themarpe committed Oct 13, 2021
2 parents 7516ca0 + ce8ae6d commit 876160f
Show file tree
Hide file tree
Showing 66 changed files with 2,311 additions and 743 deletions.
65 changes: 64 additions & 1 deletion .github/workflows/main.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest]
build-type: [Debug, Release]
shared: [Shared, Static]
platform: [x64]
include:
- platform: Win32
os: windows-latest
shared: Shared
build-type: Debug
- platform: Win32
os: windows-latest
shared: Shared
build-type: Release
steps:
- name: Cache .hunter folder
if: matrix.os != 'windows-latest'
Expand Down Expand Up @@ -153,8 +163,13 @@ jobs:
echo "C:\tools\opencv\build\x64\vc15\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Configure ${{ matrix.build-type }}, ${{ matrix.shared }}
if: matrix.shared == 'Shared'
if: matrix.shared == 'Shared' && matrix.platform != 'Win32'
run: cmake -S . -B build -D BUILD_SHARED_LIBS=ON -D CMAKE_BUILD_TYPE=${{ matrix.build-type }} -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/depthai_install

- name: Configure ${{ matrix.build-type }}, ${{ matrix.shared }}, Win32
if: matrix.shared == 'Shared' && matrix.platform == 'Win32'
run: cmake -A Win32 -S . -B build -D BUILD_SHARED_LIBS=ON -D CMAKE_BUILD_TYPE=${{ matrix.build-type }} -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/depthai_install

- name: Configure ${{ matrix.build-type }}, ${{ matrix.shared }}
if: matrix.shared == 'Static'
run: cmake -S . -B build -D BUILD_SHARED_LIBS=OFF -D CMAKE_BUILD_TYPE=${{ matrix.build-type }} -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/depthai_install
Expand All @@ -166,6 +181,20 @@ jobs:
- name: Build and install
run: cmake --build build --config ${{ matrix.build-type }} --target install --parallel 8

- name: Upload Win64 shared library
if: matrix.os == 'windows-latest' && matrix.shared == 'Shared'
uses: actions/upload-artifact@v2
with:
name: windows-prebuilt-win64
path: ${{ env.GITHUB_WORKSPACE }}/depthai_install/

- name: Upload Win32 shared library
if: matrix.os == 'windows-latest' && matrix.shared == 'Shared' && matrix.platform == 'Win32'
uses: actions/upload-artifact@v2
with:
name: windows-prebuilt-win32-no-opencv
path: ${{ env.GITHUB_WORKSPACE }}/depthai_install/

- name: Build and test add_subdirectory
run: |
cmake -S tests/integration/ -B tests/integration/build_add_subdirectory -D TEST_FIND_PACKAGE=OFF
Expand Down Expand Up @@ -214,10 +243,24 @@ jobs:
- name: Install dependencies
run: python3.8 -m pip install git-archive-all

- name: Download Win64 artifacts
uses: actions/download-artifact@v2
with:
name: 'windows-prebuilt-win64'
path: depthai-core-${{ steps.tag.outputs.version }}-win64

- name: Download Win32 artifacts
uses: actions/download-artifact@v2
with:
name: 'windows-prebuilt-win32-no-opencv'
path: depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv

- name: Create release assets
run: |
git-archive-all depthai-core-${{ steps.tag.outputs.version }}.tar.gz
git-archive-all depthai-core-${{ steps.tag.outputs.version }}.zip
zip -r depthai-core-${{ steps.tag.outputs.version }}-win64.zip depthai-core-${{ steps.tag.outputs.version }}-win64
zip -r depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv.zip depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv
# Create GitHub release
- uses: actions/create-release@master
Expand Down Expand Up @@ -257,3 +300,23 @@ jobs:
asset_path: ${{ github.workspace }}/depthai-core-${{ steps.tag.outputs.version }}.tar.gz
asset_name: depthai-core-${{ steps.tag.outputs.version }}.tar.gz
asset_content_type: application/octet-stream

- name: Upload Win64 package (zip)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createRelease.outputs.upload_url }}
asset_path: ${{ github.workspace }}/depthai-core-${{ steps.tag.outputs.version }}-win64.zip
asset_name: depthai-core-${{ steps.tag.outputs.version }}-win64.zip
asset_content_type: application/octet-stream

- name: Upload Win32 package (zip)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createRelease.outputs.upload_url }}
asset_path: ${{ github.workspace }}/depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv.zip
asset_name: depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv.zip
asset_content_type: application/octet-stream
17 changes: 16 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if(WIN32)
endif()

# Create depthai project
project(depthai VERSION "2.10.0" LANGUAGES CXX C)
project(depthai VERSION "2.11.0" LANGUAGES CXX C)
get_directory_property(has_parent PARENT_DIRECTORY)
if(has_parent)
set(DEPTHAI_VERSION ${PROJECT_VERSION} PARENT_SCOPE)
Expand Down Expand Up @@ -77,6 +77,13 @@ option(DEPTHAI_INSTALL "Enable install target for depthai-core targets" ON)
# Debug option
set(DEPTHAI_XLINK_LOCAL "" CACHE STRING "Path to local XLink source to use instead of Hunter")

# Enable backward stack printing on crash
option(DEPTHAI_ENABLE_BACKWARD "Enable stacktrace printing on crash using Backward" ON)
# Additional function information for 'backward' stacktrace
if(DEPTHAI_ENABLE_BACKWARD)
set(CMAKE_ENABLE_EXPORTS ON)
endif()

### Constants
set(PROJECT_EXPORT_GROUP "${PROJECT_NAME}Targets")

Expand Down Expand Up @@ -181,6 +188,7 @@ add_library(${TARGET_CORE_NAME}
src/pipeline/datatype/FeatureTrackerConfig.cpp
src/utility/Initialization.cpp
src/utility/Resources.cpp
src/utility/Platform.cpp
src/xlink/XLinkConnection.cpp
src/xlink/XLinkStream.cpp
src/openvino/OpenVINO.cpp
Expand Down Expand Up @@ -366,6 +374,7 @@ target_link_libraries(${TARGET_CORE_NAME}
FP16::fp16
archive_static
spdlog::spdlog
ZLIB::zlib
)

# Add compile definitions
Expand All @@ -379,6 +388,12 @@ target_compile_definitions(${TARGET_CORE_NAME}
DEPTHAI_BOOTLOADER_VERSION="${DEPTHAI_BOOTLOADER_VERSION}"
)

# Add Backward dependency if enabled (On by default)
if(DEPTHAI_ENABLE_BACKWARD)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_BACKWARD)
target_link_libraries(${TARGET_CORE_NAME} PRIVATE Backward::Backward)
endif()

# Add patch only mode definition
if(DEPTHAI_USB2_PATCH_ONLY_MODE)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_PATCH_ONLY_MODE)
Expand Down
4 changes: 3 additions & 1 deletion cmake/Depthai/DepthaiBootloaderConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Maturity level "snapshot" / "release"
set(DEPTHAI_BOOTLOADER_MATURITY "release")
#set(DEPTHAI_BOOTLOADER_MATURITY "snapshot")

# "version if applicable"
set(DEPTHAI_BOOTLOADER_VERSION "0.0.12")
set(DEPTHAI_BOOTLOADER_VERSION "0.0.15")
#set(DEPTHAI_BOOTLOADER_VERSION "870bec4ca0ef026ddb9c490a38dfe9d097614554")
2 changes: 1 addition & 1 deletion cmake/Depthai/DepthaiDeviceSideConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")

# "full commit hash of device side binary"
set(DEPTHAI_DEVICE_SIDE_COMMIT "7131affa2c01ecd34506e9c3dd8ea9198ed874f1")
set(DEPTHAI_DEVICE_SIDE_COMMIT "48cf187bb144bd5867c78bf17178e9e050b7167c")

# "version if applicable"
set(DEPTHAI_DEVICE_SIDE_VERSION "")
16 changes: 13 additions & 3 deletions cmake/Hunter/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ hunter_config(

hunter_config(
XLink
VERSION "luxonis-2021.3-master"
URL "https://github.com/luxonis/XLink/archive/2c6cdb857f3d21088b34ec172a0ea8df16528d00.tar.gz"
SHA1 "736da6528515d9c969008e2334f1387428f91a3b"
VERSION "luxonis-2021.3-develop"
URL "https://github.com/luxonis/XLink/archive/4c149080d22c35a17ce285f5bca99f2b2fe05e46.tar.gz"
SHA1 "64b0a8bfeb1a91f909df88ea8b1d0b17885b92ff"
)

hunter_config(
Expand Down Expand Up @@ -74,4 +74,14 @@ hunter_config(
CMAKE_ARGS
FP16_BUILD_BENCHMARKS=OFF
FP16_BUILD_TESTS=OFF
)

# Backward - Stacktrace printer
hunter_config(
Backward
VERSION "1.6"
URL "https://github.com/bombela/backward-cpp/archive/refs/tags/v1.6.tar.gz"
SHA1 "4ecb711eabfd15bc88ff9dd9342907fc5da46b62"
CMAKE_ARGS
BACKWARD_TESTS=OFF
)
5 changes: 4 additions & 1 deletion cmake/depthaiConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Get whether library was build as shared or not
set(depthai_SHARED_LIBS @BUILD_SHARED_LIBS@)
set(DEPTHAI_SHARED_LIBS @BUILD_SHARED_LIBS@)

# Get whether library was build with Backward or not
set(DEPTHAI_ENABLE_BACKWARD @DEPTHAI_ENABLE_BACKWARD@)

# Specify that this is config mode (Called by find_package)
set(CONFIG_MODE TRUE)
Expand Down
25 changes: 20 additions & 5 deletions cmake/depthaiDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if(CONFIG_MODE)
set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/${_IMPORT_PREFIX}" ${CMAKE_PREFIX_PATH})
set(_QUIET "QUIET")
else()
set(depthai_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(DEPTHAI_SHARED_LIBS ${BUILD_SHARED_LIBS})
hunter_add_package(nlohmann_json)
if(NOT DEPTHAI_XLINK_LOCAL)
hunter_add_package(XLink)
Expand All @@ -12,11 +12,15 @@ else()
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()
endif()

# If library was build as static, find all dependencies
if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT depthai_SHARED_LIBS))
if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS))

# BZip2 (for bspatch)
find_package(BZip2 ${_QUIET} CONFIG REQUIRED)

Expand All @@ -26,10 +30,21 @@ if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT depthai_SHARED_LIBS))
# 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)
find_package(Backward ${_QUIET} CONFIG REQUIRED)
set(STACK_DETAILS_AUTO_DETECT)
endif()

endif()

# Add threads (c++)
Expand All @@ -54,5 +69,5 @@ if(CONFIG_MODE)
set(_CMAKE_PREFIX_PATH_ORIGINAL)
set(_QUIET)
else()
set(depthai_SHARED_LIBS)
set(DEPTHAI_SHARED_LIBS)
endif()
7 changes: 5 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ target_compile_definitions(object_tracker_video PRIVATE BLOB_PATH="${person_dete
dai_add_example(queue_add_callback src/queue_add_callback.cpp ON)

dai_add_example(bootloader_version src/bootloader_version.cpp ON)
#dai_add_example(flash_bootloader src/flash_bootloader.cpp OFF)
dai_add_example(flash_bootloader src/flash_bootloader.cpp OFF)
dai_add_example(edge_detector src/edge_detector.cpp ON)

dai_add_example(feature_tracker src/feature_tracker.cpp ON)
Expand All @@ -289,4 +289,7 @@ dai_add_example(image_manip_tiling src/image_manip_tiling.cpp ON)

target_compile_definitions(calibration_flash PRIVATE CALIB_PATH="${calib_v6}")
target_compile_definitions(calibration_flash_version5 PRIVATE CALIB_PATH="${calib_v5}" BOARD_PATH="${device_config}")
target_compile_definitions(calibration_load PRIVATE CALIB_PATH="${calib_v6}")
target_compile_definitions(calibration_load PRIVATE CALIB_PATH="${calib_v6}")

# Bootloader configuration example
dai_add_example(bootloader_config src/bootloader_config.cpp OFF)
68 changes: 68 additions & 0 deletions examples/src/bootloader_config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include "depthai/depthai.hpp"

int main(int argc, char** argv) {
// Options
bool usage = false, read = true, clear = false;
std::string path = "";
if(argc >= 2) {
std::string op = argv[1];
if(op == "read") {
read = true;
} else if(op == "flash") {
read = false;
if(argc >= 3) {
path = argv[2];
}
} else if(op == "clear") {
clear = true;
read = false;
} else if(op == "clear") {
clear = true;
read = false;
} else {
usage = true;
}
} else {
usage = true;
}
if(usage) {
std::cout << "Usage: " << argv[0] << " [read/flash/clear] [flash: path/to/config/json]" << std::endl;
return -1;
}

// DeviceBootloader configuration
bool res = false;
dai::DeviceInfo info;
std::tie(res, info) = dai::DeviceBootloader::getFirstAvailableDevice();

if(res) {
std::cout << "Found device with name: " << info.desc.name << std::endl;
dai::DeviceBootloader bl(info);

if(read) {
std::cout << "Current flashed configuration\n" << bl.readConfigData().dump(4) << std::endl;
} else {
bool success;
std::string error;
if(clear) {
std::tie(success, error) = bl.flashConfigClear();
} else {
if(path.empty()) {
std::tie(success, error) = bl.flashConfig(dai::DeviceBootloader::Config{});
} else {
std::tie(success, error) = bl.flashConfigFile(path);
}
}
if(success) {
std::cout << "Successfully flashed bootloader configuration\n";
} else {
std::cout << "Error flashing bootloader configuration: " << error;
}
}

} else {
std::cout << "No devices found" << std::endl;
}

return 0;
}
3 changes: 1 addition & 2 deletions examples/src/bootloader_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ int main(int argc, char** argv) {
bool res = false;
dai::DeviceInfo info;
std::tie(res, info) = dai::DeviceBootloader::getFirstAvailableDevice();
std::string path;

if(res) {
std::cout << "Found device with name: " << info.desc.name << std::endl;
dai::DeviceBootloader bl(info, path);
dai::DeviceBootloader bl(info);
std::cout << "Version: " << bl.getVersion().toString() << std::endl;
} else {
std::cout << "No devices found" << std::endl;
Expand Down
Loading

0 comments on commit 876160f

Please sign in to comment.