adamrehn/ue4-conan-recipes

Unreal build system has changed.

Clockwork-Muse opened this issue · 8 comments

Just noticed that there seems to have been a settings change, at least in 4.24 (if not earlier)

Building <SomeUnrealProjectName>...
[Upgrade]
[Upgrade] Using backward-compatible build settings. The latest version of UE4 sets the following values by default, which may require code changes:
[Upgrade]     bLegacyPublicIncludePaths = false                 => Omits subfolders from public include paths to reduce compiler command line length. (Previously: true).
[Upgrade]     ShadowVariableWarningLevel = WarningLevel.Error   => Treats shadowed variable warnings as errors. (Previously: WarningLevel.Warning).
[Upgrade]     PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs   => Set in build.cs files to enables IWYU-style PCH model. See https://docs.unrealengine.com/en-US/Programming/BuildTools/UnrealBuildTool/IWYU/index.html. (Previously: PCHUsageMode.UseSharedPCHs).
[Upgrade] Suppress this message by setting 'DefaultBuildSettings = BuildSettingsVersion.V2;' in <SomeUnrealProjectName>.Target.cs, and explicitly overriding settings that differ from the new defaults.
[Upgrade]

Switching to the new build settings version can also invalidate some of the current code, because PublicLibraryPaths is now obsolete (and PublicAdditionalLibraries wants the full path to a file). You end up with stuff like:

WARNING: Library '<someLibraryName>' was not resolvable to a file when used in Module 'SomeUnrealModuleName', assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning.

... Code sometimes still builds successfully, but is not guaranteed.

This change was introduced in 4.24.0 and has already been addressed in ue4cli. All of the recipes in this repository build correctly with the latest version of ue4cli, so the only change necessary is to update the code in any .Build.cs files that consume Conan packages. I'll be updating my example code accordingly once I return to work in January.

Did you ever make these updates to the .Build.cs files? I'm encountering the same problem, except with my cmake project I've added into a plugin via ue4cli / ue4-conan.

@bmahlbrand when I went to make the change I realised that all of my available example projects target Unreal Engine 4.23 or older, and therefore would be broken by modifying that field, which only applies to 4.24 and newer. Instead, I'm planning on adding .Build.cs boilerplate generation to conan-ue4cli itself in the future, which will abstract away these details so users don't need to worry about it.

You can fix your own .Build.cs files by simply replacing any references to PublicLibraryPaths with PublicSystemLibraryPaths.

That's just it, I don't have any direct references, since I fairly closely replicated your example here: https://github.com/adamrehn/ue4-opencv-demo/blob/master/project/OpenCVDemo/Source/OpenCVDemo/OpenCVDemo.Build.cs but exhibits the same symptoms (warnings) as described above. Any ideas on what to look out for here?

So it does! That cleared up the warnings but, still having linking problems with a static library I'm including - the typical unresolved external (but it's not clear if that's what the OP was experiencing).

@bmahlbrand when I went to make the change I realised that all of my available example projects target Unreal Engine 4.23 or older, and therefore would be broken by modifying that field, which only applies to 4.24 and newer. Instead, I'm planning on adding .Build.cs boilerplate generation to conan-ue4cli itself in the future, which will abstract away these details so users don't need to worry about it.

This sounds great, any sense of where it falls in your roadmap? Just trying to get a sense of whether to try to fix my error or pursue another path.

It's one of a few quality-of-life fixes that I want to implement for conan-ue4cli (proper documentation being the biggest one), but there's no concrete timeline around when they'll be implemented. However, if you're getting linker errors then the issue is likely in your Conan recipe(s) rather than the .Build.cs file, so the fix shouldn't make much of a difference in your case