浏览代码

Update "Compiling for Windows" page.

bruvzg 1 年之前
父节点
当前提交
cbc0dda137

+ 57 - 19
contributing/development/compiling/compiling_for_windows.rst

@@ -20,9 +20,14 @@ For compiling under Windows, the following is required:
   **Make sure to enable C++ in the list of workflows to install.**
   If you've already installed Visual Studio without C++ support, run the installer
   again; it should present you a **Modify** button.
+  Supports ``x86_64``, ``x86_32``, and ``arm64``.
 - `MinGW-w64 <https://mingw-w64.org/>`_ 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.
+  Supports ``x86_64`` and ``x86_32`` only.
+- `MinGW-LLVM <https://github.com/mstorsjo/llvm-mingw/releases>`_ with clang can be used as
+  an alternative to Visual Studio and MinGW-w64.
+  Supports ``x86_64``, ``x86_32``, and ``arm64``.
 - `Python 3.6+ <https://www.python.org/downloads/windows/>`_.
   **Make sure to enable the option to add Python to the ``PATH`` in the installer.**
 - `SCons 3.1.2+ <https://scons.org/pages/download.html>`_ build system. Using the
@@ -106,9 +111,10 @@ Selecting a compiler
 SCons will automatically find and use an existing Visual Studio installation.
 If you do not have Visual Studio installed, it will attempt to use
 MinGW instead. If you already have Visual Studio installed and want to
-use MinGW, pass ``use_mingw=yes`` to the SCons command line. Note that MSVC
+use MinGW-w64, pass ``use_mingw=yes`` to the SCons command line. Note that MSVC
 builds cannot be performed from the MSYS2 or MinGW shells. Use either
-``cmd.exe`` or PowerShell instead.
+``cmd.exe`` or PowerShell instead. If you are using MinGW-LLVM, pass both
+``use_mingw=yes`` and ``use_llvm=yes`` to the SCons command line.
 
 .. tip::
 
@@ -140,8 +146,8 @@ the engine source code (using ``cd``) and type:
 If all goes well, the resulting binary executable will be placed in
 ``C:\godot\bin\`` with the name ``godot.windows.editor.x86_32.exe`` or
 ``godot.windows.editor.x86_64.exe``. By default, SCons will build a binary matching
-your CPU architecture, but this can be overridden using ``arch=x86_64`` or
-``arch=x86_32``.
+your CPU architecture, but this can be overridden using ``arch=x86_64``,
+``arch=x86_32``, or ``arch=arm64``.
 
 This executable file contains the whole engine and runs without any
 dependencies. Running it will bring up the Project Manager.
@@ -151,10 +157,10 @@ dependencies. Running it will bring up the Project Manager.
          SCons option ``production=yes``. This enables additional compiler
          optimizations and link-time optimization.
 
-         LTO takes some time to run and requires about 7 GB of available RAM
-         while compiling. If you're running out of memory with the above option,
-         use ``production=yes lto=none`` or ``production=yes lto=thin`` for a
-         lightweight but less effective form of LTO.
+         LTO takes some time to run and requires up to 30 GB of available RAM
+         while compiling (depending on toolchain). If you're running out of memory
+         with the above option, use ``production=yes lto=none`` or ``production=yes lto=thin``
+         (LLVM only) for a lightweight but less effective form of LTO.
 
 .. note:: If you want to use separate editor settings for your own Godot builds
           and official releases, you can enable
@@ -187,11 +193,18 @@ To compile Godot with Direct3D 12 support you need at least the following item:
               ./update_mesa.sh
               scons
 
-             If you are building with MinGW, add ``use_mingw=yes`` to the ``scons``
+             If you are building with MinGW-w64, add ``use_mingw=yes`` to the ``scons``
              command, you can also specify build architecture using ``arch={architecture}``.
+             If you are building with MinGW-LLVM, add both ``use_mingw=yes`` and
+             ``use_llvm=yes`` to the ``scons`` command.
 
-             Mesa static library should be built using the same compiler you are
-             using for building Godot.
+             If you are building with MinGW and the binaries are not located in
+             the ``PATH``, add ``mingw_prefix="/path/to/mingw"`` to the ``scons``
+             command.
+
+             Mesa static library should be built using the same compiler and the
+             same CRT (if you are building with MinGW) you are using for building
+             Godot.
 
 Optionally, you can compile with the following for additional features:
 
@@ -271,13 +284,22 @@ To compile Godot with statically linked ANGLE:
              directory and navigate to it.
           2. Run the following command::
 
+              git submodule update --init
+              ./update_angle.sh
               scons
 
              If you are buildng with MinGW, add ``use_mingw=yes`` to the command,
              you can also specify build architecture using ``arch={architecture}``.
+             If you are building with MinGW-LLVM, add both ``use_mingw=yes`` and
+             ``use_llvm=yes`` to the ``scons`` command.
+
+             If you are building with MinGW and the binaries are not located in
+             the ``PATH``, add ``mingw_prefix="/path/to/mingw"`` to the ``scons``
+             command.
 
-             ANGLE static library should be built using the same compiler you are
-             using for building Godot.
+             ANGLE static library should be built using the same compiler and the
+             same CRT (if you are building with MinGW) you are using for building
+             Godot.
 
 Development in Visual Studio
 ----------------------------
@@ -304,8 +326,9 @@ Cross-compiling for Windows from other operating systems
 
 If you are a Linux or macOS user, you need to install
 `MinGW-w64 <https://www.mingw-w64.org/>`__, which typically comes in 32-bit
-and 64-bit variants. The package names may differ based on your distribution,
-here are some known ones:
+and 64-bit variants, or `MinGW-LLVM <https://github.com/mstorsjo/llvm-mingw/releases>`_,
+which comes as a single archive for all target architectures.
+The package names may differ based on your distribution, here are some known ones:
 
 +----------------+--------------------------------------------------------------+
 | **Arch Linux** | ::                                                           |
@@ -334,9 +357,15 @@ here are some known ones:
 Before attempting the compilation, SCons will check for
 the following binaries in your ``PATH`` environment variable::
 
+    # for MinGW-w64
     i686-w64-mingw32-gcc
     x86_64-w64-mingw32-gcc
 
+    # for MinGW-LLVM
+    aarch64-w64-mingw32-clang
+    i686-w64-mingw32-clang
+    x86_64-w64-mingw32-clang
+
 If the binaries are not located in the ``PATH`` (e.g. ``/usr/bin``),
 you can define the following environment variable to give a hint to
 the build system::
@@ -354,10 +383,11 @@ differ based on your system)::
     ${MINGW_PREFIX}/bin/x86_64-w64-mingw32-gcc --version
     # x86_64-w64-mingw32-gcc (GCC) 13.2.0
 
+.. note:: If you are building with MinGW-LLVM, add ``use_llvm=yes`` to the ``scons`` command.
 .. note:: When cross-compiling for Windows using MinGW-w64, keep in mind only
-          ``x86_64`` and ``x86_32`` architectures are supported. Be sure to
-          specify the right ``arch=`` option when invoking SCons if building
-          from a different architecture.
+          ``x86_64`` and ``x86_32`` architectures are supported. MinGW-LLVM supports
+          ``arm64`` as well. Be sure to specify the right ``arch=`` option when
+          invoking SCons if building from a different architecture.
 
 Troubleshooting
 ~~~~~~~~~~~~~~~
@@ -393,6 +423,8 @@ with the following flags:
     C:\godot> scons platform=windows target=template_release arch=x86_32
     C:\godot> scons platform=windows target=template_debug arch=x86_64
     C:\godot> scons platform=windows target=template_release arch=x86_64
+    C:\godot> scons platform=windows target=template_debug arch=arm64
+    C:\godot> scons platform=windows target=template_release arch=arm64
 
 If you plan on replacing the standard export templates, copy these to the
 following location, replacing ``<version>`` with the version identifier
@@ -408,16 +440,22 @@ With the following names::
     windows_debug_x86_32.exe
     windows_debug_x86_64_console.exe
     windows_debug_x86_64.exe
+    windows_debug_arm64_console.exe
+    windows_debug_arm64.exe
     windows_release_x86_32_console.exe
     windows_release_x86_32.exe
     windows_release_x86_64_console.exe
     windows_release_x86_64.exe
+    windows_release_arm64_console.exe
+    windows_release_arm64.exe
 
 However, if you are using custom modules or custom engine code, you
 may instead want to configure your binaries as custom export templates
 here:
 
-.. image:: img/wintemplates.png
+.. image:: img/wintemplates.webp
+
+Select matching architecture in the export config.
 
 You don't need to copy them in this case, just reference the resulting
 files in the ``bin\`` directory of your Godot source folder, so the next

二进制
contributing/development/compiling/img/wintemplates.png


二进制
contributing/development/compiling/img/wintemplates.webp