Compile Godot Export Templates



The basic command to compile an export template is:

scons platform=linuxbsd target=template_release

Where platform could also be windows, android… instead of linuxbsd. Both templates can be compiled at the same time using template_debug/template_release.

This generates a 70MB executable. To use this template we have to add it to desired export preset:

Add template to export preset

Optimizing the template

To reduce the executable size, we can add some more options:

scons platform=linuxbsd target=template_release tools=no lto=full production=yes

Now the executable size is 64MB

Using a build profile

From the Godot editor, we can create a build profile to remove features that we don’t want the engine to have. For example, because my game is in 2d, I don’t want the 3d nodes:

Creating build profile

When we compile the template, we have to add the build_profile parameter and specify the path to it:

scons platform=linuxbsd target=template_release tools=no lto=full production=yes build_profile=path/to/build_profile

Encryption

To allow the encryption of the project, so when it’s exported nobody that does not know the key can see our files, add SCRIPT_AES256_ENCRYPTION_KEY=your_key before scons:

SCRIPT_AES256_ENCRYPTION_KEY=your_key scons platform=linuxbsd target=template_release tools=no lto=full production=yes build_profile=path/to/build_profile

References

up arrow