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 #552

Closed
wants to merge 3 commits into from

Conversation

traversaro
Copy link
Contributor

🎉 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::rendering::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.

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 <silvio.traversaro@iit.it>
@mjcarroll
Copy link
Contributor

Looks like CI is having issues on this one:

  -- Configuring done
  CMake Error at /usr/share/cmake/gz-cmake3/cmake3/GzUtils.cmake:214 (add_library):
    Cannot find source file:
  
      /github/workspace/build/include/gz/gui/gz-gui7_get_install_prefix_impl.cc
  
    Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
    .hpp .hxx .in .txx
  Call Stack (most recent call first):
    /usr/share/cmake/gz-cmake3/cmake3/GzCreateCoreLibrary.cmake:104 (_gz_add_library_or_component)
    include/gz/gui/CMakeLists.txt:48 (gz_create_core_library)
    ```

@traversaro
Copy link
Contributor Author

Yes apparently there is some strange interaction between the old CMake version available in Focal and the strange location of the gz_create_core_library call in gz-gui as opposed to other gz-*, I will look into it.

@azeey azeey requested a review from j-rivero June 26, 2023 18:46
@azeey azeey added the beta Targeting beta release of upcoming collection label Jul 31, 2023
@mjcarroll
Copy link
Contributor

@traversaro are you going to be able to iterate on this one?

@traversaro
Copy link
Contributor Author

@traversaro are you going to be able to iterate on this one?

I tried earlier today, but I was unable to find the solution. I think we can think of this some time after the code freeze/harmonic release.

@mjcarroll
Copy link
Contributor

Sounds good, I'm going to remove the beta label for now.

@mjcarroll mjcarroll removed the beta Targeting beta release of upcoming collection label Aug 29, 2023
@traversaro
Copy link
Contributor Author

Sounds good, I'm going to remove the beta label for now.

Yes, probably post-Harmonic release the easiest solution is to target harmonic for this, so we do not need to worry about Focal compatibility.

@jennuine
Copy link
Contributor

jennuine commented Nov 3, 2023

@traversaro does this need to be retargeted to gz-gui8?

@traversaro
Copy link
Contributor Author

@traversaro does this need to be retargeted to gz-gui8?

Yes, I can do this in the next days.

@caguero
Copy link
Contributor

caguero commented Jan 5, 2024

@traversaro , friendly ping here. Do you plan to retarget your patch to gz-gui8?

@traversaro
Copy link
Contributor Author

Yes, sorry, I just lost sight of the PR.

@traversaro
Copy link
Contributor Author

Ops, sorry for the noise @jennuine @caguero , actually the PR was already merged in gz-gui8 in #580 before your pings, so we can safely close this one!

@traversaro traversaro closed this Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants