UE4 Project.Build.cs配置示例(UE4引用libuv靜態(tài)鏈接庫
來源:
52vr |
責(zé)任編輯:傳說的落葉 |
發(fā)布時(shí)間: 2019-06-06 08:27 | 瀏覽量:
這個(gè)例子演示了如何鏈接libuv靜態(tài)庫相關(guān)的配置。
libuv版本是v1.8
- // Fill out your copyright notice in the Description page of Project Settings.
- using System.IO;
- using UnrealBuildTool;
- public class HuaiKXSrv : ModuleRules
- {
- private string ModulePath
- {
- get { return Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); }
- }
- private string ThirdPartyPath
- {
- get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); }
- }
- public HuaiKXSrv(TargetInfo Target)
- {
- PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
- PrivateDependencyModuleNames.AddRange(new string[] { });
- // Uncomment if you are using Slate UI
- // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
- // Uncomment if you are using online features
- // PrivateDependencyModuleNames.Add("OnlineSubsystem");
- // if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64))
- // {
- // if (UEBuildConfiguration.bCompileSteamOSS == true)
- // {
- // DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");
- // }
- // }
- AddDefines(Target);
- LoadLibuv(Target);
- }
- public void AddDefines(TargetInfo Target)
- {
- if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64))
- {
- Definitions.Add("_IS_WINDOWS_");
- }
- else
- {
- Definitions.Add("_IS_LINUX_");
- }
- }
- //鏈接libuv
- public bool LoadLibuv(TargetInfo Target)
- {
- bool isLibrarySupported = false;
- //libuv需要的系統(tǒng)lib
- PublicAdditionalLibraries.Add("IPHLPAPI.lib");
- PublicAdditionalLibraries.Add("Psapi.lib");
- PublicAdditionalLibraries.Add("userenv.lib");
- PublicAdditionalLibraries.Add("msvcrtd.lib");
- if (Target.Configuration == UnrealTargetConfiguration.Debug || Target.Configuration == UnrealTargetConfiguration.DebugGame)
- {
- if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
- {
- isLibrarySupported = true;
- string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "D.x64" : "D.x86";
- string LibrariesPath = Path.Combine(ThirdPartyPath, "Libuv", "Libraries");
- string LibuvLibPath = Path.Combine(LibrariesPath, "libuv" + PlatformString + ".lib");
- PublicAdditionalLibraries.Add(LibuvLibPath);
- System.Console.WriteLine("#### Set Debug Libuv Libraries ####:" + LibuvLibPath);
- }
- }
- else if (Target.Configuration == UnrealTargetConfiguration.Shipping || Target.Configuration == UnrealTargetConfiguration.Development)
- {
- if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
- {
- isLibrarySupported = true;
- string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86";
- string LibrariesPath = Path.Combine(ThirdPartyPath, "Libuv", "Libraries");
- string LibuvLibPath = Path.Combine(LibrariesPath, "libuv." + PlatformString + ".lib");
- PublicAdditionalLibraries.Add(LibuvLibPath);
- System.Console.WriteLine("#### Set Shipping Libuv Libraries ####:" + LibuvLibPath);
- }
- }
- if (isLibrarySupported)
- {
- System.Console.WriteLine("#### Set Libuv Includes ####:" + Path.Combine(ThirdPartyPath, "Libuv", "Includes"));
- // Include path
- PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "Libuv", "Includes"));
- }
- //Definitions.Add(string.Format("WITH_BOBS_MAGIC_BINDING={0}", isLibrarySupported ? 1 : 0));
- return isLibrarySupported;
- }
- }
-
分享到:
相關(guān)文章
網(wǎng)友評(píng)論
您需要登錄后才可以發(fā)帖 登錄 | 立即注冊(cè)
關(guān)閉
- 用戶名:
- 密 碼:
- 驗(yàn)證碼: 看不清? 點(diǎn)擊更換
- 忘記密碼?
全部評(píng)論:0條
推薦
熱門