Page 1 of 1

Unreal Build Configurations

Posted: 13 Feb 2024, 16:59
by David Jefferies
We want to build our project such that the Shipping and Test version links to Release version of Noesis and other versions link to the Profile version.

We've tried trivially changing the existing Noesis build script (Noesis.build.cs) such that it chooses a different folder for each config
e.g. change this:
if (Target.Platform == UnrealTargetPlatform.Win64)
{
	PublicAdditionalLibraries.Add(Path.Combine(NoesisBasePath, "Lib", "windows_x86_64", "Noesis.lib"));

	string NoesisDllPath = Path.Combine(NoesisBasePath, "Bin", "windows_x86_64", "Noesis.dll");
	string NoesisDllTargetPath = Path.Combine("$(BinaryOutputDir)", "Noesis.dll");

	RuntimeDependencies.Add(NoesisDllTargetPath, NoesisDllPath, StagedFileType.NonUFS);
}
to this:
    
 string ConfigurationFolder = "profile"; 
 if (Target.Configuration == UnrealTargetConfiguration.Shipping || Target.Configuration == UnrealTargetConfiguration.Test)
 {
     ConfigurationFolder = "release";
 }


if (Target.Platform == UnrealTargetPlatform.Win64)
{
        PublicAdditionalLibraries.Add(Path.Combine(NoesisBasePath, "Lib", "windows_x86_64", ConfigurationFolder, "Noesis.lib"));
        
        string NoesisDllPath = Path.Combine(NoesisBasePath, "Bin", "windows_x86_64", ConfigurationFolder, "Noesis.dll");
        string NoesisDllTargetPath = Path.Combine("$(BinaryOutputDir)", "Noesis.dll");
        
        RuntimeDependencies.Add(NoesisDllTargetPath, NoesisDllPath, StagedFileType.NonUFS);
}
we get the build error
"Unable to merge actions 'Noesis.dll' and 'Noesis.dll': PrerequisiteItems, CommandArguments are different"

I think this is because the Editor is always built as Development and so when building a Shipping version of the game, it builds a Development version of the tools and both versions map Noesis.dll to the same path.

Any ideas on how to do this properly?

Re: Unreal Build Configurations

Posted: 15 Feb 2024, 16:39
by hcpizzi
Hi David,

I haven't been able to reproduce you exact problem, but I've found a similar one. I think you're right in your assesment: multiple configurations of our dll have to coexist in the same directory. That means that having them called the same in different directories won't work.

What we've done is to give the dlls/libs suffixes based on the configuration, and use the following code:
		string ConfigurationSuffix = ""; 
		if (Target.Configuration == UnrealTargetConfiguration.Shipping || Target.Configuration == UnrealTargetConfiguration.Test)
		{
			ConfigurationSuffix = "_release";
		}

		if (Target.Platform == UnrealTargetPlatform.Win64)
		{
			PublicAdditionalLibraries.Add(Path.Combine(NoesisBasePath, "Lib", "windows_x86_64", "Noesis" + ConfigurationSuffix + ".lib"));

			string NoesisDllPath = Path.Combine(NoesisBasePath, "Bin", "windows_x86_64", "Noesis" + ConfigurationSuffix + ".dll");
			string NoesisDllTargetPath = Path.Combine("$(BinaryOutputDir)", "Noesis" + ConfigurationSuffix + ".dll");

			RuntimeDependencies.Add(NoesisDllTargetPath, NoesisDllPath, StagedFileType.NonUFS);
		}
We will probably name them Noesis_debug.dll, Noesis_profile.dll and leave plain Noesis.dll for the release configuration but, for now, name them as you wish.

Just to test your same scenario: how were you building the game to get that error?

Re: Unreal Build Configurations

Posted: 20 Feb 2024, 12:58
by David Jefferies
I was using a custom bat file that calls RunUAT.bat - once for building the editor for cooking, and once to build the game
rem build Editor (always development config) - this gets used for cooking 
CALL ..\..\..\RunUAT BuildEditor -project=!PRJ!

rem build game
CALL ..\..\..\RunUAT BuildGame -project=!PRJ! -platform=!PLAT! -configuration=!CFG!

Re: Unreal Build Configurations

Posted: 21 Feb 2024, 13:22
by David Jefferies
I've tried the script changes and it builds and Noesis_release.dll gets copied to Binaries/Win64 correctly

However when I try to run the game I get the system error box with:
"The code execution cannot proceed because Noesis.dll was not found"

So it looks like the game is still trying to load Noesis.dll instead of Noesis_release.dll - but I can't see how the name of the dll is determined

Re: Unreal Build Configurations

Posted: 21 Feb 2024, 18:42
by hcpizzi
Did you just rename the DLL and LIB files? They need to be rebuilt with the changed name. The DLL name is in the associated LIB file, so just renaming them won't work.

Re: Unreal Build Configurations

Posted: 27 Feb 2024, 16:57
by David Jefferies
ah thanks - I'd been renaming them so will rebuild them instead