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位版本


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