1、首先创建一个用于放置第三方库的文件夹,这里创建的是CLE文件夹,里面对应创建相应的文件夹和文件
2、把对方给的第三方库文件放到相应的目录下
.注意:build.cs是直接通过右键新建一个 .txt文件,然后直接修改文件名即可
2、编写, .build.cs
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
using System;
using System.IO;
using UnrealBuildTool;
using System.Runtime.InteropServices;
public class CLE : ModuleRules
{
public CLE(ReadOnlyTargetRules Target) : base(Target)
{
Type = ModuleType.External;
bUseRTTI = true;
string SdkBase = ModuleDirectory;
if (!Directory.Exists(SdkBase))
{
string Err = string.Format("CLE SDK not found in {0}", SdkBase);
System.Console.WriteLine(Err);
throw new BuildException(Err);
}
PublicIncludePaths.Add(SdkBase + "/Includes");
string LibraryPath = SdkBase + "/Lib/";
string DllPath = SdkBase + "/Dll/";
string sourceFile = Path.Combine(ModuleDirectory, "Dll/CLESDK.dll");
RuntimeDependencies.Add(sourceFile);
if (Target.Platform == UnrealTargetPlatform.Win64)
{
PrivateRuntimeLibraryPaths.Add(DllPath);
PublicAdditionalLibraries.Add("$(ModuleDir)/Lib/VS2019/X64/CLESDK.lib");
PublicAdditionalLibraries.Add("$(ModuleDir)/Lib/VS2019/X64/CLESDKD.lib");
PublicDelayLoadDLLs.Add("CLESDK.dll");
}
}
}
3、重新setup和GenerateProjectFiles.bat,然后运行 .sln
4、在需要用的模块中添加相应的文件
注:在创建新的 .h 和 .cpp文件时,可以直接在文件夹里面复制贴贴,重命名,然后setup和generate
5、重新setup和GenerateProjectFiles.bat,然后运行 .sln
6、在使用的时候添加头文件就可以
7、一般情况还需要初始sdk,还有license