Skip to main content

Building from Studio

Studio builds two things:

  • Game packages for a build target: a named combination of platform, code form and output location. This is how you produce the game you ship.
  • The native module, if your project has custom C code: the library Studio loads so that Play runs your C code.

Both are set up in the Build Settings view. What each platform and code form produces is explained in Deployment modes and Platforms.

Toolbar​

ControlShortcutAction
Target selector—Picks a build target, or Project for the native module.
Build (hammer)Ctrl+BBuilds the selected target's package. With Project selected, builds the native module; projects without one open Build Settings instead.
—Ctrl+Shift+BBuild: Rebuild: a clean rebuild of the native module.
Build Settings—Opens Build Settings.

Every build first saves all documents; if a save fails, the build does not start. Studio stays usable while it builds, and the output streams into Output. Compiler errors and warnings become clickable entries that open the file at that line. Only one build runs at a time.

Build Settings​

Open it from the toolbar, Build: Build Settings, the Project overview on the Welcome page, or the View menu. It has three tabs.

Targets​

Targets are saved in the project file's build_targets list (see .ctproject). Every project starts with Windows, Linux and WebAssembly targets.

ControlDescription
TargetThe target to edit.
Add TargetAdds a new target for This desktop.
RemoveRemoves the selected target.
NameTarget name. Required and unique.
PlatformThis desktop, Windows, Linux, WebAssembly or macOS (macOS is Not supported).
Code formHow your BT code ships; see below.
Output executableWhere the built game goes, absolute or relative to the project file. For WebAssembly this is usually build/web/index.html.
Deploy folderOptional folder that Build & Deploy copies the finished build to, for example a shared drive or a local web server folder.
Save TargetsSaves your target changes to the project file.
ReloadRereads the project file and throws away unsaved changes in this form.
Build ArtifactSaves, then builds the selected target.
Build & DeployBuilds, then replaces the deploy folder's contents with the new build.
Cancel BuildStops the running build.
Code formPlatformsNotes
Source · compile at startupAllShips your BT source.
Bytecode · precompiledAllShips compiled bytecode. Default for new WebAssembly targets (Source if the project has custom C code).
Embedded AOT · single executableWindows, LinuxMachine code built into one executable.
Shared AOT · adjacent DLL/SOWindows, LinuxMachine code in a library next to the executable.
Linked AOT · native toolchainWindows, LinuxFastest startup; needs a C compiler set up in Native Toolchain.

AOT means compiled ahead of time to machine code. Compare the forms in Deployment modes.

Building a desktop target replaces its output folder with the new build. You can only build desktop targets for the system you are running Studio on; cross-compiling is Not implemented. Each target has one deploy folder; add more targets for more destinations.

If the project file changed since Build Settings loaded it, saving is refused; press Reload first.

Native Toolchain​

Settings for building the native module, and for builds that need a C compiler (Linked AOT, or any project with custom C code). They are saved per project, on this machine only, in <project>/.studio-native-build.

ControlDescription
Compiler presetHost compiler, GCC, Clang or Custom path. Fills in C compiler.
ConfigurationRelease, Debug, RelWithDebInfo or MinSizeRel. Play uses the configuration that matches its Release/Debug mode.
C compilerPath to the compiler.
CMakePath to CMake.
Source directory, Build directory, CMake targetThe native module's CMake project. Shown only for projects with a native module; filled in for you.
Build ModuleBuilds the module and reloads it.
Clean BuildRebuilds the module from scratch and reloads it.
Reload ModuleReloads the module after you built it outside Studio.
Save ToolchainSaves these settings without building. All fields are required.
Cancel BuildStops the running build.

Reloading the module restarts a running game; see Play and debug. Requirements for native modules: Native SDK.

Debug Host​

ControlDescription
PortPort number, 1–65535.
TokenDebug token.
Save Debug HostSaves these to the project file. Leave both empty to turn this off.

Use this only to debug a BT runtime your own C code creates; see Play and debug.

Limits​

  • Source, Bytecode, Embedded AOT and Shared AOT builds need nothing besides Studio. Linked AOT and projects with custom C code need a C compiler and CMake.
  • Building runs the project's CMake and C code. Only build projects you trust.
  • Closing the project or Studio stops a running build.