-
Notifications
You must be signed in to change notification settings - Fork 154
Add DEPTHAI_INSTALL_PREFIX to depthaiConfig.cmake, install libusb DLL for every depthai example #1475
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
Open
lnotspotl
wants to merge
6
commits into
develop
Choose a base branch
from
lnotspotl/update_depthai_installation
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add DEPTHAI_INSTALL_PREFIX to depthaiConfig.cmake, install libusb DLL for every depthai example #1475
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
64faa34
install libusb (brought in by vcpkg) alongside depthai-core if enabled
lnotspotl ad56060
update depthaiConfig.cmake.in to set the DEPTHAI_INSTALL_PREFIX path
lnotspotl 8a07a8c
Merge branch 'develop' into lnotspotl/update_depthai_installation
lnotspotl 0790ce0
Add usb-1.0 as a dependency for all depthai's examples
lnotspotl 2aaeaa9
Update cmake/depthaiHelpers.cmake
lnotspotl f058ef0
fix add_runtime_dependencies bug
lnotspotl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
include(CMakeFindDependencyMacro) | ||
|
||
get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
include(${CMAKE_CURRENT_LIST_DIR}/@[email protected]) | ||
|
||
message(STATUS "Found depthai: ${CMAKE_CURRENT_LIST_DIR} (found version: ${PACKAGE_VERSION})") | ||
|
||
# Assume we are in <install-prefix>/lib/cmake/depthai/depthaiConfig.cmake | ||
get_filename_component(DEPTHAI_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) | ||
|
||
find_dependency(nlohmann_json CONFIG REQUIRED) | ||
find_dependency(libnop CONFIG REQUIRED) | ||
find_dependency(XLink CONFIG REQUIRED COMPONENTS XLinkPublic) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
macro(add_runtime_dependencies depending_target dependency) | ||
if(TARGET ${dependency}) | ||
get_property(imported_configs TARGET ${dependency} PROPERTY IMPORTED_CONFIGURATIONS) | ||
set(dlls "") | ||
message(DEBUG "Adding runtime dependencies for ${depending_target} on ${dependency}. Imported configurations: ${imported_configs}") | ||
foreach(cfg ${imported_configs}) | ||
message(DEBUG "Adding runtime dependencies for ${depending_target} on ${dependency} (${cfg})") | ||
get_property(dll TARGET ${dependency} PROPERTY IMPORTED_LOCATION_${cfg}) | ||
message(DEBUG "Retrieved dll for ${cfg}: '${dll}'") | ||
list(APPEND dlls $<$<CONFIG:${cfg}>:${dll}>) | ||
endforeach() | ||
message(DEBUG "Required dlls for ${depending_target} on ${dependency} are: ${dlls}") | ||
Comment on lines
+5
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The debug messages contain inconsistent terminology - some refer to 'core' while others use the actual target name. Line 23 should use '${depending_target}' instead of hardcoded 'core' for consistency. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
endif() | ||
# Create a list of required dll files | ||
set(required_dll_files ${dlls}) | ||
# Copy the required dlls | ||
if(WIN32) | ||
add_custom_command(TARGET ${depending_target} POST_BUILD COMMAND | ||
"$<$<BOOL:${required_dll_files}>:${CMAKE_COMMAND};-E;copy_if_different;${required_dll_files};$<TARGET_FILE_DIR:${depending_target}>>" | ||
COMMAND_EXPAND_LISTS | ||
VERBATIM | ||
) | ||
message(DEBUG "Required dlls for core are: ${required_dll_files}") | ||
lnotspotl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
endif() | ||
endmacro() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we also need to do that for dynamic calibration library? I also think this makes
add_runtime_dependencies
obsolete (at least that was the case when building deb packages for ROS)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.
You're making a really good point here. The issue was that when I tried installing the project,
libusb-1.0.so
would not be present as a runtime dependency but the dynamic_calibration library would. Turns out there was a bug in theadd_runtime_dependencies
macro that would override therequired_dll_files
variable every time it was invoked, thereby causing that only the last added runtime dependency would be added.I guess this macro is still needed for libraries that we link against with PRIVATE visibility.