Ok, i found a solution (or workaround) myself. It seems the standalone-files are meant to be really for standalone builds which are not used inside UE. Otherwise redefinitions or (if excluded) linker-errors occur which could not be solved by me. So i switched to following workaround:
-
Instead of prebuild the library and include it in Build.cs add the thirdparty code to the module and compile it along with the module by UBT.
-
This can be done by
PublicIncludePaths.AddRange(new string[] { Path.Combine(ModuleDirectory, "../ThirdParty/XXX/include") //include header files .h }); PrivateIncludePaths.AddRange(new string[] { Path.Combine(ModuleDirectory, "../ThirdParty/XXX/src") //include source files .cpp });
-
this way
TRACE_CPUPROFILER_EVENT_SCOPE
can be used as in normal UE-Code -
if the third PartyLibrary was already optimized during the prebuild. You may have to set
OptimizeCode = CodeOptimization.Always;
in your modules Build.cs to get the same performance results when using UBT. Otherwise the code, depending on the current Project configuration, is not optimized and results where more than 50% slower as before.