openvdb icon indicating copy to clipboard operation
openvdb copied to clipboard

[REQUEST] Support building without RTTI

Open hiokazaki opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

I'm using OpenVDB in a larger project that builds with -fno-rtti (no RTTI) as a matter of policy.

I noticed that OpenVDB uses RTTI for debug purposes. Actually, they mostly appear in the context of emitting failure messages before throwing an exception. I can't find any "geometric" use of RTTI in OpenVDB, which makes sense given the emphasis on high performance.

Describe the solution you'd like

It would be great if OpenVDB could have a new (cmake) configuration option added to build it without RTTI, and with more generic messages where RTTI is currently used. The changes to remove usage of RTTI from OpenVDB's C++ are trivial, but I am not familiar with CMake at all (except as a user) so I don't know how to make this change myself 😞

If it was preferred not to add any more configuration options, then I would request that debug builds of OpenVDB continue to use RTTI, but release builds do not (and provide more generic messages instead.)

Describe alternatives you've considered

A more aggressive option, but perhaps a simpler and easier one, would be to simply eliminate the few places where RTTI is used. In this way, no changes are required to the current configuration/build system. (To use OpenVDB without RTTI I made these changes myself and it works great. I would be happy to submit a pull request if desired.)

Another option would be to extend OpenVDB to carry the required type information internally to support a kind of "manual RTTI", but given how little use is made of RTTI currently (and probably in future) this seems very wasteful.

hiokazaki avatar Nov 16 '24 23:11 hiokazaki