UE4+科大讯飞SDK的.Build.cs配置

实际操作中我给声音相关的代码带单独建立了一个Module. 此Module和项目Module是次主关系

科大讯飞的SDK库文件相关的Module的.Build.cs文件示例

using System.IO;


namespace UnrealBuildTool.Rules
{
    public class VoiceWakeSupport : ModuleRules
    {
        private string ModulePath
        {
            get { return ModuleDirectory; }
        }
        
        private string ThirdPartyPath
        {
            get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); }
        }


        private string LibraryPath
        {
            get { return Path.GetFullPath(Path.Combine(ThirdPartyPath, "VoiceWake/", "libs/")); }
        }
        
        public VoiceWakeSupport(ReadOnlyTargetRules Target) : base(Target)
        {
            PrivateDependencyModuleNames.AddRange(
            new string[] {
                "Core",
                "CoreUObject",
                "Engine",
            });
   
            PublicAdditionalLibraries.Add(Path.Combine(LibraryPath, "msc_x64.lib"));
            PublicDelayLoadDLLs.Add(Path.Combine(LibraryPath, "msc_x64.dll"));
            RuntimeDependencies.Add(new RuntimeDependency("$(ProjectDir)/Binaries/Win64/msc_x64.dll"));
        }
    }
}

其中ThirdParty文件夹和自己项目的.uproject文件处于同一层级目录。它的内容类似下面这样

ThirdParty

       VoiceWake

              bin

              libs

              doc

              include

其中bin,libs,doc,include为科大讯飞的SDK

因为我使用的UE4.16.3, Win64版本。所以dll和lib都是包含的x64版本。没有使用32位版本


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章