-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
ELPP and utilities changes #11160
ELPP and utilities changes #11160
Conversation
I don't like what I did :) Instead, I added a function that can be called (instead of including Here's the original explanation before this update:
|
@@ -65,7 +65,7 @@ include(src/CMakeLists.txt) | |||
include(third-party/CMakeLists.txt) | |||
include(common/utilities/CMakeLists.txt) | |||
|
|||
target_link_libraries( ${LRS_TARGET} PRIVATE utilities ) | |||
target_link_libraries( ${LRS_TARGET} PUBLIC utilities ) |
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.
Why does the user app must have utilities
?
It is statically compiled into the SDK no?
I am not sure it's a good idea, where does it effect the user?
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 can remove this but then you have to add utilities as a dependency in all the other projects -- possibly including users. If they don't use utilities, it won't make a difference.
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.
But if we make it a statically dependence of the librealsense2
library all tools/examples/users will get it.
Only tools using the Utilities explicitly will need it and that's OK.
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.
But how does it hurt? Projects that depend on us will either use our CMake in which case it will be transparent, or they compile it separately which will be transparent.
Let's do this and then I'll take some time to try different ways (I wanted to, anyway) to use libreasense and see what's better...
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 don't understand why you insist for this change..
reverting this change should be easy.
I don't know what can happen for debians / Windows installer and it's not necessary.
We want to minimize the user dependencies.
Integrating a DDS third party took me a month because of this kind of things.
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.
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.
That's not installing it. That's the dependency that CMake adds: not to the executable, but to the build. This is fine. This is a convenience. It lets you include utilities header without having to worry about it.
It doesn't add any dependency to the final executable.
Again: this has effect only in CMake projects. Not on the final output.
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.
Because it is static? if it wasn't static it was needed doing runtime right?
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.
Right, if it wasn't static it'd be needed at runtime and not just compile-time.
But:
static libraries do not link other static libraries into the code
This is not currently on, nor is there any easy way to turn it on via CMake and cross-platform (from limited reading about it).
That means our current code (since introducing utilities/realdds) will have issues if librealsense2 (as a library) is used independently and not via CMake: the user would have to find the utilities lib (or realdds) and link with it, too.
With CMake, making the dependency PUBLIC
solves this issue: it'll be automatic for the user.
Without CMake, they'll need to manually add the dependency even if they do not use utilities directly: we will likely have to distribute utilities and realdds libraries alongside our realsense2.lib for this use-case. Or we can try to find a solution for Linking library dependencies into realsense2.lib.
I want to add code to our CI that simulates an example that's not part of our main CMake. It would have caught a change like this.
Let's talk about it tomorrow.
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.
This sounds like something we need to fix ASAP.
Like you said, let's speak tomorrow..
src/hw-monitor.h
Outdated
@@ -208,7 +208,7 @@ namespace librealsense | |||
{ | |||
if (ptr) _heap.deallocate(ptr); | |||
}); | |||
if (!token.get()) throw; | |||
if (!token.get()) throw std::runtime_error( "allocation failed" ); |
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 did the same change on my PR :)
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.
LGTM
This is an attempt to remove the
shared-init.cmake
requirement from downstream projects.This is accomplished by:
shared-init.cmake
with a call to a function:SHARED
orSTATIC
can be used to indicate that the ELPP initialization needs attention only when building in shared or static mode (this is needed because in static, clients use librealsense's)elpp-init.cpp
to the build of the project namedOther things in here:
utilities
include files are now arranged according to the tree (requires CMake 3.8)"librealsense"
constant used to define our ELPP logger is now an actual define,LIBREALSENSE_ELPP_ID
configure_elpp_logger
utility function to easily configure ELPP (will be used in realdds, too)