-
Notifications
You must be signed in to change notification settings - Fork 154
cmake: Add option to enable Hunter to fetch data #1303
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
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Left a comment but otherwise LGTM.
c006896
to
5340a08
Compare
For the C++ examples there's redefinition of Lenna images to download. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When compiled with cmake flags
-DDEPTHAI_TEST_EXAMPLES=ON -DDEPTHAI_FETCH_ARTIFACTS=OFF
a handful of examples, specifically those that depend on those external artifacts, won't run. I think those examples should only be built if their artifacts are present, i.e. they too should be in the if(DEPTHAI_FETCH_ARTIFACTS)
blocks.
Otherwise, LGTM.
Okay, will look at those and add the check around as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Conditional Variables Used Unconditionally
The april_tags
and recording_path
variables are defined conditionally within if(DEPTHAI_FETCH_ARTIFACTS)
blocks. However, they are used unconditionally in target_compile_definitions
. When DEPTHAI_FETCH_ARTIFACTS
is OFF, these variables become undefined, which can lead to CMake configuration errors or empty/invalid paths being passed to the compile definitions.
examples/cpp/RecordReplay/CMakeLists.txt#L22-L23
depthai-core/examples/cpp/RecordReplay/CMakeLists.txt
Lines 22 to 23 in be1345a
dai_add_example(holistic_replay holistic_replay.cpp ON OFF) | |
target_compile_definitions(holistic_replay PRIVATE RECORDING_PATH="${recording_path}") |
examples/cpp/AprilTags/CMakeLists.txt#L23-L24
depthai-core/examples/cpp/AprilTags/CMakeLists.txt
Lines 23 to 24 in be1345a
dai_add_example(april_tags_replay april_tags_replay.cpp ON OFF) | |
target_compile_definitions(april_tags_replay PRIVATE APRIL_TAGS_PATH="${april_tags}") |
Bug: CMake Variables Undefined When Fetching Artifacts Off
When DEPTHAI_FETCH_ARTIFACTS
is OFF
, CMake variables defined by private_data()
calls (e.g., lenna
, construction_vest
, and various test-related paths like superblob_path
, mobilenet_blob
, openvino_*_blob
, yolo_*_nnarchive_path
, lenna_png
, recording_path
) become undefined. These variables are used unconditionally in target_compile_definitions
across example and test CMakeLists files, leading to CMake configuration errors or empty paths being passed to compiled code, which can cause runtime issues or test failures.
examples/cpp/NeuralNetwork/CMakeLists.txt#L20-L25
depthai-core/examples/cpp/NeuralNetwork/CMakeLists.txt
Lines 20 to 25 in be1345a
dai_add_example(neural_network_multi_input neural_network_multi_input.cpp ON OFF) | |
target_compile_definitions(neural_network_multi_input PRIVATE LENNA_PATH="${lenna}") | |
dai_set_example_test_labels(neural_network_multi_input ondevice rvc2_all rvc4 ci) | |
dai_add_example(neural_network_multi_input_combined neural_network_multi_input_combined.cpp ON OFF) | |
target_compile_definitions(neural_network_multi_input_combined PRIVATE LENNA_PATH="${lenna}") |
examples/cpp/ImageManip/CMakeLists.txt#L24-L25
depthai-core/examples/cpp/ImageManip/CMakeLists.txt
Lines 24 to 25 in be1345a
dai_add_example(image_manip_all_ops image_manip_all_ops.cpp ON OFF) | |
target_compile_definitions(image_manip_all_ops PRIVATE LENNA_PATH="${lenna}") |
tests/CMakeLists.txt#L239-L458
depthai-core/tests/CMakeLists.txt
Lines 239 to 458 in be1345a
# Superblob test | |
dai_add_test(openvino_test src/onhost_tests/openvino/openvino_test.cpp) | |
target_compile_definitions(openvino_test PRIVATE SUPERBLOB_PATH="${superblob_path}") | |
dai_set_test_labels(openvino_test onhost ci) | |
# NNArchive test | |
dai_add_test(nn_archive_test src/onhost_tests/nn_archive/nn_archive_test.cpp) | |
target_compile_definitions(nn_archive_test PRIVATE | |
BLOB_ARCHIVE_PATH="${yolo_blob_nnarchive_path}" | |
SUPERBLOB_ARCHIVE_PATH="${yolo_superblob_nnarchive_path}" | |
ONNX_ARCHIVE_PATH="${yolo_onnx_nnarchive_path}" | |
) | |
dai_set_test_labels(nn_archive_test onhost ci) | |
# Eeprom naming parsing tests | |
dai_add_test(naming_test src/onhost_tests/naming_test.cpp) | |
dai_set_test_labels(naming_test onhost ci) | |
# Image transformations test | |
dai_add_test(image_transformations_test src/onhost_tests/image_transformations_test.cpp) | |
dai_set_test_labels(image_transformations_test onhost ci) | |
# Normalization tests | |
dai_add_test(normalization_test src/onhost_tests/normalization_test.cpp) | |
dai_set_test_labels(normalization_test onhost ci) | |
# MessageQueue tests | |
dai_add_test(message_queue_test src/onhost_tests/message_queue_test.cpp) | |
dai_set_test_labels(message_queue_test onhost ci) | |
# StreamMessageParser tests | |
dai_add_test(stream_message_parser_test src/onhost_tests/stream_message_parser_test.cpp) | |
dai_set_test_labels(stream_message_parser_test onhost ci) | |
# Bootloader version tests | |
dai_add_test(bootloader_version_test src/onhost_tests/bootloader_version_test.cpp) | |
dai_set_test_labels(bootloader_version_test onhost ci) | |
# Bootloader configuration tests | |
dai_add_test(bootloader_config_test src/onhost_tests/bootloader_config_test.cpp) | |
dai_set_test_labels(bootloader_config_test onhost ci) | |
# Environment test | |
dai_add_test(env_test src/onhost_tests/env_test.cpp) | |
dai_set_test_labels(env_test onhost ci) | |
# Datatype tests | |
dai_add_test(nndata_test src/onhost_tests/pipeline/datatype/nndata_test.cpp) | |
dai_set_test_labels(nndata_test onhost ci) | |
# Model description tests | |
dai_add_test(model_slug_test src/onhost_tests/model_slug_test.cpp) | |
dai_set_test_labels(model_slug_test onhost ci) | |
# Remote connection tests | |
if(DEPTHAI_ENABLE_REMOTE_CONNECTION) | |
dai_add_test(remote_connection_test src/onhost_tests/remote_connection_test.cpp) | |
dai_set_test_labels(remote_connection_test onhost ci nowindows) | |
endif() | |
### On-device tests ########################################################### | |
# Camera stream restart test | |
dai_add_test(camera_stream_restart_test src/ondevice_tests/camera_stream_restart_test.cpp) | |
dai_set_test_labels(camera_stream_restart_test ondevice rvc2_all rvc4 ci) | |
# DepthAI logging test | |
dai_add_test(logging_test src/ondevice_tests/logging_test.cpp) | |
dai_set_test_labels(logging_test ondevice rvc2_all rvc4 ci) | |
# OpenVINO blob test | |
dai_add_test(openvino_blob_test src/ondevice_tests/openvino_blob_test.cpp) | |
target_compile_definitions(openvino_blob_test PRIVATE | |
OPENVINO_2020_3_BLOB_PATH="${openvino_2020_3_blob}" | |
OPENVINO_2020_4_BLOB_PATH="${openvino_2020_4_blob}" | |
OPENVINO_2021_1_BLOB_PATH="${openvino_2021_1_blob}" | |
OPENVINO_2021_2_BLOB_PATH="${openvino_2021_2_blob}" | |
OPENVINO_2021_3_BLOB_PATH="${openvino_2021_3_blob}" | |
OPENVINO_2021_4_BLOB_PATH="${openvino_2021_4_2_blob}" | |
OPENVINO_2022_1_BLOB_PATH="${openvino_2022_1_blob}" | |
) | |
dai_set_test_labels(openvino_blob_test ondevice rvc2_all ci) | |
# Neural network test | |
dai_add_test(neural_network_test src/ondevice_tests/neural_network_test.cpp) | |
target_compile_definitions(neural_network_test PRIVATE BLOB_PATH="${mobilenet_blob}") | |
dai_set_test_labels(neural_network_test ondevice rvc2_all ci) | |
# Color camera test | |
dai_add_test(color_camera_node_test src/ondevice_tests/color_camera_node_test.cpp) | |
dai_set_test_labels(color_camera_node_test ondevice rvc2_all ci) | |
# Pipeline test | |
dai_add_test(pipeline_test src/ondevice_tests/pipeline_test.cpp) | |
dai_set_test_labels(pipeline_test ondevice rvc2_all ci) | |
# Device USB Speed and serialization macros test | |
dai_add_test(device_usbspeed_test src/ondevice_tests/device_usbspeed_test.cpp) | |
dai_set_test_labels(device_usbspeed_test ondevice rvc2 usb ci) | |
dai_add_test(device_usbspeed_test_17 src/ondevice_tests/device_usbspeed_test.cpp CXX_STANDARD 17) | |
dai_set_test_labels(device_usbspeed_test_17 ondevice rvc2 usb ci) | |
dai_add_test(device_usbspeed_test_20 src/ondevice_tests/device_usbspeed_test.cpp CXX_STANDARD 20) | |
dai_set_test_labels(device_usbspeed_test_20 ondevice rvc2 usb ci) | |
# Filesystem test | |
dai_add_test(filesystem_test src/ondevice_tests/filesystem_test.cpp) | |
target_compile_definitions(filesystem_test PRIVATE BLOB_PATH="${mobilenet_blob}") | |
dai_set_test_labels(filesystem_test rvc2_all ci) | |
dai_add_test(filesystem_test_17 src/ondevice_tests/filesystem_test.cpp CXX_STANDARD 17) | |
target_compile_definitions(filesystem_test_17 PRIVATE BLOB_PATH="${mobilenet_blob}") | |
dai_set_test_labels(filesystem_test_17 rvc2_all ci) | |
dai_add_test(filesystem_test_20 src/ondevice_tests/filesystem_test.cpp CXX_STANDARD 20) | |
target_compile_definitions(filesystem_test_20 PRIVATE BLOB_PATH="${mobilenet_blob}") | |
dai_set_test_labels(filesystem_test_20 rvc2_all ci) | |
# Encoded frame test | |
dai_add_test(encoded_frame_test src/ondevice_tests/encoded_frame_test.cpp CXX_STANDARD 17) | |
dai_set_test_labels(encoded_frame_test ondevice rvc2_all rvc4 ci) | |
# MessageGroup tests | |
dai_add_test(message_group_frame_test src/ondevice_tests/message_group_test.cpp CXX_STANDARD 17) | |
dai_set_test_labels(message_group_frame_test ondevice rvc2_all rvc4 ci) | |
# Pointcloud test | |
dai_add_test(pointcloud_test src/ondevice_tests/pointcloud_test.cpp) | |
dai_set_test_labels(pointcloud_test ondevice rvc2_all ci) | |
# RGBD test | |
dai_add_test(rgbd_test src/ondevice_tests/rgbd_test.cpp) | |
dai_set_test_labels(rgbd_test ondevice rvc2_all rvc4 ci) | |
# Resolutions test | |
dai_add_test(resolutions_test src/ondevice_tests/resolutions_test.cpp) | |
dai_set_test_labels(resolutions_test ondevice) # TODO(jakob) Make the test runnable in CI | |
# Serialization test | |
dai_add_test(serialization_test src/onhost_tests/serialization_test.cpp) | |
dai_set_test_labels(serialization_test ondevice rvc2_all ci) | |
# Subnode test | |
dai_add_test(subnode_test src/ondevice_tests/pipeline/subnode_test.cpp) | |
dai_set_test_labels(subnode_test ondevice rvc2_all rvc4 ci) | |
# Detection network test | |
dai_add_test(detection_network_test src/ondevice_tests/pipeline/node/detection_network_test.cpp) | |
target_compile_definitions(detection_network_test PRIVATE | |
BLOB_ARCHIVE_PATH="${yolo_blob_nnarchive_path}" | |
SUPERBLOB_ARCHIVE_PATH="${yolo_superblob_nnarchive_path}" | |
ONNX_ARCHIVE_PATH="${yolo_onnx_nnarchive_path}" | |
) | |
dai_set_test_labels(detection_network_test ondevice rvc2_all ci) | |
# Spatial detection network test | |
dai_add_test(spatial_detection_network_test src/ondevice_tests/pipeline/node/spatial_detection_network_test.cpp) | |
dai_set_test_labels(spatial_detection_network_test ondevice rvc2_all rvc4 ci) | |
# NeuralNetwork node test | |
dai_add_test(neural_network_node_test src/ondevice_tests/pipeline/node/neural_network_node_test.cpp) | |
target_compile_definitions(neural_network_node_test PRIVATE LENNA_PATH="${lenna_png}") | |
dai_set_test_labels(neural_network_node_test ondevice rvc2_all rvc4 ci) | |
# ImgTransformations tests | |
dai_add_test(img_transformation_test src/ondevice_tests/img_transformation_test.cpp CXX_STANDARD 17) | |
dai_set_test_labels(img_transformation_test ondevice rvc2_all rvc4 ci) | |
# Regression tests for encountered bugs | |
dai_add_test(regression_camera_concurrency_test src/ondevice_tests/regression/camera_concurrency.cpp) | |
dai_set_test_labels(regression_camera_concurrency_test ondevice rvc4 ci) | |
dai_add_test(regression_message_group_test src/ondevice_tests/regression/message_group.cpp) | |
dai_set_test_labels(regression_message_group_test ondevice rvc2_all rvc4 ci) | |
# Sync test | |
dai_add_test(sync_test src/ondevice_tests/pipeline/node/sync_test.cpp) | |
dai_set_test_labels(sync_test ondevice rvc2_all rvc4 ci) | |
# Fsync test | |
dai_add_test(fsync_test src/ondevice_tests/pipeline/node/fsync_test.cpp) | |
dai_set_test_labels(fsync_test ondevice rvc2 usb rvc4 ci) | |
## Large messages tests | |
dai_add_test(bridge_large_messages src/ondevice_tests/bridge_large_messages.cpp) | |
# Only test on RVC4, as RVC2 is not yet supported to auto-increase the max stream capacity | |
dai_set_test_labels(bridge_large_messages ondevice rvc4 ci) | |
# ImageAlign test | |
dai_add_test(image_align_node_test src/ondevice_tests/image_align_node_test.cpp) | |
dai_set_test_labels(image_align_node_test ondevice rvc2_all rvc4 ci) | |
# Script node test | |
dai_add_test(script_node_test src/ondevice_tests/script_node_test.cpp) | |
dai_set_test_labels(script_node_test ondevice rvc2_all rvc4 ci) | |
# StereoDepth test | |
dai_add_test(stereo_depth_node_test src/ondevice_tests/stereo_depth_node_test.cpp) | |
dai_set_test_labels(stereo_depth_node_test ondevice rvc2_all rvc4 ci) | |
# ImageManip test | |
dai_add_test(image_manip_node_test src/ondevice_tests/pipeline/node/image_manip_test.cpp) | |
dai_set_test_labels(image_manip_node_test ondevice rvc2_all rvc4 ci) | |
dai_add_test(image_manip_optimization_test src/ondevice_tests/pipeline/node/image_manip_optimization_test.cpp) | |
target_compile_definitions(image_manip_optimization_test PRIVATE LENNA_PATH="${lenna_png}") | |
dai_set_test_labels(image_manip_optimization_test ondevice rvc4 ci) | |
# Benchmark tests | |
dai_add_test(benchmark_test src/ondevice_tests/pipeline/node/benchmark_test.cpp) | |
dai_set_test_labels(benchmark_test ondevice rvc2_all rvc4 ci) | |
# Manual focus test | |
dai_add_test(manual_focus_test src/ondevice_tests/manual_focus_test.cpp) | |
dai_set_test_labels(manual_focus_test rvc2_all rvc4 ci) | |
# IMU tests | |
dai_add_test(imu_test src/ondevice_tests/pipeline/node/imu_test.cpp) | |
dai_set_test_labels(imu_test ondevice rvc4 ci) # Many RVC2 devices do not have an IMU which supports the whole test suite | |
# Record & Replay tests |
examples/cpp/DetectionNetwork/CMakeLists.txt#L18-L19
depthai-core/examples/cpp/DetectionNetwork/CMakeLists.txt
Lines 18 to 19 in be1345a
dai_add_example(detection_network_replay detection_network_replay.cpp OFF OFF) | |
target_compile_definitions(detection_network_replay PRIVATE VIDEO_PATH="${construction_vest}") |
Bug: Undefined Variables Cause CMake Configuration Errors
The CMake variables construction_vest
, april_tags
, and recording_path
are only defined when DEPTHAI_FETCH_ARTIFACTS
is ON. However, they are used unconditionally in target_compile_definitions
to set paths (e.g., VIDEO_PATH
, APRIL_TAGS_PATH
, RECORDING_PATH
). When DEPTHAI_FETCH_ARTIFACTS
is OFF, these variables are undefined, causing CMake configuration errors or resulting in empty/invalid paths in the compiled code.
examples/cpp/DetectionNetwork/CMakeLists.txt#L18-L19
depthai-core/examples/cpp/DetectionNetwork/CMakeLists.txt
Lines 18 to 19 in be1345a
dai_add_example(detection_network_replay detection_network_replay.cpp OFF OFF) | |
target_compile_definitions(detection_network_replay PRIVATE VIDEO_PATH="${construction_vest}") |
examples/cpp/AprilTags/CMakeLists.txt#L23-L24
depthai-core/examples/cpp/AprilTags/CMakeLists.txt
Lines 23 to 24 in be1345a
dai_add_example(april_tags_replay april_tags_replay.cpp ON OFF) | |
target_compile_definitions(april_tags_replay PRIVATE APRIL_TAGS_PATH="${april_tags}") |
examples/cpp/RecordReplay/CMakeLists.txt#L22-L23
depthai-core/examples/cpp/RecordReplay/CMakeLists.txt
Lines 22 to 23 in be1345a
dai_add_example(holistic_replay holistic_replay.cpp ON OFF) | |
target_compile_definitions(holistic_replay PRIVATE RECORDING_PATH="${recording_path}") |
Bug: Undefined April Tags Path Causes Compilation Issues
The april_tags
variable is conditionally defined based on DEPTHAI_FETCH_ARTIFACTS
. When DEPTHAI_FETCH_ARTIFACTS
is OFF, april_tags
is undefined, causing an empty APRIL_TAGS_PATH
to be passed to the target_compile_definitions
.
examples/cpp/AprilTags/CMakeLists.txt#L23-L24
depthai-core/examples/cpp/AprilTags/CMakeLists.txt
Lines 23 to 24 in be1345a
dai_add_example(april_tags_replay april_tags_replay.cpp ON OFF) | |
target_compile_definitions(april_tags_replay PRIVATE APRIL_TAGS_PATH="${april_tags}") |
Comment bugbot run
to trigger another review on this PR
Was this report helpful? Give feedback by reacting with 👍 or 👎
This patch keeps the Hunter package manager by default enabled but allows to turn it of and bring this repo to offline snadboxed built.