如何将dll从源文件复制到二进制文件以构建UE插件?

时间:2018-12-17 02:38:24

标签: c# c++ unreal-engine4

我想编写一个依赖于PostgreSQL的UE Editor插件,所以我的插件需要libpq.dll等。现在我有了这个项目结构:

Plugins/
└── MyPlugin
    ├── MyPlugin.uplugin
    ├── Binaries
    └── Source
        └── MyPlugin
            ├── MyPlugin.Build.cs
            ├── Private
            │   └── MyPlugin.cpp
            ├── Public
            │   └── MyPlugin.h
            └── x64
                └── Release
                    ├── libeay32.dll
                    ├── libiconv-2.dll
                    ├── libintl-8.dll
                    ├── libpq.dll
                    ├── libpq.lib
                    └── ssleay32.dll

并且我已经将这些dll文件添加到ModuleRules:

//MyPlugin.Build.cs
public class MyPlugin : ModuleRules
{
    public MyPlugin (TargetInfo Target)
    {
        // Some rules else

        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            // Add the import library
            PublicLibraryPaths.Add(Path.Combine(ModuleDirectory, "x64", "Release"));
            PublicAdditionalLibraries.Add("libpq.lib");

            // Delay-load the DLL, so we can load it from the right place first
            PublicDelayLoadDLLs.Add("libpq.dll");
            PublicDelayLoadDLLs.Add("libeay32.dll");
            PublicDelayLoadDLLs.Add("libiconv-2.dll");
            PublicDelayLoadDLLs.Add("libintl-8.dll");
            PublicDelayLoadDLLs.Add("ssleay32.dll");
        }
    }
}

但是编译成功后,dll文件仍位于Source/MyPlugin/x64/Release中,并且当我要加载插件时,即使我手动将其复制到插件Binaries/Win64中,dll也不会加载可以加载。

我的问题是,我可以更改任何配置以自动执行复制过程吗?

0 个答案:

没有答案