Copy 3rd Party DLLs to Binaries folder does not work for Engine Plugin - How to solve?

For anyone is confusing with this issue you mistake the process of packing Plugin and packing Game.

when you build your plugin with

RunUAT.bat BuildPlugin 

It won’t stage the RuntimeDependencies for you, you need to do this by either

    1. puting the ThirdParty files at correct location where you refer them in your Build.cs file (for example YourPlugin/Binaries/ThirdParty/…)
      OR
    1. running some PreBuildSteps scripts to copy them to the correct location where you refer them in your Build.cs (for eamxple copy them from YourPlugin/Source/ThirdParty/… to YourPlugin/Binaries/ThirdParty/…)

But if you choose to put them directly in YourPlugin/Binaries/ThirdParty/…, you cannot submit your plugin package because this is violation against the (Fab) Technical Requirements - 4.3.7.3.d which states

Third-party dependencies may only be used with proof of permission and must be placed in a ThirdParty folder located inside the Source folder.

So the correct and available approach is 2.

  • Put your ThirdPatry files in YourPlugin/Source/ThirdParty/…

  • Add PreBuildSteps in your plugin description file YourPlugin.uplugin, here is an example

    {
      "FileVersion": 3,
      "Version": 3,
      "VersionName": "1.0.3",
      "FriendlyName": "UCefView",
      "Description": "",
      "Category": "Other",
      "CreatedBy": "",
      "CreatedByURL": "https://github.com/tishion",
      "DocsURL": "https://cefview.github.io/UCefView/",
      "FabURL": "",
      "MarketplaceURL": "",
      "SupportURL": "https://github.com/CefView/UCefView/issues",
      "CanContainContent": true,
      "EngineVersion": "5.0.0",
      "SupportedTargetPlatforms": [
        "Win64",
        "Mac",
        "Linux"
      ],
      "Modules": [
        {
          "Name": "UCefView",
          "Type": "Runtime",
          "LoadingPhase": "Default",
          "PlatformAllowList": [
            "Win64",
            "Mac",
            "Linux"
          ]
        }
      ],
    "PreBuildSteps": {
      "Win64": [
        "echo UCefView:PreBuildSteps:$(TargetType):$(TargetName)",
        "echo Copy CefViewCore runtime dependencies...",
    
      		"robocopy /s /e /v /njh /njs /np /ndl /xn /xo \"$(PluginDir)\\Source\\ThirdParty\\CefViewCore\\bin\" \"$(PluginDir)\\Binaries\\ThirdParty\\CefViewCore\"",
        "if %ERRORLEVEL% LSS 8 (exit /B 0) else (exit /B %ERRORLEVEL%)"
      ],
      "Mac": [
        "echo UCefView:PreBuildSteps:$(TargetType):$(TargetName)",
        "echo Copy CefViewCore runtime dependencies...",
    
        "mkdir -p \"$(PluginDir)/Binaries/ThirdParty/CefViewCore\"",
        "cp -vnpR \"$(PluginDir)/Source/ThirdParty/CefViewCore/bin/\" \"$(PluginDir)/Binaries/ThirdParty/CefViewCore/\"",
    
        "chmod -R +x \"$(PluginDir)/Binaries/ThirdParty/CefViewCore/Mac\""
      ],
      "Linux": [
        "echo UCefView:PreBuildSteps:$(TargetType):$(TargetName)",
        "echo Copy CefViewCore runtime dependencies...",
    
        "mkdir -p \"$(PluginDir)/Binaries/ThirdParty/CefViewCore\"",
        "cp -vnpR \"$(PluginDir)/Source/ThirdParty/CefViewCore/bin/\" \"$(PluginDir)/Binaries/ThirdParty/CefViewCore/\"",
    
        "chmod -R +x \"$(PluginDir)/Binaries/ThirdParty/CefViewCore/Linux\""
      ]
    }
    }
    

What important to know about how FAB will process your submission:

  • The PreBuildSteps scripts will be executed when you build your plugin or build the game project which consumes your plugin.
  • :warning: :warning: DO NOT USE XCOPY ON WINDOWS PLATFORM, because it won’t be executed correctly due to the output redirection, use robocopy instead!
  • When you submit your plugin package, FAB only need you to provide all source content, any built artifacts are not needed and should not be included in your submission package.
  • When FAB gets your plugin package (actually a source package), they will build your plugin with RunUAT.bat or RunUAT.sh with BuildPlugin parameter for all declared supported platforms.
  • You need to make sure the folder YourPlugin/Binaries/ThirdParty/… will be preserved after the building process by declaring the path in YourPlugin/Config/FilterPlugin.ini like:
    [FilterPlugin]
    ; This section lists additional files which will be packaged along with your plugin. 
    ; Paths should be listed relative to the root plugin directory, 
    ; and may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively.
    ;
    ; Examples:
    ;    /README.txt
    ;    /Extras/...
    ;    /Binaries/ThirdParty/*.dll
    
    ; Preserver ThirdParty folder
    /Binaries/ThirdParty/...
    
  • After all platforms were built successfully, FAB will combine all the artifacts in to single one archive file, and they will deploy the archive to the FAB market server. (actually the Intermediate folder will be included because it contains the precompiled files reference, this is important to the project using your plugin)

There is so few documents to describe the FAB build and deploy process, I figure this out by submitting my plugin more than 200 times and eventually published my product successfully.

Hope this will help all developers working on plugins with third-party references.

2 Likes