|
| 1 | +.. _doc_engine_compilation_configuration_editor: |
| 2 | + |
| 3 | +Using the engine compilation configuration editor |
| 4 | +================================================= |
| 5 | + |
| 6 | +Godot comes with a large set of built-in features. While this is convenient, |
| 7 | +this also means its binary size is larger than it could be, especially |
| 8 | +for projects that only use a small portion of its feature set. |
| 9 | + |
| 10 | +To help reduce binary size, it is possible to compile custom export templates |
| 11 | +with certain features disabled. This is described in detail in :ref:`doc_optimizing_for_size`. |
| 12 | +However, determining which features need to be disabled can be a tedious task. |
| 13 | +The engine compilation configuration editor aims to address this |
| 14 | +by providing an interface to view and manage these features easily, |
| 15 | +while also being able to detect the features currently being used in the project. |
| 16 | + |
| 17 | +The :menu:`Project > Tools > Engine Compilation Configuration Editor` |
| 18 | +allows you to create and manage build profiles for your Godot project. |
| 19 | + |
| 20 | +From now on, you have two possibilities: |
| 21 | + |
| 22 | +- View the list and manually uncheck features that you don't need. |
| 23 | +- Use the :button:`Detect from Project` button to automatically detect features |
| 24 | + currently used in the project and disable unused features. Note that this will |
| 25 | + override the existing list of features, so if you have manually unchecked some |
| 26 | + items, their state will be reset based on whether the project actually |
| 27 | + uses the feature. |
| 28 | + |
| 29 | +.. figure:: img/engine_compilation_configuration_editor_detect.webp |
| 30 | + :align: center |
| 31 | + :alt: Opening the Engine Compilation Configuration Editor |
| 32 | + |
| 33 | + Opening the Engine Compilation Configuration Editor |
| 34 | + |
| 35 | +Once you click :button:`Detect from Project`, the project detection step will run. |
| 36 | +This can take from a few seconds up to several minutes depending on the project size. |
| 37 | +Once detection is complete, you'll see an updated list of features with some features disabled: |
| 38 | + |
| 39 | +.. figure:: img/engine_compilation_configuration_editor_detected.webp |
| 40 | + :align: center |
| 41 | + :alt: Updated features list after using feature detection (example from the 3D platformer demo) |
| 42 | + |
| 43 | + Updated features list after using feature detection (example from the 3D platformer demo) |
| 44 | + |
| 45 | +.. warning:: |
| 46 | + |
| 47 | + Unchecking features in this dialog will not reduce binary size directly on export. |
| 48 | + Since it is only possible to actually remove features from the binary at compile-time, |
| 49 | + you still need to compile custom export templates with the build profile specified |
| 50 | + to actually benefit from the engine compilation configuration editor. |
| 51 | + |
| 52 | +You can now save the build profile by clicking **Save As** at the top. |
| 53 | +The build profile can be saved in any location, but it's a good idea to |
| 54 | +save it somewhere in your project folder and add it to version control to be able |
| 55 | +to go back to it later when needed. This also allows using version control |
| 56 | +to track changes to the build profile. |
| 57 | + |
| 58 | +The build profile is a JSON file (and ``.gdbuild`` extension) that looks like this |
| 59 | +after detection in the above example: |
| 60 | + |
| 61 | +:: |
| 62 | + |
| 63 | + { |
| 64 | + "disabled_build_options": { |
| 65 | + "disable_navigation_3d": true, |
| 66 | + "disable_xr": true, |
| 67 | + "module_godot_physics_3d_enabled": false, |
| 68 | + "module_msdfgen_enabled": false, |
| 69 | + "module_openxr_enabled": false |
| 70 | + }, |
| 71 | + "disabled_classes": [ |
| 72 | + "AESContext", |
| 73 | + ... |
| 74 | + "ZIPReader" |
| 75 | + ], |
| 76 | + "type": "build_profile" |
| 77 | +} |
| 78 | + |
| 79 | +This file can be passed as a SCons option when :ref:`compiling <doc_compiling_index>` |
| 80 | +export templates: |
| 81 | + |
| 82 | +:: |
| 83 | + |
| 84 | + scons target=template_release build_profile=/path/to/build.gdbuild |
| 85 | + |
| 86 | +The buildsystem will use this to disable unused classes and reduce binary size as a result. |
| 87 | + |
| 88 | +Limitations |
| 89 | +----------- |
| 90 | + |
| 91 | +The :button:`Detect from Project` functionality relies on reading the project's scenes and scripts. |
| 92 | +It will not be able to detect used features in the following scenarios: |
| 93 | + |
| 94 | +- Features that are used in GDScripts that are procedurally created then run at runtime. |
| 95 | +- Features that are used in :ref:`expressions <doc_evaluating_expressions>`. |
| 96 | +- Features that are used in :ref:`GDExtensions <doc_gdextension>`. |
| 97 | +- Features that are used in :ref:`external PCKs loaded at runtime <doc_exporting_pcks>`. |
| 98 | +- Certain edge cases may exist. If unsure, please |
| 99 | + `open an issue on GitHub <https://github.com/godotengine/godot/issues>`__ |
| 100 | + with a minimal reproduction project attached. |
| 101 | + |
| 102 | +.. seealso:: |
| 103 | + |
| 104 | + You can achieve further size reductions by passing other options that reduce binary size. |
| 105 | + See :ref:`doc_optimizing_for_size` for more information. |
0 commit comments