using_engine_compilation_configuration_editor.rst 4.6 KB

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