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

Add optional binary relocatability (Harmonic/gz-gui8 version) #580

Merged
merged 2 commits into from
Oct 5, 2023

Conversation

traversaro
Copy link
Contributor

@traversaro traversaro commented Sep 29, 2023

🎉 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 the GZ_ENABLE_RELOCATABLE_INSTALL option is enabled, and its default value is OFF .

In particular, this PR defines a gz::gui::getPluginInstallDir() that should be used in place of the GZ_GUI_PLUGIN_INSTALL_DIR macros to ensure that the library is relocatable.

Furthermore, this PR also deprecates the GZ_GUI_PLUGIN_INSTALL_DIR macro, 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:

warning C4068: unknown pragma

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.

Note: this was originally submitted against gz-gui7 in #552 . However, given that there were strange CI failure in Focal, it was decided to just drop the change for gz-gui7, and submit it in gz-gui8.

Test it

The test should work as usual. The used CMake machinery is tested in gazebosim/gz-cmake#334 .

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

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.

Signed-off-by: Silvio Traversaro <[email protected]>
@github-actions github-actions bot added the 🎵 harmonic Gazebo Harmonic label Sep 29, 2023
Signed-off-by: Silvio Traversaro <[email protected]>
@codecov
Copy link

codecov bot commented Oct 5, 2023

Codecov Report

Merging #580 (712294d) into gz-gui8 (b3ed6bd) will increase coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head 712294d differs from pull request most recent head 2eac85d. Consider uploading reports for the commit 2eac85d to get more accurate results

@@             Coverage Diff             @@
##           gz-gui8     #580      +/-   ##
===========================================
+ Coverage    68.07%   68.09%   +0.01%     
===========================================
  Files           38       39       +1     
  Lines         5369     5372       +3     
===========================================
+ Hits          3655     3658       +3     
  Misses        1714     1714              
Files Coverage Δ
src/Application.cc 84.13% <100.00%> (+0.03%) ⬆️
src/InstallationDirectories.cc 100.00% <100.00%> (ø)

@mjcarroll mjcarroll merged commit 872222a into gazebosim:gz-gui8 Oct 5, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎵 harmonic Gazebo Harmonic
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants