Author Topic: Generated code with windows style include paths  (Read 3827 times)

Thomas Arnbjerg

  • EA User
  • **
  • Posts: 86
  • Karma: +0/-0
    • View Profile
Generated code with windows style include paths
« on: May 30, 2017, 01:24:25 am »
Hi there,
I'm code generating from windows into a share Linux folder. Unfortunately EA insists on adding windows style paths to my includes similar to:

#include "EventbusModel\src\autogenerated\DataStructureClasses\DeviceConfigurationImplementation.h"

Three questions:
1) The include path is generated by EA automatically. Can I get rid of that behaviour (it causes a lot of problems)
2) Second best option is to get rid of the folders - I only want to include "DeviceConfigurationImplementation.h". Is that possible?
2) Third best option: Can I at least specify a forward slash?

Thx
Thomas

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Generated code with windows style include paths
« Reply #1 on: May 31, 2017, 09:24:50 pm »
Hej Thomas!


All these relate to the same thing: the code generation templates. These can be modified, although it's a little less than intuitive the first time around.

The templates that are shipped with EA are undocumented (surprise, surprise), so you'll have to slog through them to find exactly where each line of code is generated. Have a look in the help for "File Import Field Substitution Macros" to see exactly which macro does what, go through the generation templates and replace the macros as necessary.

That should allow you to address 1) and 2).

I can't remember off-hand whether there is a way to control which style of slash is generated (which is spectacularly stupid considering the fact that Windows CPP parsers parse forward slashes in include paths just fine), but if nothing else there's a %REPLACE()% macro which you can use to work around this.

All this said, there are some hidden gotchas in the code generation process that you can't control. Include/import directives shouldn't be one of those, but I can't promise anything.

HTH,


/Uffe
My theories are always correct, just apply them to the right reality.

Thomas Arnbjerg

  • EA User
  • **
  • Posts: 86
  • Karma: +0/-0
    • View Profile
Re: Generated code with windows style include paths
« Reply #2 on: May 31, 2017, 09:39:46 pm »
Hi Uffe,
Thx for the answer. I have already gone through the code generation templates ("Import Section", "Import Section Impl" and none of them produce the path shown. I've inserted trace comments and can see that the extra header appears out of the blue "between" evaluation of the template "%ImportSection%" and "%NameSpace%" in template "%File%"

The header relates to a return type for one of the methods in the class from which the code is generated. Furthermore none of the fields 'Import(s)/Header(s)' in the code generation dialog for the class contain this header.

The weird thing is that I have two projects, with the "same" set of code generation templates. In one project the extra include is not genereated - in the other it is.

Does this trigger any suggestions?

br
Thomas