eProsima / Fast-DDS-Gen

Fast-DDS IDL code generator tool. Looking for commercial support? Contact info@eprosima.com
Apache License 2.0
80 stars 59 forks source link

Question: Is there support for #ifdef and #else directives in FastDDSGen #362

Closed anwaymukherjee closed 3 months ago

anwaymukherjee commented 3 months ago

Question: Is there support for #ifdef and #else directives in FastDDSGen also, how do I use ppPath flag ? I was trying to use a script to set the #fdef flag. Looks like that does not work either. Maybe my understanding of ppPath is wrong. Thanks

JesusPoderoso commented 3 months ago

Hi @anwaymukherjee, thanks for using Fast DDS Gen.

Is there support for #ifdef and #else directives in FastDDSGen?

Yes, those directives are supported.

How do I use ppPath flag ?

You would need to have a preprocessor installed, and set in the PATH variable. It is cl.exe on Windows platforms, and cpp on Ubuntu. If the preprocessor path is not in the PATH variable, Fast DDS Gen will fail to parse the IDL file unless you use the ppPath flag (-ppPath <path/to/the/preprocessor>) on build time to let Fast DDS Gen know where to look for the preprocessor. In case you do not want Fast DDS Gen to fail if it cannot find a preprocessor, then you should use the flag -ppDisable

anwaymukherjee commented 3 months ago

thanks for the explanation. Here is where I am struggling This the is idl definition I am trying to parse

ifdef DEF_EXISTS

include "headerA.idl"

else

include "headerB.idl"

endif

Is there a way to pass DEF_EXISTS state through FastDDSGen so that I can chose either headerA or headerB at will.

currently, when I parse this idl, it always defaults to headerB.

JesusPoderoso commented 3 months ago

Unfortunately, there is no way to setup a user custom preprocessor macro through Fast DDS Gen right now. We are open to contributions if you are interested, or in case you need more help about that, do not hesitate to contact our commercial support: support@eprosima.com