What you need installed
What has to be on your computer to build your game. Players need none of this; see Platforms for their side.
| Build | What you need |
|---|---|
| Desktop: Source, Bytecode, Embedded AOT, Shared AOT | Nothing beyond cTurtle (Studio, or ctgame from a cTurtle build) |
| Desktop: Linked AOT | cTurtle, plus the C toolchain |
| Desktop: any game with its own C code | cTurtle, plus the C toolchain |
Desktop: debuggable build (bt_debug_runtime) | Nothing beyond cTurtle (the C toolchain only if the game also has its own C code) |
| Web | cTurtle with its web SDK |
ctgame finds the BT compiler and its other helper files next to itself. Keep
the folder it came in together; don't copy ctgame out on its own.
C toolchain
Needed only for the builds marked above. Install:
- CMake 3.22 or newer.
- The same C compiler, at the same version, that built your copy of cTurtle. cTurtle's libraries are linked into your game, so a different compiler is rejected. cTurtle is tested with MinGW-w64 GCC on Windows and GCC on Linux.
- The build tool CMake uses with that cTurtle build (for example Ninja or make).
You also choose a build configuration (Release, Debug, ...). It must match the configuration your copy of cTurtle was built in, which is usually Release.
In Studio
Open Build Settings → Native Toolchain and set:
| Field | What to enter |
|---|---|
| Compiler preset | Host compiler picks the compiler cTurtle was built with. This is almost always the right choice. |
| C compiler | Filled in by the preset; or the path to the compiler. |
| CMake | Path to cmake. |
| Configuration | The configuration Studio was built in, usually Release. |
Click Save Toolchain. These settings are saved for this project on this
computer only (in .studio-native-build, which you shouldn't commit) and are
used by every build that needs them. See
Building from Studio.
On the command line
ctgame uses the tools that built cTurtle by default. To use others, pass them
as options or set environment variables:
ctgame build --target "Linux Release" \
--native-cmake /usr/bin/cmake \
--native-compiler /usr/bin/gcc \
--native-config Release \
MyGame.ctproject
The full list of options and variables is in
ctgame.
Toolchain errors
| Message | What to do |
|---|---|
Native SDK requires <compiler> <version>, 8-byte pointers and <configuration>. ... | Your compiler, its version or the configuration differs from the one cTurtle was built with. Pick Host compiler and the configuration named in the message. |
| A CMake error about a missing generator or make program | Install the build tool your cTurtle was built with, or pass --native-generator and --native-make-program. |
| C compile or link errors | Problems in your own C code are shown in Studio's Output and Problems panels with clickable locations. |
If you switch compilers, delete the project's .ctbuild folder so the next
build starts clean.
Web SDK
Web builds use the cTurtle web SDK, a folder named web-sdk that contains its
own compiler. You don't need to install Emscripten, Node, Python or CMake for
a web build.
ctgame looks for the SDK in this order:
- The folder in the
CTGAME_WEB_SDKenvironment variable. - A
web-sdkfolder next toctgame(Studio packages that include web support have one). - The web SDK of the cTurtle build that produced
ctgame.
If none is usable, the build fails with web SDK is missing or incomplete.
Get a cTurtle package that includes web-sdk, or point CTGAME_WEB_SDK at
one. The web SDK must come from the same cTurtle version as ctgame.