Download

No folder hierarchy in intermediate folders breaks my project!

Dear Epic staff,

I am facing some annoying issues while integrating Google Protobuf based projects into Unreal Engine.

My file hierarchy in the plugin folder looks like this:



SubModuleFolder
├───folder_1
│   └───common
│           └── common.proto    
└───folder_2
        ├───detail_1
        │        └── common.proto    
        ├───detail_2
        │        └── common.proto    
        ├───detail_3
        │        └── common.proto    
        └───detail_4
                 └── common.proto    


So when compiling, I get unresolved symbols, because all common.proto files (compiled into common.pb.h and common.pb.cc) are put into the same folder in the intermediate directory and silently overwriting each other:


Plugins\MyPlugin\Intermediate\Build\Win64\UE4Editor\DebugGame\SubModuleFolder\common.pb.cc.obj

Is there a way to work around this UBT behaviour or do you have an answer to why this is implemented like this? Will I break UBT when changing this part of the compile process? Maybe because of 255 char file-paths restrictions?

This code area (L.1195) in VCToolchain.cs looks like it causes this with CompileEnvironment.OutputDirectory always the same:



// Add the object file to the produced item list.
FileItem ObjectFile = FileItem.GetItemByFileReference(
  FileReference.Combine(
  CompileEnvironment.OutputDirectory,
  Path.GetFileName(SourceFile.AbsolutePath) + ObjectFileExtension
  )
);