Book a Demo

Author Topic: c++ Code Generation - seperate src / inc Directori  (Read 3228 times)

Michael K

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
c++ Code Generation - seperate src / inc Directori
« on: September 06, 2012, 06:37:18 pm »
printf("Hello!\n");

I am just starting to use EA for code generation (C++) and I'd like to modify the default template in a way, that it supports generating source (.cpp) and header (.hpp) files into different directories. For instance I have a Namespace in EA, which is named foo, then, if there are classes in this namespace, then the namespaces folder on the harddisk shall contain a src and inc directory with the files sorted in.

Example:
namespace foo is root
namespace foo contains a namespace foo2
namespace foo2 contains a class bar

then the following structure should be generated:
foo
|-foo2
...|-inc
...|..|-bar.hpp
...|-src
......|-bar.cpp

How can I achieve this? Simply copying them will (as far as I know) not work, because then forward synchronisation would not work anymore.

Thank you in advance, Michael

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: c++ Code Generation - seperate src / inc Direc
« Reply #1 on: September 07, 2012, 08:39:57 am »
Tools | Options | Source Code Engineering | C++ | Source Path = "..\src\;.\"

Michael K

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: c++ Code Generation - seperate src / inc Direc
« Reply #2 on: September 07, 2012, 02:50:58 pm »
Hello Simon,

first thank you for your reply. This helps me now to place the source files in another directory relative to the header files. Is there a way to also move the header files into another directory?

The desired situation is: I have a structure of nested packages which represent namespaces. In each namespace that contains classes there shall be an inc and a src directory. Header files shall be placed into %packageDirectory%/inc, source files could then be placed into ../src with the proposed option. How do I achieve this? I do not want to create an extra "inc"-Package in the namespace! So is there an option where I can set the header file path relative to the package-path?

Thank you in advance, Michael
« Last Edit: September 07, 2012, 02:51:40 pm by krmi »