Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

为 Windows 平台编译

参见

这个页面描述的是如何从源码编译 Windows 编辑器和导出模板二进制文件。如果你要找的是导出项目到 Windows,请阅读 为 Windows 导出

需求

要在Windows下进行编译, 需要以下内容:

  • Visual Studio Community ,2017或更高版本. 建议使用VS 2019. 请务必阅读下面的 "安装Visual Studio注意事项", 否则你将不得不再次运行/下载安装程序.

  • MinGW-w64 with GCC can be used as an alternative to Visual Studio. Be sure to install/configure it to use the posix thread model. Important: When using MinGW to compile the master branch, you need GCC 9 or later.

  • Python 3.6+. Make sure to enable the option to add Python to the ``PATH`` in the installer.

  • SCons 3.0+ build system. Using the latest release is recommended, especially for proper support of recent Visual Studio releases.

备注

如果您已安装 Scoop,则可以使用以下命令轻松安装 MinGW 和其他依赖项:

scoop install gcc python scons make mingw

备注

如果你已经安装了 MSYS2,你可以使用以下命令轻松安装 MinGW 和其他依赖项:

pacman -S mingw-w64-x86_64-python3-pip mingw-w64-x86_64-gcc  \
    mingw-w64-i686-python3-pip mingw-w64-i686-gcc make

对于每个 MSYS2 MinGW 子系统,你应该在其 shell 中运行 pip3 install scons

参见

要获取编译所需的 Godot 源码,请参阅 获取源代码

有关 Godot 的 SCons 用法的一般概述,请参阅 构建系统介绍

设置 SCons

要安装 SCons,请打开命令提示符并运行以下命令:

python -m pip install scons

如果你看到提示信息 Defaulting to user installation because normal site-packages is not writeable,那么你就需要提升权限后再重新执行该命令。使用管理员身份打开一个新的命令提示符,然后再执行该命令,确保 SCons 可以通过 PATH 访问。

要检查是否已正确安装Python和SCons, 可以在