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
| Control | Shortcut | Action |
|---|---|---|
| Target selector | — | Picks a build target, or Project for the native module. |
| Build (hammer) | Ctrl+B | Builds the selected target's package. With Project selected, builds the native module; projects without one open Build Settings instead. |
| — | Ctrl+Shift+B | Build: 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.
| Control | Description |
|---|---|
| Target | The target to edit. |
| Add Target | Adds a new target for This desktop. |
| Remove | Removes the selected target. |
| Name | Target name. Required and unique. |
| Platform | This desktop, Windows, Linux, WebAssembly or macOS (macOS is Not supported). |
| Code form | How your BT code ships; see below. |
| Output executable | Where the built game goes, absolute or relative to the project file. For WebAssembly this is usually build/web/index.html. |
| Deploy folder | Optional folder that Build & Deploy copies the finished build to, for example a shared drive or a local web server folder. |
| Save Targets | Saves your target changes to the project file. |
| Reload | Rereads the project file and throws away unsaved changes in this form. |
| Build Artifact | Saves, then builds the selected target. |
| Build & Deploy | Builds, then replaces the deploy folder's contents with the new build. |
| Cancel Build | Stops the running build. |
| Code form | Platforms | Notes |
|---|---|---|
| Source · compile at startup | All | Ships your BT source. |
| Bytecode · precompiled | All | Ships compiled bytecode. Default for new WebAssembly targets (Source if the project has custom C code). |
| Embedded AOT · single executable | Windows, Linux | Machine code built into one executable. |
| Shared AOT · adjacent DLL/SO | Windows, Linux | Machine code in a library next to the executable. |
| Linked AOT · native toolchain | Windows, Linux | Fastest 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.
| Control | Description |
|---|---|
| Compiler preset | Host compiler, GCC, Clang or Custom path. Fills in C compiler. |
| Configuration | Release, Debug, RelWithDebInfo or MinSizeRel. Play uses the configuration that matches its Release/Debug mode. |
| C compiler | Path to the compiler. |
| CMake | Path to CMake. |
| Source directory, Build directory, CMake target | The native module's CMake project. Shown only for projects with a native module; filled in for you. |
| Build Module | Builds the module and reloads it. |
| Clean Build | Rebuilds the module from scratch and reloads it. |
| Reload Module | Reloads the module after you built it outside Studio. |
| Save Toolchain | Saves these settings without building. All fields are required. |
| Cancel Build | Stops the running build. |
Reloading the module restarts a running game; see Play and debug. Requirements for native modules: Native SDK.
Debug Host
| Control | Description |
|---|---|
| Port | Port number, 1–65535. |
| Token | Debug token. |
| Save Debug Host | Saves 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.