UE4 加载第三方库
来源:互联网 发布:单片机中断编写生日歌 编辑:程序博客网 时间:2024/05/17 04:09
首先写一个第三方库
.h
#pragma once#ifndef __MYTEST_LIB_H__#define __MYTEST_LIB_H__#include <string>#include <iostream>int Addd(int a, int b);#endif.cpp
#include "stdafx.h"#include "MyDll.h"int Addd(int a, int b) { return a + b; }生成静态库lib
第一种,项目调用:
和Source同级目录下建个ThirdParty文件夹,在ThirdParty下再新建Includes和Libs文件夹,把上面的.h丢进Includes,lib丢进Libs
然后在项目Build.cs下添加:
using System.IO; private string ModulePath { get{ return ModuleDirectory; }//return Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); } private string ThirdPartyPath { get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); } }在 public TTTTT(TargetInfo Target)下加上:同下LoadThirdPartyLib(Target);函数
// PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "Includes")); // PublicAdditionalLibraries.Add(Path.Combine(ThirdPartyPath, "Libs", "XXX.lib"));接下来就可以在.h文件里#include你的第三方头文件了
第二种,插件调用:
同样在插件Source同级下新建ThirdParty文件夹,在ThirdParty下多一层MyTestLib文件夹,再往下新建Includes和Libs文件夹,把上面的.h丢进Includes,lib丢进Libs
然后在插件Build.cs下添加:
using System.IO;private string ModulePath //第三方库 { // get { return Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); } get { return ModuleDirectory; } } private string ThirdPartyPath//第三方库 { get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); } } private string MyLibPath //第三方库MyTestLib的目录 { get { return Path.GetFullPath(Path.Combine(ThirdPartyPath, "MyTestLib")); } }public Test(TargetInfo Target)下添加一个 LoadThirdPartyLib(Target);函数,下面是函数实现
public bool LoadThirdPartyLib(TargetInfo Target) { bool isLibrarySupported = false; if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))//平台判断 { isLibrarySupported = true; System.Console.WriteLine("----- isLibrarySupported true"); string PlatformSubPath = (Target.Platform == UnrealTargetPlatform.Win64) ? "Win64" : "Win32"; string LibrariesPath = Path.Combine(MyLibPath, "Libs"); PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath,/* PlatformSubPath,*/ "MyThirdParty.lib"));//加载第三方静态库.lib } if (isLibrarySupported) //成功加载库的情况下,包含第三方库的头文件 { // Include path System.Console.WriteLine("----- PublicIncludePaths.Add true"); PublicIncludePaths.Add(Path.Combine(MyLibPath, "Includes")); } return isLibrarySupported; }接下来就可以在.h文件里#include你的第三方头文件了
下面是分享的代码http://download.csdn.net/detail/u014532636/9853272
参考:
http://blog.csdn.net/Szu_IT_Man/article/details/58232638
http://blog.csdn.net/yangxuan0261/article/details/52098104
http://blog.csdn.net/lunweiwangxi3/article/details/48373033
加载DLL参考:
http://blog.csdn.net/baidu_27276201/article/details/75675836?locationNum=2&fps=1
https://wiki.unrealengine.com/Linking_Dlls
http://blog.csdn.net/szu_it_man/article/details/58232638#引用dll
阅读全文
1 0
- UE4 加载第三方库
- UE4使用第三方库
- UE4使用第三方库
- UE4第三方库导入
- ue4加载第三方库发布android遇到的一些类bug
- UE4 加载使用第三方lib dll so
- QT 加载第三方库
- python 加载第三方库
- codeIgniter加载第三方库
- android 加载第三方库
- 第三方图片加载库
- UE4使用第三方库读写xml文件
- 用第三方库加载缓存图片
- Cocos2dx加载第三方库so
- SDWebImage第三方库加载图片生硬
- Cocos2dx加载第三方库so
- 第三方加载图片
- 第三方加载图片
- 协同过滤算法
- LeetCode 292:Nim Game(尼姆游戏)
- juery学习笔记一
- 凿壁系列
- 虚拟机类加载机制
- UE4 加载第三方库
- bzoj 1756: Vijos1083 小白逛公园 (线段树)
- Unity为Android编写插件
- web.xml配置
- JS中的变量比较大小。
- 最小堆 :完全二叉树,能方便地从中取出最小/大元素
- LeetCode之路:122. Best Time to Buy and Sell Stock II
- 水电费第三方
- D3D9 简单图形的绘制以及显示