exporting_for_windows.rst 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. Code signing
  16. ------------
  17. Godot is capable of automatic code signing on export. To do this you must have the
  18. ``Windows SDK`` (on Windows) or `osslsigncode <https://github.com/mtrojnar/osslsigncode>`__
  19. (on any other OS) installed. You will also need a package signing certificate,
  20. information on creating one can be found `here <https://learn.microsoft.com/en-us/windows/msix/package/create-certificate-package-signing>`__.
  21. .. warning::
  22. If you export for Windows with embedded PCK files, you will not be able to
  23. sign the program as it will break.
  24. On Windows, PCK embedding is also known to cause false positives in
  25. antivirus programs. Therefore, it's recommended to avoid using it unless
  26. you're distributing your project via Steam as it bypasses code signing and
  27. antivirus checks.
  28. Setup
  29. ~~~~~
  30. Settings need to be changed in two places. First, in the editor settings, under
  31. **Export > Windows**. Click on the folder next to the ``Sign Tool`` setting, if
  32. you're using Windows navigate to and select ``SignTool.exe``, if you're on a different
  33. OS select ``osslsigncode``.
  34. .. image:: img/windows_editor_settings.webp
  35. The second location is the Windows export preset, which can be found in
  36. **Project > Export...**. Add a windows desktop preset if you haven't already.
  37. Under options there is a code signing category.
  38. .. image:: img/windows_export_codesign.webp
  39. ``Enabled`` must be set to true, and ``Identity`` must be set to the signing
  40. certificate. The other settings can be adjusted as needed. Once this is Done
  41. Godot will sign your project on export.
  42. Environment variables
  43. ---------------------
  44. You can use the following environment variables to set export options outside of
  45. the editor. During the export process, these override the values that you set in
  46. the export menu.
  47. .. list-table:: Windows export environment variables
  48. :header-rows: 1
  49. * - Export option
  50. - Environment variable
  51. * - Encryption / Encryption Key
  52. - ``GODOT_SCRIPT_ENCRYPTION_KEY``
  53. * - Options / Codesign / Identity Type
  54. - ``GODOT_WINDOWS_CODESIGN_IDENTITY_TYPE``
  55. * - Options / Codesign / Identity
  56. - ``GODOT_WINDOWS_CODESIGN_IDENTITY``
  57. * - Options / Codesign / Password
  58. - ``GODOT_WINDOWS_CODESIGN_PASSWORD``