查看: 1131|回复: 10

[平台开发] 【Getting Started: Developing Linux Projects | Unreal Engine】

[复制链接]

1

主题

342

帖子

7万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
75866
发表于 2016-6-29 00:45:16 | 显示全部楼层 |阅读模式



Choose your installation method:
   
Epic Games Launcher
   
Compiling from Source

本页面的内容:

      
Why cross-compilation

Setting up the toolchain

Setting up packaging for Linux

Packaging for Linux
Changes for Linux-ARM platforms
     Why cross-compilation
Cross-compilation was chosen in order to make it easier for game developers (who tend to have Windows-centric workflow) to target Linux. At the moment, this is only supported for Windows, Mac users currently have to resort to native compilation. We support and test Linux-x86_64, but we provide the libraries and the toolchain (clang-3.5.0-arm) which allow you to compile for Linux ARM as well (original Raspberry Pi and up), although this will require you to make a (minor) code change in UBT.

From this point on we assume that you are targeting x86_64 Linux; although the most of below will apply to compiling for ARM as well (except for the different toolchain). Note that you can build your own toolchain if you want different versions of the tools or want to target a different architecture.
Setting up the toolchain
Add an environment variable (Control Panel->System->Advanced system settings->Advanced->Environment variables) named LINUX_ROOT, value of which is the absolute path to your toolchain, without trailing backslash:

【虚幻4翻译文档-Getting Started: Developing Linux Projects | Unreal Engine】[虚幻4中文文档]



After you made sure that variable is set, regenerate UE4 project files (using GenerateProjectFiles.bat) and restart Visual Studio. After this, you should have "Linux" available among Win32/Win64 configurations, and you should be able to cross-compile for it.
Setting up packaging for Linux
     
Note that binary release can only package content-only projects. If you want to package a code-based project for Linux (or a project that has non-default third party plugins), you will have to set up a source build. Otherwise, if you are fine with content-only, there are no need to build anything as Linux binaries of UE4Game and CrashReportClient are bundled.


  
For packaging for Linux platform you will need to build the following targets:

For Linux:

CrashReportClient

UE4Game (if you project is content-only, otherwise just build your project)

For Windows:

The editor itself (this is needed to get Linux target modules built, so that Unreal Editor and Unreal Frontend know how to cook/package games for Linux).

UnrealPak and ShaderCompileWorker (you probably have those built anyway, but mentioning it for completeness).
    Packaging for Linux
The easiest way to package a project is to open it in the editor and then using File->Package To->Linux (assuming that you have a cross-toolchain installed in the previous step and Linux target modules are built for the editor in question - if you don't see Linux in the list, then it's likely that one of the former is not true - see above). After some time (which depends on the project in question and is rather short for sample project) you will have game assets and binaries in the directory you chose to package to.

The details of the packaging process can be seen by clicking the "Show Output Log" link. If this process fails with error message "unable to find UnrealPak or ShaderCompileWorker" see above about building them for the host (windows) platform.

Scp or otherwise copy it to a target machine (mounting a Samba share - if you know how to do that - may be better if target machine is low on disk space, this also reduces iteration times), chmod +x the target executable (which will be located in LinuxNoEditor/<ProjectName>/Binaries/Linux/ directory) and run it.

Changes for Linux-ARM platforms
If you are using the Linux-ARM cross compile toolchain before running GenerateProjectFiles.bat below edit the following file in the UE4 source code:

.UnrealEngine/Engine/Source/Programs/UnrealBuildTool/Linux/UEBuildLinux.cs

by commenting out the following line:

static private string DefaultArchitecture = "x86_64-unknown-linux-gnu";

and un-commenting the linux-arm architecture line just below it:

//static private string DefaultArchitecture = "arm-unknown-linux-gnueabihf";

An additional step is required for the packaged project to be runnable on Linux-ARM platforms. Assuming the packaged project is located at \foo\bar\SunTemple_Linux open the following location:

\foo\bar\SunTemple_Linux\LinuxNoEditor\Engine\Binaries\Linux

and replace libopenal.so.1 with the version from:

...\UnrealEngine\Engine\Source\ThirdParty\OpenAL\1.15.1\lib\Linux\arm-unknown-linux-gnueabihf\libopenal.so

where ...\UnrealEngine is the location of the UE4 source code. Please be sure to rename libopenal.so to libopenal.so.1.

Now the project can be copied over to the target machine, chmod+x the target executable and run it as instructed above.
回复

使用道具 举报

0

主题

872

帖子

2905

积分

vip会员

Rank: 1

积分
2905
发表于 2016-7-2 20:56:15 来自手机 | 显示全部楼层
多少钱,看看
回复 支持 反对

使用道具 举报

0

主题

833

帖子

2752

积分

vip会员

Rank: 1

积分
2752
发表于 2016-7-4 03:46:21 来自手机 | 显示全部楼层
楼主辛苦
回复 支持 反对

使用道具 举报

0

主题

865

帖子

2854

积分

vip会员

Rank: 1

积分
2854
发表于 2016-7-4 13:47:40 来自手机 | 显示全部楼层
谢谢分享,顶一个
回复 支持 反对

使用道具 举报

0

主题

952

帖子

3131

积分

vip会员

Rank: 1

积分
3131
发表于 2016-7-5 03:36:22 | 显示全部楼层
都是好东西
回复 支持 反对

使用道具 举报

0

主题

914

帖子

3005

积分

vip会员

Rank: 1

积分
3005
发表于 2016-7-12 05:56:07 来自手机 | 显示全部楼层
这个支持了呀,不错,顶顶帖拿拿钱
回复 支持 反对

使用道具 举报

0

主题

885

帖子

2862

积分

vip会员

Rank: 1

积分
2862
发表于 2016-7-14 23:55:34 来自手机 | 显示全部楼层
全就行啊,,支持 一下
回复 支持 反对

使用道具 举报

0

主题

880

帖子

2958

积分

vip会员

Rank: 1

积分
2958
发表于 2016-7-18 11:38:52 来自手机 | 显示全部楼层
谢谢楼主分享
回复 支持 反对

使用道具 举报

0

主题

897

帖子

2983

积分

vip会员

Rank: 1

积分
2983
发表于 2016-7-23 16:05:05 | 显示全部楼层
感谢楼主的大爱无私
回复 支持 反对

使用道具 举报

0

主题

898

帖子

2938

积分

vip会员

Rank: 1

积分
2938
发表于 2016-7-26 21:26:37 来自手机 | 显示全部楼层
看看!便宜就好了
回复 支持 反对

使用道具 举报

*滑块验证:
您需要登录后才可以回帖 登录 | enginedx注册

本版积分规则

 
 



邮件留言:


 
返回顶部