Nuke.Unreal
Build Unreal apps in Style.
Loading...
Searching...
No Matches
Nuke.Unreal.Plugins.RuntimeDependenciesExtensions Class Reference

Static Public Member Functions

static IEnumerable< ImportedItem > PrepareRuntimeDependencies (this UnrealBuild self, AbsolutePath sourceFolder, IEnumerable< RuntimeLibraryPath > runtimeLibraryPaths, Func< AbsolutePath, RuntimeDependencyConfig >? determineConfig=null, Func< AbsolutePath, UnrealPlatform >? determinePlatform=null, string? moduleName=null, AbsolutePath? pluginFolder=null, ExportManifest? customManifest=null, string manifestFilePattern="RuntimeDeps.y*ml", string binariesSubfolder="ThirdParty", AbsolutePath? moduleRuleOutput=null, bool setFilterPlugin=true, bool pretend=false)
 

Detailed Description

Definition at line 61 of file AutoRuntimeDependencies.cs.

Member Function Documentation

◆ PrepareRuntimeDependencies()

static IEnumerable< ImportedItem > Nuke.Unreal.Plugins.RuntimeDependenciesExtensions.PrepareRuntimeDependencies ( this UnrealBuild self,
AbsolutePath sourceFolder,
IEnumerable< RuntimeLibraryPath > runtimeLibraryPaths,
Func< AbsolutePath, RuntimeDependencyConfig >? determineConfig = null,
Func< AbsolutePath, UnrealPlatform >? determinePlatform = null,
string? moduleName = null,
AbsolutePath? pluginFolder = null,
ExportManifest? customManifest = null,
string manifestFilePattern = "RuntimeDeps.y*ml",
string binariesSubfolder = "ThirdParty",
AbsolutePath? moduleRuleOutput = null,
bool setFilterPlugin = true,
bool pretend = false )
static

Prepare and transform a group of files for neatly be packaged as runtime dependencies in conventional locations. This aims to alleviate some chore regarding working with elaborate third-party/prebuilt libraries. Files are copied by Nuke.Unreal but let UBT do it.

The result of this function is a partial module rule C# file which will list runtime dependencies in a partial method called SetupRuntimeDependencies. Please take care that the main module rules class for the target module is also partial.

Here's the overview of the usage of this function.

  1. Provide a source folder for the runtime dependencies
  2. Provide a set of locations in runtime, relative to the destination folder serving as runtime library paths (ideally one for each supported platforms). This may be used as base folders to load DLL's from.
  3. If applicable provide pattern matching functions to determine the platform and configuration for individual files
  4. To control the destination folder structure PrepareRuntimeDependencies may pick up a folder composition manifest file called "RuntimeDeps.yml" (by default this can be also overridden)
  5. If no such manifest is available one can be passed directly in C#

The module rule will copy output files on building the project to &lt;plugin-directory&gt;/Binaries/&lt;binariesSubfolder&gt;/&lt;moduleName&gt;. Where binariesSubfolder is "ThirdParty" by default.

For example:

[ImplicitBuildInterface]
public interface IMyPluginTargets : INukeBuild
{
Target PrepareMyPlugin =&gt; _ =&gt; _
.Executes(() =&gt;
{
this.PrepareRuntimeDependencies(
this.ScriptFolder(),
[ new() {Path = (RelativePath)&quot;Win64&quot; } ],
determinePlatform: f =&gt; UnrealPlatform.Win64,
customManifest: new()
{
Copy = [
new() {Directory = &quot;tools&quot;},
new() {
Directory = &quot;sdk/windows-desktop/amd64/release/bin&quot;,
As = &quot;Win64&quot;
},
]
}
);
});
}
High level representation of common platforms supported by Unreal Engine (NDA ones excluded) and extr...
static readonly UnrealPlatform Win64
Any platform name containing 'Windows' is also mapped to this platform.

This will create a "copy" of the binaries subfolder in Plugin sources, so Fab compatibility can be ensured. This "copy" is just done with symlinks, not actual copies of binaries. This wisdom has been bestowed upon us by the author of CefView https://forums.unrealengine.com/t/copy-3rd-party-dlls-to-binaries-folder-does-not-work-for-engine-plugin-how-to-solve/738255/6

Parameters
self
sourceFolderRequired. The root folder of the third-party library. Ideally the same folder as the external module representing the library for Unreal.
runtimeLibraryPathsRequired. A a set of locations in runtime, relative to the destination folder serving as runtime library paths (ideally one for each supported platforms). This may be used as base folders to load DLL's from.
determineConfigOptional. Determin a configuration (either debug or release) from a given runtime dependency file. If the file is needed in all configurations return RuntimeDependencyConfig.All. This predicate is also applied to DLL's, there are no assumptions about them, solely based on their file paths. By default every file is assumed for all configurations.
determinePlatformOptional. Determin a target platform from a given runtime dependency file. If the file is needed on all platforms return UnrealPlatform.Independent. This predicate is also applied to DLL's, there are no assumptions about them, solely based on their file paths. By default every file is assumed for all platforms.
moduleNameOptional. By default derived from the folder name provided with sourceFolder
pluginFolderOptional. By default it's the owning plugin of the sourceFolder
customManifestOptional. Provide a folder composition manifest if the target file-folder structure is different than the input one. Default is empty (just copy folder structure as-is)
manifestFilePatternOptional. The file name of an optional folder composition manifest which may reside in sourceFolder. Default is "RuntimeDeps.y*ml"
binariesSubfolderOptional. The subfolder name in the plugin Binaries where everything else is copied into. Default is "ThirdParty".
moduleRuleOutputOptional. A custom folder output for the generated module rule file. Default is sourceFolder.
setFilterPluginEnqueue referred files and their destination locations in the owning plugin instance. Default is true.
pretendOptional. If true only list affected files, but do not modify files or generate a module rule. Default is false.

Definition at line 193 of file AutoRuntimeDependencies.cs.


The documentation for this class was generated from the following file: