Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge traversaro "2_27_0_fetchcontent conda" branch into idjl-software fork #1

Merged
merged 55 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
b1a4733
Add log reporting
May 29, 2024
8c1efa0
Formatting
May 29, 2024
39f5f4b
Clean up
May 29, 2024
920777e
Add more fields
May 29, 2024
e041ab2
[FW] Update firmware
May 29, 2024
11657a5
Remove cryptocpp dependency
May 29, 2024
41c714e
Remove unused headers
May 29, 2024
71d506c
Update CI scripts
May 29, 2024
adae620
Change the filesystem version
May 29, 2024
a960f8b
Update CURL
May 29, 2024
732757f
Remove pthread include
May 30, 2024
2ab0e89
Lower CURL version to support older CMake versions
May 30, 2024
0105045
Clangformat
May 30, 2024
5fe37cb
Make curl optional
May 30, 2024
0dfb4eb
Remove choco from testing windows
May 30, 2024
82b7311
Update README
May 30, 2024
c09a6d2
Save whether the library was compiled with CURL support
May 30, 2024
879bedb
Renaming cast examples (#1032)
jakaskerl May 30, 2024
84fb7f4
Don't use CURL support on 32bit arm
May 30, 2024
ea34b63
Use native TLS on windows
May 31, 2024
f1b4e23
Fix build - only set SCHANNEL for windows
May 31, 2024
f588e47
Code cleanup
May 31, 2024
f5ccd02
Don't use the version from hunter
May 31, 2024
642f3bb
Calculate SHA1 with a header only library
May 31, 2024
7cf9ee2
Rename to enable curl
May 31, 2024
38d0c91
Add commit hash to version
May 31, 2024
91efdbd
Don't build OPENSSL on windows
Jun 1, 2024
9894921
Update device side and shared
Jun 3, 2024
d76b6c1
Update device side with matched depthai-shared
Jun 3, 2024
001e575
Merge pull request #1031 from luxonis/log_collection
moratom Jun 3, 2024
fa41447
Default to no curl support on ARM32
Jun 3, 2024
34c118b
Add a cmake print
Jun 3, 2024
512c7ba
Move the check for 32 bit
Jun 3, 2024
2214af3
setIsp3aFps deprecation
Jun 5, 2024
3d9f596
Update README for RPM installs
Jun 5, 2024
16364f7
Change log collection to opt in system instead of opt out
Jun 10, 2024
4bdfecd
Merge branch 'log_collection_opt_in' into develop
Jun 10, 2024
505f8ef
Add support for Visual Studio 2022 version 17.10
Jun 12, 2024
08ac4ea
FW: fix BNO086 IMU init failure (not detected) with heavier pipelines,
alex-luxonis Jun 12, 2024
74d57f5
Merge pull request #1037 from luxonis/fix_build_windows
moratom Jun 13, 2024
d947c00
FW: fix IMX214 (OAK Lite) potential crash on init with more complex p…
alex-luxonis Jun 14, 2024
da4bb3c
FW: fix potential restart failure with IMX214 (VCM I2C stuck),
alex-luxonis Jun 18, 2024
e2e8fef
Merge remote-tracking branch 'origin/main' into release_2.27.0
Jun 25, 2024
47738b4
Bump the version
Jun 25, 2024
5619de5
Fix info about the `perl-core` dependancy in README.md
moratom Jun 25, 2024
99ad376
Add a comment on SHA1 calculation
Jun 25, 2024
9cb397d
Update XLink to master
Jun 25, 2024
729e478
Merge pull request #1045 from luxonis/release_2.27.0
moratom Jun 26, 2024
7eb8186
Support compilation against spdlog 1.14 with fmt 10
traversaro Jun 28, 2024
b08f750
Support install and compilation of tests and examples with HUNTER_ENA…
traversaro Jun 29, 2024
c8d89cb
Support using non-hunter version of bzip2, zlib and libarchive if HUN…
traversaro Jun 29, 2024
3cb4874
If HUNTER_ENABLED=OFF, check if XLink, libnop and FP16 have been alre…
traversaro Jun 29, 2024
f281ea1
Use absolute URLs for the git submodules
traversaro Jun 29, 2024
cc96dd1
Do not add Werror as it could create unexpected failures in new compi…
traversaro Jun 30, 2024
0f0785e
Merge remote-tracking branch 'upstream/2_27_0_fetchcontent_conda' int…
Luca0101 Jan 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "shared/depthai-shared"]
path = shared/depthai-shared
url = ../depthai-shared.git
url = https://github.com/luxonis/depthai-shared.git
[submodule "shared/depthai-bootloader-shared"]
path = shared/depthai-bootloader-shared
url = ../depthai-bootloader-shared.git
url = https://github.com/luxonis/depthai-bootloader-shared.git
129 changes: 119 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ endif()
# Early options
option(DEPTHAI_ENABLE_LIBUSB "Enable usage of libusb and interaction with USB devices" ON)

# Set to use native tls for windows before including Hunter (used for Curl)
if(WIN32)
set(DEPTHAI_CURL_USE_SCHANNEL ON)
set(DEPTHAI_CURL_USE_OPENSSL OFF)
else()
set(DEPTHAI_CURL_USE_SCHANNEL OFF)
set(DEPTHAI_CURL_USE_OPENSSL ON)
endif()

# Set type to canonicalize relative paths for user-provided toolchain
set(CMAKE_TOOLCHAIN_FILE "" CACHE FILEPATH "CMake toolchain path")

Expand All @@ -35,8 +44,8 @@ endif()

include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.322.tar.gz"
SHA1 "cb0ea1f74f4a2c49a807de34885743495fccccbe"
URL "https://github.com/cpp-pm/hunter/archive/9d9242b60d5236269f894efd3ddd60a9ca83dd7f.tar.gz"
SHA1 "16cc954aa723bccd16ea45fc91a858d0c5246376"
LOCAL # Local config for dependencies
)

Expand All @@ -46,7 +55,7 @@ if(WIN32)
endif()

# Create depthai project
project(depthai VERSION "2.26.0" LANGUAGES CXX C)
project(depthai VERSION "2.27.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 @@ -111,6 +120,16 @@ else()
endif()
endif()

# Check if on 32 bit linux - default without CURL support
if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND UNIX)
set(DEPTHAI_DEFAULT_CURL_SUPPORT OFF)
else()
set(DEPTHAI_DEFAULT_CURL_SUPPORT ON)
endif()

option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT})
message(STATUS "CURL support: ${DEPTHAI_ENABLE_CURL}")

# Force Colored output when using Ninja
# Global option - affects all targets
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)" OFF)
Expand Down Expand Up @@ -167,6 +186,8 @@ endif()

# Include project dependencies
set(DEPTHAI_DEPENDENCY_INCLUDE "" CACHE FILEPATH "Optional cmake file to append to dependency processing, e.g. additional find_package()")
# Set as it is used in depthaiDependencies
set(DEPTHAI_HUNTER_ENABLED ${HUNTER_ENABLED})
include(depthaiDependencies)

# Add threads preference
Expand Down Expand Up @@ -266,6 +287,7 @@ add_library(${TARGET_CORE_NAME}
src/utility/XLinkGlobalProfilingLogger.cpp
src/utility/Logging.cpp
src/utility/EepromDataParser.cpp
src/utility/LogCollection.cpp
src/xlink/XLinkConnection.cpp
src/xlink/XLinkStream.cpp
src/openvino/OpenVINO.cpp
Expand Down Expand Up @@ -441,6 +463,32 @@ if(DEPTHAI_CLANG_FORMAT)
target_clangformat_setup(${TARGET_CORE_NAME} "${header_dirs}")
endif()

# Some libraries have target names that change between the hunter/luxonis fork
# and the upstream version. If HUNTER_ENABLED is ON we want to force the
# use of the hunter/luxonis fork target, otherwise if HUNTER_ENABLED is OFF we
# fallback to the upstream target name if the hunter/luxonis fork one is not available
if(HUNTER_ENABLED)
set(DEPTHAI_BZIP2_TARGET "BZip2::bz2")
set(DEPTHAI_ARCHIVE_TARGET "archive_static")
set(DEPTHAI_ZLIB_TARGET "ZLIB::zlib")
else()
if(TARGET BZip2::bz2)
set(DEPTHAI_BZIP2_TARGET "BZip2::bz2")
else()
set(DEPTHAI_BZIP2_TARGET "BZip2::BZip2")
endif()
if(TARGET archive_static)
set(DEPTHAI_ARCHIVE_TARGET "archive_static")
else()
set(DEPTHAI_ARCHIVE_TARGET "LibArchive::LibArchive")
endif()
if(TARGET ZLIB::zlib)
set(DEPTHAI_ZLIB_TARGET "ZLIB::zlib")
else()
set(DEPTHAI_ZLIB_TARGET "ZLIB::ZLIB")
endif()
endif()

# link libraries
target_link_libraries(${TARGET_CORE_NAME}
PUBLIC
Expand All @@ -451,13 +499,22 @@ target_link_libraries(${TARGET_CORE_NAME}
PRIVATE
XLink
Threads::Threads
BZip2::bz2
${DEPTHAI_BZIP2_TARGET}
FP16::fp16
archive_static
${DEPTHAI_ARCHIVE_TARGET}
spdlog::spdlog
ZLIB::zlib
${DEPTHAI_ZLIB_TARGET}
ghcFilesystem::ghc_filesystem
)

if(DEPTHAI_ENABLE_CURL)
target_link_libraries(${TARGET_CORE_NAME} PRIVATE
CURL::libcurl
cpr::cpr
)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_CURL)
endif()

# Add compile & CMake definitions
set(DEPTHAI_DEVICE_VERSION "${DEPTHAI_DEVICE_SIDE_COMMIT}")
target_compile_definitions(${TARGET_CORE_NAME}
Expand Down Expand Up @@ -495,7 +552,11 @@ macro(add_runtime_dependencies depending_target dependency)
set(dlls ${depthai_dll_libraries} $<$<CONFIG:${cfg}>:${dll}>)
endforeach()
endif()
file(GLOB depthai_dll_libraries "${HUNTER_INSTALL_PREFIX}/bin/*.dll")
if(HUNTER_ENABLED)
file(GLOB depthai_dll_libraries "${HUNTER_INSTALL_PREFIX}/bin/*.dll")
else()
set(depthai_dll_libraries "")
endif()
# Create a list of required dll files
set(required_dll_files ${dlls} ${depthai_dll_libraries})
# Copy the required dlls
Expand Down Expand Up @@ -655,6 +716,50 @@ if(DEPTHAI_SANITIZE)
endif()
endif()

# Support use of hunter_private_data (used by tests and examples) even if HUNTER_ENABLED is OFF
if(NOT HUNTER_ENABLED)
if(NOT COMMAND hunter_private_data)
function(hunter_private_data)
set(one URL SHA1 CREDENTIALS LOCATION FILE)
set(multiple HTTPHEADER)

cmake_parse_arguments(x "" "${one}" "${multiple}" "${ARGN}")

if(x_HTTPHEADER)
message(FATAL_ERROR "HTTPHEADER argument of hunter_private_data not supported if HUNTER_ENABLED is OFF")
endif()
if(x_CREDENTIALS)
message(FATAL_ERROR "CREDENTIALS argument of hunter_private_data not supported if HUNTER_ENABLED is OFF")
endif()

if(NOT x_URL)
message(FATAL_ERROR "URL not provided to hunter_private_data")
endif()
if(NOT x_SHA1)
message(FATAL_ERROR "SHA1 not provided to hunter_private_data")
endif()
if(NOT x_FILE)
message(FATAL_ERROR "FILE not provided to hunter_private_data")
endif()
if(NOT x_LOCATION)
message(FATAL_ERROR "LOCATION not provided to hunter_private_data")
endif()

set(x_DOWNLOAD_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/_hunter_private_data/${x_FILE}")

file(DOWNLOAD
${x_URL}
${x_DOWNLOAD_LOCATION}
EXPECTED_HASH SHA1=${x_SHA1}
TLS_VERIFY ON
)

# Set the output variable
set(${x_LOCATION} "${x_DOWNLOAD_LOCATION}" PARENT_SCOPE)
endfunction()
endif()
endif()

########################
# Testing infrastructure
########################
Expand Down Expand Up @@ -714,7 +819,9 @@ configure_file("cmake/${PROJECT_NAME}Dependencies.cmake" ${PROJECT_NAME}Dependen
write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY AnyNewerVersion)

# Configure config file (one for exporting build directory, one for installation)
file(RELATIVE_PATH DEPTHAI_DEPENDENCIES_INSTALLATION_PATH_REL "${CMAKE_CURRENT_BINARY_DIR}" "${HUNTER_INSTALL_PREFIX}")
if(HUNTER_ENABLED)
file(RELATIVE_PATH DEPTHAI_DEPENDENCIES_INSTALLATION_PATH_REL "${CMAKE_CURRENT_BINARY_DIR}" "${HUNTER_INSTALL_PREFIX}")
endif()
configure_file(cmake/${PROJECT_NAME}Config.cmake.in ${PROJECT_NAME}Config.cmake @ONLY)

# Config for installation
Expand Down Expand Up @@ -753,8 +860,10 @@ if(DEPTHAI_INSTALL)
install(DIRECTORY "${DEPTHAI_SHARED_3RDPARTY_INCLUDE}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${DEPTHAI_SHARED_3RDPARTY_HEADERS_PATH}")
# Install depthai-bootloader-shared public headers
install(DIRECTORY "${DEPTHAI_BOOTLOADER_SHARED_PUBLIC_INCLUDE}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
# Install Hunter dependencies
install(DIRECTORY "${HUNTER_INSTALL_PREFIX}/" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/dependencies")
if(HUNTER_ENABLED)
# Install Hunter dependencies
install(DIRECTORY "${HUNTER_INSTALL_PREFIX}/" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/dependencies")
endif()
# Install resources if not RC'd
if(NOT DEPTHAI_BINARIES_RESOURCE_COMPILE)
install(DIRECTORY "${DEPTHAI_RESOURCES_OUTPUT_DIR}/" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}")
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ To install PCL:
MacOS: `brew install pcl`
Linux: `sudo apt install libpcl-dev`

> ℹ️ On Linux distributions based on RPMs, you need to install `perl-core` required by OpenSSL dependency.
>```
>sudo yum install perl-core
>```
>
> Another option is to disable CURL support by setting `DEPTHAI_ENABLE_CURL=OFF` when configuring CMake.
> ```
> cmake -S. -Bbuild -D'DEPTHAI_ENABLE_CURL=OFF'
> ```
## Building

Make sure submodules are updated
Expand Down Expand Up @@ -194,7 +203,8 @@ The following environment variables can be set to alter default behavior of the
| DEPTHAI_LIBUSB_ANDROID_JAVAVM | JavaVM pointer that is passed to libusb for rootless Android interaction with devices. Interpreted as decimal value of uintptr_t |
| DEPTHAI_CRASHDUMP | Directory in which to save the crash dump. |
| DEPTHAI_CRASHDUMP_TIMEOUT | Specifies the duration in seconds to wait for device reboot when obtaining a crash dump. Crash dump retrieval disabled if 0. |
| DEPTHAI_PCL_SUPPORT | Enables PCL support. |
| DEPTHAI_ENABLE_FEEDBACK_PIPELINE | Enables automatic pipeline schema collection used to improve the library |
| DEPTHAI_ENABLE_FEEDBACK_CRASHDUMP | Enables automatic crash dump collection used to improve the library |

## Running tests

Expand Down
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 "24a3b465b979de3f69410cd225914d8bd029f3ba")
set(DEPTHAI_DEVICE_SIDE_COMMIT "9822af7082d67b87c5307b9c37ec7f6ab8e1bbce")

# "version if applicable"
set(DEPTHAI_DEVICE_SIDE_VERSION "")
15 changes: 8 additions & 7 deletions cmake/Flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ function(add_default_flags target)
# add_flag(${target} -Wno-gnu-zero-variadic-macro-arguments) # https://stackoverflow.com/questions/21266380/is-the-gnu-zero-variadic-macro-arguments-safe-to-ignore

# promote to errors
add_flag(${target} -Werror=self-assign-field) # error if self assign - bugprone
add_flag(${target} -Werror=unused-lambda-capture) # error if lambda capture is unused
add_flag(${target} -Werror=return-type) # warning: control reaches end of non-void function [-Wreturn-type]
add_flag(${target} -Werror=non-virtual-dtor) # warn the user if a class with virtual functions has a non-virtual destructor. This helps catch hard to track down memory errors
add_flag(${target} -Werror=sign-compare) # warn the user if they compare a signed and unsigned numbers
add_flag(${target} -Werror=reorder) # field '$1' will be initialized after field '$2'
add_flag(${target} -Werror=switch-enum) # if switch case is missing - error
# Do not add Werror
# add_flag(${target} -Werror=self-assign-field) # error if self assign - bugprone
# add_flag(${target} -Werror=unused-lambda-capture) # error if lambda capture is unused
# add_flag(${target} -Werror=return-type) # warning: control reaches end of non-void function [-Wreturn-type]
# add_flag(${target} -Werror=non-virtual-dtor) # warn the user if a class with virtual functions has a non-virtual destructor. This helps catch hard to track down memory errors
# add_flag(${target} -Werror=sign-compare) # warn the user if they compare a signed and unsigned numbers
# add_flag(${target} -Werror=reorder) # field '$1' will be initialized after field '$2'
# add_flag(${target} -Werror=switch-enum) # if switch case is missing - error
endif()

elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
Expand Down
38 changes: 34 additions & 4 deletions cmake/Hunter/config.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
hunter_config(
nlohmann_json
VERSION "3.9.1"
URL "https://github.com/nlohmann/json/archive/v3.9.1.tar.gz"
SHA1 "f8a20a7e19227906d77de0ede97468fbcfea03e7"
)

hunter_config(
XLink
VERSION "luxonis-2021.4.2-xlink-linkid-race-fix"
URL "https://github.com/luxonis/XLink/archive/e9eb1ef38030176ad70cddd3b545d5e6c509f1e1.tar.gz"
SHA1 "b1e4ded41cd7b9c37189468e2aaddbb10cbda9f6"
URL "https://github.com/luxonis/XLink/archive/e0eddd9f98c5eacecd4134cbdb713b3d7be039b8.tar.gz"
SHA1 "c97a20d98ce3a5e35cf922c5aaad7e861569869d"
CMAKE_ARGS
XLINK_ENABLE_LIBUSB=${DEPTHAI_ENABLE_LIBUSB}
)
Expand Down Expand Up @@ -126,3 +124,35 @@ hunter_config(
# Build shared libs by default to not cause licensing issues
BUILD_SHARED_LIBS=ON
)

hunter_config(
CURL
VERSION "7.88.1-p0-custom"
URL "https://github.com/cpp-pm/curl/archive/25d45e89d140d6ab27103cd7f8f6d7d6cf548d47.tar.gz"
SHA1 "db96d87e078e529a90dfb74de8d360a785c053aa"
CMAKE_ARGS
BUILD_CURL_TESTS=OFF
BUILD_CURL_EXE=OFF
CURL_USE_SCHANNEL=${DEPTHAI_CURL_USE_SCHANNEL}
CURL_USE_OPENSSL=${DEPTHAI_CURL_USE_OPENSSL} # Override hunter flags - no OpenSSL needed on Windows
BUILD_STATIC_CURL=ON
BUILD_SHARED_LIBS=OFF
BUILD_STATIC_LIBS=ON
)

hunter_config(
cpr
VERSION "1.4.0"
URL "https://github.com/luxonis/cpr/archive/a1d28dbbaccda3df8fddd993b2cd916f64f9da56.tar.gz"
SHA1 "14e18d04d05e36e920aa90ee744952bf55783ea4"
)

hunter_config(
ghc_filesystem
VERSION "1.5.14-luxonis"
URL "https://github.com/luxonis/filesystem/archive/d29630953f3526b61842d937764f012503a79ec3.tar.gz"
SHA1 "1cee5c95b53e014710970c920230ad1d3f3b5055"
CMAKE_ARGS
GHC_FILESYSTEM_BUILD_EXAMPLES=OFF
GHC_FILESYSTEM_BUILD_TESTING=OFF
)
5 changes: 5 additions & 0 deletions cmake/depthaiConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ set(DEPTHAI_SHARED_LIBS @BUILD_SHARED_LIBS@)
# Get whether library was build with Backward or not
set(DEPTHAI_ENABLE_BACKWARD @DEPTHAI_ENABLE_BACKWARD@)

set(DEPTHAI_ENABLE_CURL @DEPTHAI_ENABLE_CURL@)

# Get if the library was built with Hunter or not
set(DEPTHAI_HUNTER_ENABLED @HUNTER_ENABLED@)

# Specify that this is config mode (Called by find_package)
set(CONFIG_MODE TRUE)

Expand Down
Loading
Loading