exporting_for_windows.rst 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. .. _doc_exporting_for_windows:
  2. Exporting for Windows
  3. =====================
  4. .. seealso::
  5. This page describes how to export a Godot project to Windows.
  6. If you're looking to compile editor or export template binaries from source instead,
  7. read :ref:`doc_compiling_for_windows`.
  8. The simplest way to distribute a game for PC is to copy the executable
  9. (``godot.exe``), compress the folder and send it to someone else. However, this
  10. is often not desired.
  11. Godot offers a more elegant approach for PC distribution when using the export
  12. system. When exporting for Windows, the exporter takes all the project files and
  13. creates a ``data.pck`` file. This file is bundled with a specially optimized
  14. binary that is smaller, faster and does not contain the editor and debugger.
  15. Changing the executable icon
  16. ----------------------------
  17. Godot will automatically use whatever image is set as your project's icon in the project
  18. settings, and convert it to an ICO file for the exported project. If you want to
  19. manually create an ICO file for greater control over how the icon looks at different
  20. resolutions then see the :ref:`doc_changing_application_icon_for_windows` page.
  21. Code signing
  22. ------------
  23. Godot is capable of automatic code signing on export. To do this you must have the
  24. ``Windows SDK`` (on Windows) or `osslsigncode <https://github.com/mtrojnar/osslsigncode>`__
  25. (on any other OS) installed. You will also need a package signing certificate,
  26. information on creating one can be found `here <https://learn.microsoft.com/en-us/windows/msix/package/create-certificate-package-signing>`__.
  27. .. warning::
  28. If you export for Windows with embedded PCK files, you will not be able to
  29. sign the program as it will break.
  30. On Windows, PCK embedding is also known to cause false positives in
  31. antivirus programs. Therefore, it's recommended to avoid using it unless
  32. you're distributing your project via Steam as it bypasses code signing and
  33. antivirus checks.
  34. Setup
  35. ~~~~~
  36. Settings need to be changed in two places. First, in the editor settings, under
  37. **Export > Windows**. Click on the folder next to the ``Sign Tool`` setting, if
  38. you're using Windows navigate to and select ``SignTool.exe``, if you're on a different
  39. OS select ``osslsigncode``.
  40. .. image:: img/windows_editor_settings.webp
  41. The second location is the Windows export preset, which can be found in
  42. **Project > Export...**. Add a windows desktop preset if you haven't already.
  43. Under options there is a code signing category.
  44. .. image:: img/windows_export_codesign.webp
  45. ``Enabled`` must be set to true, and ``Identity`` must be set to the signing
  46. certificate. The other settings can be adjusted as needed. Once this is Done
  47. Godot will sign your project on export.
  48. Environment variables
  49. ---------------------
  50. You can use the following environment variables to set export options outside of
  51. the editor. During the export process, these override the values that you set in
  52. the export menu.
  53. .. list-table:: Windows export environment variables
  54. :header-rows: 1
  55. * - Export option
  56. - Environment variable
  57. * - Encryption / Encryption Key
  58. - ``GODOT_SCRIPT_ENCRYPTION_KEY``
  59. * - Options / Codesign / Identity Type
  60. - ``GODOT_WINDOWS_CODESIGN_IDENTITY_TYPE``
  61. * - Options / Codesign / Identity
  62. - ``GODOT_WINDOWS_CODESIGN_IDENTITY``
  63. * - Options / Codesign / Password
  64. - ``GODOT_WINDOWS_CODESIGN_PASSWORD``
  65. Export options
  66. --------------
  67. You can find a full list of export options available in the
  68. :ref:`class_EditorExportPlatformWindows` class reference.