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

Provide compile-time ROS2 version information #174

Closed
serge-nikulin opened this issue Aug 12, 2019 · 8 comments
Closed

Provide compile-time ROS2 version information #174

serge-nikulin opened this issue Aug 12, 2019 · 8 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@serge-nikulin
Copy link

As ROS2 matures and introduces new API, we need ways to conditionally compile code against different, possibly compile-time incompatible, versions of ROS2.

Common ways to do it are:

  • Define version macros or constants in C or C++ header file, e.g. (from FDRS code):
    #define FASTCDR_VERSION_MAJOR 1
    #define FASTCDR_VERSION_MINOR 0
    #define FASTCDR_VERSION_MICRO 9
    #define FASTCDR_VERSION_STR "1.0.9"
  • Define version information in a CMake file and later generate a header file with C/C++ version macros or constants.
@dirk-thomas dirk-thomas added the enhancement New feature or request label Aug 12, 2019
@dirk-thomas
Copy link
Member

That sounds like a good idea. Please consider to contribute pull requests for packages where you see the need for it.

@serge-nikulin
Copy link
Author

@dirk-thomas,

I can do a naive versioninig: plain C/C++ macros that should be upgraded manually before each build.

A "grownup", a right way to do versioning is to keep the last built version in some external DB and increment the minor version automatically and major/minor versions in a semi-auto way (via Jenkins commands?). This approach IMO should be implemented by ROS2 insiders who have full access to build infrastructure.

@dirk-thomas, should I go ahead with the naive approach pull request?

@dirk-thomas
Copy link
Member

Each package already has the version number declared in the package.xml file which also gets bumped for every release. That value is available in CMake as <pkgname>_VERSION after the manifest file was parsed (that happens either in ament_package() or when ament_package_xml() is called any time earlier). So that information could be used for the macros which will need to be generated using configure_file().

@serge-nikulin
Copy link
Author

@dirk-thomas, see #175

@clalancette clalancette added the help wanted Extra attention is needed label Apr 29, 2022
@aprotyas
Copy link
Member

@clalancette how broad is this issue? rclcpp already generates a version header. Is there also a need for that in rcutils?

@clalancette
Copy link
Contributor

@clalancette how broad is this issue? rclcpp already generates a version header. Is there also a need for that in rcutils?

I have no idea, honestly. Maybe @serge-nikulin can weigh in.

@serge-nikulin
Copy link
Author

@aprotyas

@clalancette how broad is this issue? rclcpp already generates a version header. Is there also a need for that in rcutils?

This issue is very old. Back in 2019 ROS2 did not have any version information.
You can close this issue I guess.

Back then I wanted to generate version information for every generated library.
Rationale: in many shops, all files must have version information, and many safety and security standards require version tagging of every distributed file.

@clalancette
Copy link
Contributor

Based on the previous comment, closing. Feel free to reopen if you change your mind and would like to continue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants