-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add optional binary relocatability #804
Conversation
The PR is failing as it requires the merge and release of gazebosim/gz-cmake#334 . However, it was important to already open it to permit to understand how gazebosim/gz-cmake#334 would be used. |
9d6c2af
to
9859efe
Compare
I updated this PR to target gz-rendering7 (i.e. Gazebo Garden). The related change in gz-cmake3 has been merged in gazebosim/gz-cmake#334, I guess we need a release of gz-cmake3 before going forward here. |
Signed-off-by: Silvio Traversaro <silvio.traversaro@iit.it>
src/InstallationDirectories.cc
Outdated
|
||
std::string getEngineInstallDir() | ||
{ | ||
return gz::common::joinPaths(getInstallPrefix(), GZ_RENDERING_ENGINE_RELATIVE_INSTALL_DIR); |
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.
CI picked up a couple of minor issues here:
/github/workspace/src/InstallationDirectories.cc:31: Lines should be <= 80 characters long [whitespace/line_length] [2]
/github/workspace/src/InstallationDirectories.cc:36: Lines should be <= 80 characters long [whitespace/line_length] [2]
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! I did not notice that as I tought the CI errors were all due to the gz-cmake 3.1.0 missing on Focal.
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.
Fixed in c412915 .
Signed-off-by: Silvio Traversaro <silvio.traversaro@iit.it>
Codecov Report
@@ Coverage Diff @@
## gz-rendering7 #804 +/- ##
=================================================
- Coverage 77.14% 77.14% -0.01%
=================================================
Files 169 170 +1
Lines 14712 14716 +4
=================================================
+ Hits 11349 11352 +3
- Misses 3363 3364 +1
|
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.
looks good to me.
@mjcarroll do you need to test this with bazel?
I already tested the physics one, since the remainder follow suit, i don't have concerns here. |
Somehow gz-cmake didn't update for me running latest solves this issue.
|
🎉 New feature
Closes part of gazebosim/gz-sim#626
Summary
This PR uses the changes introduced in gz-cmake3 in gazebosim/gz-cmake#334 to support the cmake installation directory to be moved after the
make install
prefix, and continue to work without the need to set any special environment variable, as long as the library is compiled as shared. To avoid regressions and problems in Ubuntu Focal due to the use of std::filesystem, this new behaviour is only activated if theGZ_ENABLE_RELOCATABLE_INSTALL
option is enabled, and its default value isOFF
.In particular, this PR defines a
gz::rendering::getResourcePath()
andgz::rendering::getEngineInstallDir()
that should be used in place of theGZ_RENDERING_RESOURCE_PATH
andGZ_RENDERING_ENGINE_INSTALL_DIR
macros to ensure that the library is relocatable.Furthermore, this PR also deprecates the
GZ_RENDERING_RESOURCE_PATH
andGZ_RENDERING_ENGINE_INSTALL_DIR
macros, using the strategy described in https://stackoverflow.com/a/29297970 . That strategy works fine on GCC and Clang, while on MSVC it raise a warning:However, I think that it does anyhow the job of raising some kind of warning, and then at soon as the developer checks the macro definition the kind of warning is clear.
Test it
The test should work as usual. The used CMake machinery is tested in gazebosim/gz-cmake#334 .
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.