Modules and targets

Write your module's .Build.cs and your project's .Target.cs, depend on engine modules and prebuilt libraries, and see which modules may link where.

Last updated Nov 4, 2026Edit this pageVersion 1.0.0

The build is described by two kinds of C# file, shaped like Unreal Build Tool's. A module (<Module>.Build.cs) is a unit of code: one folder of sources that builds into one library. A target (<Target>.Target.cs) is one executable: which module it launches, what kind of binary it is, and the definitions every module in it compiles with.

This page is the reference for both files. For a game project's own module, start with the programming section, which walks through it from a game programmer's side.

A module

Source/MyGame/MyGame.Build.cs
public class MyGame : ModuleRules
{
	public MyGame(ReadOnlyTargetRules Target) : base(Target)
	{
		bExplicitBuildOnly = true;

		PublicDependencyModuleNames.Add("EngineLoop");

		CompilerFlags.Add("/FIstdafx.h");

		bUseHeaderTool = true;
		HeaderToolDirectories.Add("Public/MyGame");
	}
}

This is the module a template creates Templates/TP_Coop/Source/TP_Coop/TP_Coop.Build.cs. The file is named after the module, declares a class of the same name deriving from ModuleRules, and takes a ReadOnlyTargetRules in its constructor. A name C# cannot spell has those characters turned into _ (metal-cpp.Build.cs declares metal_cpp). A misnamed class, a rules file that does not compile, and two modules of the same name in one scope stop the build.

What the folders already say

Folders replace most lines:

ConventionEffect
Public/, Classes/Public include paths: every module that depends on this one sees them
Private/The sources, and a private include path
Internal/Visible to modules of the same scope only
A folder named after another platform (Windows/, Linux/, Mac/, …)Skipped when building for a different platform
The module's place in the binariesMOWO_BUILD_<MODULE> (private) and MW_DYNAMIC_LINK (public), which switch its export macro
New .cpp filesPicked up without editing anything

Dependencies use short names ("Core", "EngineLoop"). An engine library's run-time name stays MowoEngine.<Name>, which is what plugin manifests and the module manager use.

Common fields

FieldMeaning
PublicDependencyModuleNamesLinked, and their public headers re-exported to this module's dependents
PrivateDependencyModuleNamesLinked, headers visible to this module only
DynamicallyLoadedModuleNamesBuilt and staged with this module, never linked; loaded by name at run time. A monolithic build links them in
PublicIncludePathModuleNames, PrivateIncludePathModuleNamesHeaders only, no link
PublicIncludePaths, PrivateIncludePaths, InternalIncludePaths, PublicSystemIncludePathsExtra include folders, relative to the module folder or absolute
PublicDefinitions, PrivateDefinitionsPreprocessor definitions
PublicAdditionalLibraries, PublicSystemLibrariesLibraries every consumer links; system libraries by name (ole32, dl)
RuntimeDependenciesFiles staged next to every executable that loads the module, each with a ship condition
CompilerFlags, LinkerFlagsRaw flags
bDeterministicFloatCompiles the module with -ffp-contract=off, so its floating-point results match bit for bit on x64 and arm64 (arm64 clang fuses multiply-adds by default). Off by default because it costs FMA throughput; set it on code that must agree across machines, such as world generation that runs on a server and its clients
SourceDirectories, ExcludeSourcePatternsCompile other folders than Private/, or drop sources by name
bUseUnity, UnityChunkSize, UnityExcludeUnity (jumbo) builds
PrivatePCHHeaderFileA precompiled header
OptimizeCodeDefault, Never (always debuggable) or Always (optimized even in debug)
bUseHeaderTool, HeaderToolDirectoriesRun the reflection code generator over these folders (Public/ when empty)
ShaderDirectories, ShaderArchive, AddShaderSourceDirectoryMappingShaders this module compiles; see Writing a plugin
EmbeddedContentDirectoryA folder (Content by default) linked into the binary as read-only data
IconPath, bIsWindowsApp, bIsMacOSBundleExecutable icon and windowed or bundle form
bExplicitBuildOnlyBuilt only when named with -t or needed by something that is
BinaryTypeOverrides the binary kind the conventions pick
CategorySet only where the folder cannot say it; see below

The rules can read the target through Target: Target.Platform, Target.Configuration, Target.Type, Target.bIsMonolithic, Target.bWithOnline, Target.bIsServer, the SDK switches and Target.GetOption<T>(key, default) for a custom -o option. Helpers name the folders: EngineDirectory, ProjectDirectory, BrandingFile(path).

Module types

TypeWhat it is
ModuleType.CPlusPlus (default)Compiled from the module's sources. A target's launch module is an executable, a module with no sources is header-only, anything else a shared library (a static one in a monolithic build).
ModuleType.ExternalA prebuilt library: include paths, libraries and runtime files only.

A library you bring yourself is an external module in your project: a folder with its headers, its libraries and a .Build.cs that sets Type = ModuleType.External:

Source/ThirdParty/MyLib/MyLib.Build.cs
public class MyLib : ModuleRules
{
	public MyLib(ReadOnlyTargetRules Target) : base(Target)
	{
		Type = ModuleType.External;
		PublicIncludePaths.Add("Include");

		if (Target.Platform == TargetPlatform.Win64)
		{
			PublicAdditionalLibraries.Add("Lib/win-x64/MyLib.lib");
		}
	}
}

A runtime file added with a ship condition decides whether a game package carries it: Always, SteamEnabled, DiscordEnabled, Upscalers, EditorOnly, or AutoSubtitles.

Module categories

Every engine module has a category, as in Unreal, and the category decides where it may link:

CategoryEngine modulesMay link into
Runtimeeverything a game ships: Core, Game, Physics, Audio, ArcUI, …Anything
EditorEditorFramework and the editor's own modulesEditor targets; never a Game or Server target, never the release or profile configuration
Gameyour project's and your plugins' modulesAnything their dependencies allow

A build that links a module its target type or configuration rules out fails with the reason, for example Editor modules never link into a Game target. An editor-only module of your own is a separate module of an Editor-typed plugin; see Writing a plugin. A module named like a configuration is a rules error.

Targets

A target file is named <Target>.Target.cs and declares <Target>Target : TargetRules with a TargetInfo constructor. Its fields:

FieldMeaning
TypeGame, Editor, Server, Program or Test
LaunchModuleNameThe module whose binary is the executable
OutputNameThe executable's name; empty uses the launch module's
ExtraModuleNamesFurther modules built with the target; an executable here builds beside the launch module
GlobalDefinitionsDefinitions every module of the target compiles with
LinkTypeDefault (monolithic when the build asks for it or the platform is mobile), Modular or Monolithic
Configurations, PlatformsWhere the target builds; empty is everywhere
bWithOnlinefalse leaves the session, replication and transport layer out
bBuildEnabledPluginsBuild the enabled engine plugins with the target
bEnableSteam, bEnableDiscord, bEnableMowoOnline, bEnableTracy, bEnableFSR, bEnableXeSS, bEnableStreamline, bEnableAntiLag2SDK switches
bStaticThirdPartyLink third-party static archives instead of their DLLs where both exist
LogFloorThe lowest log level compiled in

The engine's player is the MowoGame module; a project's game target launches it under the project's name. Run mbt info to list the targets the build sees.

A project's targets

A project created from a template carries a game target and an editor target in its Source/ folder Templates/TP_Coop/Source/TP_Coop.Target.cs:

Source/MyGame.Target.cs
public class MyGameTarget : TargetRules
{
	public MyGameTarget(TargetInfo Target) : base(Target)
	{
		Type = TargetType.Game;
		LaunchModuleName = "MowoGame";
		OutputName = "MyGame";
		ExtraModuleNames.Add("MyGame");
	}
}

The game target launches the engine's player, MowoGame, under the project's name, with the game module built beside it. A project's module or target shadows a template's of the same name, so a project scaffolded from a template loads beside it.

Build options

-o KEY=VALUE on mbt build passes an option to the rules, and your rules read it through Target.GetOption<T>(key, default). The engine and the engine plugins are prebuilt in the installed build, so engine options (the SDK switches, the link mode) are fixed by the build you installed; what an option changes is how your own modules compile.

Engine sources

This page describes behavior implemented in these files of the engine repository, checked against commit 72eec6f7f.

  • Templates/TP_Coop/Source/TP_Coop.Target.cs
  • Templates/TP_Coop/Source/TP_Coop/TP_Coop.Build.cs

Page feedback

Was this page helpful?