fix: add GTSAM_USE_BOOST_FEATURES to definitions by ArkadiuszNiemiec · Pull Request #1995 · borglab/gtsam · GitHub
Skip to content

fix: add GTSAM_USE_BOOST_FEATURES to definitions - #1995

Merged
varunagrawal merged 1 commit into
borglab:developfrom
ArkadiuszNiemiec:fix_use_boost_features
Jan 25, 2025
Merged

fix: add GTSAM_USE_BOOST_FEATURES to definitions#1995
varunagrawal merged 1 commit into
borglab:developfrom
ArkadiuszNiemiec:fix_use_boost_features

Conversation

@ArkadiuszNiemiec

@ArkadiuszNiemiec ArkadiuszNiemiec commented Jan 23, 2025

Copy link
Copy Markdown

This fixes the issue #1994 and some issues mentioned in #1967 and #1981.

The change defines the proper identifier if GTSAM_USE_BOOST_FEATURES option is set in CMakeLists.txt.
It's used in:


...and without it the compiler throws BOOST_CONCEPT_USAGE redefinition error.

@dellaert

Copy link
Copy Markdown
Member

Thanks, but I might not fully understand then: I checked and we don't do this for GTSAM_ENABLE_BOOST_SERIALIZATION, but we can still branch on that in code. Why is GTSAM_USE_BOOST_FEATURES different?

@ArkadiuszNiemiec

Copy link
Copy Markdown
Author

Thanks, but I might not fully understand then: I checked and we don't do this for GTSAM_ENABLE_BOOST_SERIALIZATION, but we can still branch on that in code. Why is GTSAM_USE_BOOST_FEATURES different?

Oh, right. The GTSAM_ENABLE_BOOST_SERIALIZATION didn't generate a build error for me, but it should be added as well. Fixed.

@dellaert

Copy link
Copy Markdown
Member

Well, I guess my question was the other way :-) Why can we branch on GTSAM_ENABLE_BOOST_SERIALIZATION currently? And could we use the same mechanism to branch on GTSAM_USE_BOOST_FEATURES? It seems the add_definitions was not needed for GTSAM_ENABLE_BOOST_SERIALIZATION?

@ArkadiuszNiemiec

ArkadiuszNiemiec commented Jan 24, 2025

Copy link
Copy Markdown
Author

AFAIK both identifiers/macros were always not defined in the code. My linter confirms that but to prove it I added this to one of the examples:
image

...checked out my first commit (with just GTSAM_USE_BOOST_FEATURES fixed), made sure the flag is ON and built:
image

The output:
image

...and you are right. For some reason both are ON 😕 So why it's not working during compile time?

@dellaert

Copy link
Copy Markdown
Member

right :-)
No idea ! Sleuthing required!
But if we find a]out why we can avoid the “add_definitions” step.
Note: it requires #if and not #ifdef. Maybe there is a straggling #ifdef ?

@dellaert

Copy link
Copy Markdown
Member

Note, your test is compile time. All macro pre-processing is gone at runtime.

@ArkadiuszNiemiec

Copy link
Copy Markdown
Author

OK, got it. GTSAM is using https://github.com/borglab/gtsam/blob/develop/gtsam/config.h.in
It creates a config.h that needs to be included if one want to use the CMake variables. To include was missing from that one specific file. Thank you @dellaert, great questions!

@dellaert dellaert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ! Nice, LGTM :-) I will kick off CI and we can merge.

@varunagrawal

Copy link
Copy Markdown
Contributor

@varunagrawal
varunagrawal merged commit a744cfc into borglab:develop Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants