Hmm, let’s try.
using UnrealBuildTool;
using System.IO;
public class LlamaCppLight : ModuleRules
{
private string ThirdPartyLlamaCpp
{
get { return Path.GetFullPath(Path.Combine(ModuleDirectory, "../ThirdParty/llama.cpp")); }
}
public LlamaCppLight(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
}
);
PrivateIncludePaths.AddRange(
new string[] {
Path.Combine(ThirdPartyLlamaCpp, "Include")
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"Projects"
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"GameplayTags"
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
}
);
if (Target.Platform == UnrealTargetPlatform.Win64)
{
string BinariesPath = Path.Combine(ThirdPartyLlamaCpp, "Binaries/Win64");
// Add static libraries
PublicAdditionalLibraries.AddRange
(
new string[]
{
Path.Combine(BinariesPath, "llama.lib"),
Path.Combine(BinariesPath, "ggml.lib")
}
);
// Add dynamic libraries
PublicDelayLoadDLLs.AddRange(
new string[]
{
"llama.dll",
"ggml.dll"
}
);
if (!Target.bBuildEditor)
{
string[] DLLs = { "ggml.dll", "ggml-base.dll", "llama.dll" };
// Target directory in a packaged project
string DllDestinationDir = "$(ProjectDir)/Binaries/ThirdParty/llama.cpp";
// Copy DLLs to the target project's executable directory
foreach (string FileName in DLLs)
{
RuntimeDependencies.Add(Path.Combine(DllDestinationDir, FileName), Path.Combine(BinariesPath, FileName));
}
}
}
}
}
and (consider bUseEspeak = true)
using UnrealBuildTool;
using System.IO;
public class LocalTTS : ModuleRules
{
private string ThirdPartyEspeak
{
get { return Path.GetFullPath(Path.Combine(ModuleDirectory, "../ThirdParty/espeak")); }
}
private string ThirdPartyUni
{
get { return Path.GetFullPath(Path.Combine(ModuleDirectory, "../ThirdParty/uni_algo")); }
}
public LocalTTS(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
// **************************************************
// ESPEAK-NG LIBRARY
bool bUseEspeak = false;
// ESPEAK-NG LIBRARY
// **************************************************
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
Path.Combine(ThirdPartyUni, "Include"),
Path.Combine(ModuleDirectory, "../ThirdParty/miniz")
}
);
if (Target.Platform == UnrealTargetPlatform.Android)
{
PublicIncludePaths.Add(Path.Combine(ThirdPartyEspeak, "Include"));
}
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"Projects",
"NNE"
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"Json",
"AudioPlatformConfiguration",
"AudioExtensions"
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
}
);
if (bUseEspeak)
{
if (Target.Platform == UnrealTargetPlatform.Win64)
{
PublicDefinitions.Add("ESPEAK_NG=1");
}
else
{
PublicDefinitions.Add("ESPEAK_NG=0");
}
if (Target.Platform == UnrealTargetPlatform.Win64)
{
// copy all DLLs to the packaged build
if (!Target.bBuildEditor && Target.Type == TargetType.Game)
{
string BinariesPath = Path.Combine(ThirdPartyEspeak, "Binaries", "Win64");
string DllDestinationDir = "$(ProjectDir)/Binaries/ThirdParty/espeak";
string[] DLLs = { "libespeak-ng.dll" };
// Copy DLLs to the target project's executable directory
foreach (string FileName in DLLs)
{
RuntimeDependencies.Add(Path.Combine(DllDestinationDir, FileName), Path.Combine(BinariesPath, FileName));
}
}
if (!Target.bBuildEditor)
{
string PluginContentPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../Content/NonUFS/espeak-ng-data/*"));
string ProjectContentPath = "$(ProjectDir)/Content/NonUFS/espeak-ng-data/*";
RuntimeDependencies.Add(ProjectContentPath, PluginContentPath, StagedFileType.NonUFS);
}
}
}
else
{
PublicDefinitions.Add("ESPEAK_NG=0");
}
}
}