查看: 369|回复: 6

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

[复制链接]

1

主题

342

帖子

7万

积分

管理员

Rank: 9Rank: 9Rank: 9

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



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

主题

830

帖子

2727

积分

vip会员

Rank: 1

积分
2727
发表于 2016-7-2 20:48:08 来自手机 | 显示全部楼层
好东西 好东西 好东西 好东西
回复 支持 反对

使用道具 举报

0

主题

913

帖子

3004

积分

vip会员

Rank: 1

积分
3004
发表于 2016-7-3 10:44:53 | 显示全部楼层
感谢分享,下载看看
回复 支持 反对

使用道具 举报

0

主题

863

帖子

2891

积分

vip会员

Rank: 1

积分
2891
发表于 2016-7-4 07:04:50 来自手机 | 显示全部楼层
真的是全套吗?
回复 支持 反对

使用道具 举报

0

主题

1289

帖子

4023

积分

vip会员

Rank: 1

积分
4023
发表于 2016-7-10 08:19:57 来自手机 | 显示全部楼层
学习了,感谢分享
回复 支持 反对

使用道具 举报

0

主题

894

帖子

2977

积分

vip会员

Rank: 1

积分
2977
发表于 2016-7-12 18:51:21 来自手机 | 显示全部楼层
谢谢分享,顶一个
回复 支持 反对

使用道具 举报

0

主题

887

帖子

2940

积分

vip会员

Rank: 1

积分
2940
发表于 2016-7-18 11:43:28 | 显示全部楼层
等会儿下载看看
回复 支持 反对

使用道具 举报

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

本版积分规则

 
 



邮件留言:


 
返回顶部