I need serious clarification of the documentation around the lists of modules and dependencies, includes, etc. It’s quite confusing and the documentation is a little short for newcomers who still don’t know how Unreal build system works, even after reading the docs available, and I guess it’s even more frustrating for people new to c++, unlike me.
In a build.cs file you have to fill several lists, but people seem to do it using every module they think they would need without really understanding what’s going on. I’ve done that too but now I’m having serious include problems and I need to understand this for good:
First about these two:
List of modules names (no path needed) with header files that our module’s public headers needs access to, but we don’t need to “import” or link against.
List of modules name (no path needed) with header files that our module’s private code files needs access to, but we don’t need to “import” or link against.*
Question 1 ) “*don’t need to “import” or link against” *This doesn’t make sense, I asked other c++ developers with no Unreal knowledge, and they were confused too. What would I want to do with the module but import or link against? What should I include here then?
Question 2) Why does it say “public headers” and “private code” on each. This is very subtle but important. Does it mean cpp should be private and headers public in my plugin, for example? (I’m sure this is not the case because you can put any file anywhere you want and I’ve seen it everywhere).
Question 3 ) Should a module be added to both lists if I use it in the public and private files?
And now about these two:
List of public dependency module names (no path needed) (automatically does the private/public include). These are modules that are required by our public source files.
List of private dependency module names. These are modules that our private code depends on but nothing in our public include files depend on.*
Question 4 ) These are “dependency” and the others “includePath”. Include means headers, I understand. What are these then? What does it mean with “dependency” in Unreal terms?. Wouldn’t I want to use them by including them?
Question 5 ) The private list doc text doesn’t mention “no path needed” and “automatically does the private/public include”. Should I take it into account from the other similar list ( in that case, it should be mentioned and I’ll notify that to them ) or it doesn’t?.
Question 6 ) Why does it say “does the private/public include”?. If you add a module to the public list, then all private and public exposed funcionality is available? Shouldn’t private content be hidden?. What does it mean by “include”? Wasn’t it just dependencies?
Question 7 ) So In my case, I have a plugin with two modules. Both have several files in subfolders inside public and private/ folders, and more subfolders.
If I want module A to use module B, I put the header files that A will need from B in it’s public folder.
So I need to include ModuleA in which variable? Include? Dependency? both? public or private? I suppose private shouldn’t be accesed so I’m forced to put all headers to be accesed public, right?.
After I understand all this, I’ll probably write it down clearly for everybody in a wiki page.