Files
entt/md_docs_md_unreal.html
2021-07-28 10:12:19 +02:00

130 lines
7.8 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>EnTT: EnTT and Unreal Engine</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">EnTT
&#160;<span id="projectnumber">3.8.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">EnTT and Unreal Engine </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="autotoc_md149"></a>
Enable Cpp17</h1>
<p>As of writing (Unreal Engine v4.25), the default C++ standard of Unreal Engine is C++14.<br />
On the other hand, note that <code>EnTT</code> requires C++17 to compile. To enable it, in the main module of the project there should be a <code>&lt;Game Name&gt;.Build.cs</code> file, the constructor of which must contain the following lines:</p>
<div class="fragment"><div class="line">PCHUsage = PCHUsageMode.NoSharedPCHs;</div>
<div class="line">PrivatePCHHeaderFile = <span class="stringliteral">&quot;&lt;PCH filename&gt;.h&quot;</span>;</div>
<div class="line">CppStandard = CppStandardVersion.Cpp17;</div>
</div><!-- fragment --><p>Replace <code>&lt;PCH filename&gt;.h</code> with the name of the already existing PCH header file, if any.<br />
In case the project doesn't already contain a file of this type, it's possible to create one with the following content:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#pragma once</span></div>
<div class="line"><span class="preprocessor">#include &quot;CoreMinimal.h&quot;</span></div>
</div><!-- fragment --><p>Remember to remove any old <code>PCHUsage = &lt;...&gt;</code> line that was previously there. At this point, C++17 support should be in place.<br />
Try to compile the project to ensure it works as expected before following further steps.</p>
<p>Note that updating a <em>project</em> to C++17 doesn't necessarily mean that the IDE in use will also start to recognize its syntax.<br />
If the plan is to use C++17 in the project too, check the specific instructions for the IDE in use.</p>
<h1><a class="anchor" id="autotoc_md150"></a>
EnTT as a third party module</h1>
<p>Once this point is reached, the <code>Source</code> directory should look like this:</p>
<div class="fragment"><div class="line">Source</div>
<div class="line">| MyGame.Target.cs</div>
<div class="line">| MyGameEditor.Target.cs</div>
<div class="line">|</div>
<div class="line">+---MyGame</div>
<div class="line">| | MyGame.Build.cs</div>
<div class="line">| | MyGame.h (PCH Header file)</div>
<div class="line">|</div>
<div class="line">\---ThirdParty</div>
<div class="line"> \---EnTT</div>
<div class="line"> | EnTT.Build.cs</div>
<div class="line"> |</div>
<div class="line"> \---entt (GitHub repository content inside)</div>
</div><!-- fragment --><p>To make this happen, create the folder <code>ThirdParty</code> under <code>Source</code> if it doesn't exist already. Then, add an <code>EnTT</code> folder under <code>ThirdParty</code>.<br />
Within the latter, create a new file <code>EnTT.Build.cs</code> with the following content:</p>
<div class="fragment"><div class="line"><span class="keyword">using</span> System.IO;</div>
<div class="line"><span class="keyword">using</span> UnrealBuildTool;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">public</span> <span class="keyword">class </span>EnTT: ModuleRules {</div>
<div class="line"> <span class="keyword">public</span> EnTT(ReadOnlyTargetRules Target) : base(Target) {</div>
<div class="line"> Type = ModuleType.External;</div>
<div class="line"> PublicIncludePaths.Add(Path.Combine(ModuleDirectory, <span class="stringliteral">&quot;entt&quot;</span>, <span class="stringliteral">&quot;src&quot;</span>, <span class="stringliteral">&quot;entt&quot;</span>));</div>
<div class="line"> }</div>
<div class="line">}</div>
</div><!-- fragment --><p>The last line indicates that the actual files will be found in the directory <code>EnTT/entt/src/entt</code>.<br />
Download the repository for <code>EnTT</code> and place it next to <code>EnTT.Build.cs</code> or update the path above accordingly.</p>
<p>Finally, open the <code>&lt;Game Name&gt;.Build.cs</code> file and add <code>EnTT</code> as a dependency at the end of the list:</p>
<div class="fragment"><div class="line">PublicDependencyModuleNames.AddRange(<span class="keyword">new</span>[] {</div>
<div class="line"> <span class="stringliteral">&quot;Core&quot;</span>, <span class="stringliteral">&quot;CoreUObject&quot;</span>, <span class="stringliteral">&quot;Engine&quot;</span>, <span class="stringliteral">&quot;InputCore&quot;</span>, [...], <span class="stringliteral">&quot;EnTT&quot;</span></div>
<div class="line">});</div>
</div><!-- fragment --><p>Note that some IDEs might require a restart to start recognizing the new module for code-highlighting features and such.</p>
<h1><a class="anchor" id="autotoc_md151"></a>
Include EnTT</h1>
<p>In any source file of the project, add <code>#include "entt.hpp"</code> or any other path to the file from <code>EnTT</code> to use it.<br />
Try to create a registry as <code><a class="el" href="namespaceentt.html#a292643317d1dbb13e45824f757bd1086" title="Alias declaration for the most common use case.">entt::registry</a> registry;</code> to make sure everything compiles fine. </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>