Sfoglia il codice sorgente

CI: Add MinGW/GCC build to Windows GHA

Thaddeus Crews 10 mesi fa
parent
commit
a44f691fc7

+ 21 - 6
.github/workflows/windows_builds.yml

@@ -30,7 +30,7 @@ jobs:
             # Skip debug symbols, they're way too big with MSVC.
             sconsflags: debug_symbols=no vsproj=yes vsproj_gen_only=no windows_subsystem=console
             bin: ./bin/godot.windows.editor.x86_64.exe
-            artifact: true
+            compiler: msvc
 
           - name: Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes)
             cache-name: windows-editor-clang
@@ -38,6 +38,7 @@ jobs:
             tests: true
             sconsflags: debug_symbols=no windows_subsystem=console use_llvm=yes
             bin: ./bin/godot.windows.editor.x86_64.llvm.exe
+            compiler: clang
 
           - name: Template (target=template_release, tests=yes)
             cache-name: windows-template
@@ -45,7 +46,16 @@ jobs:
             tests: true
             sconsflags: debug_symbols=no
             bin: ./bin/godot.windows.template_release.x86_64.console.exe
-            artifact: true
+            compiler: msvc
+
+          - name: Template w/ GCC (target=template_release, tests=yes, use_mingw=yes)
+            cache-name: windows-template-gcc
+            # MinGW takes MUCH longer to compile; save time by only targeting Template.
+            target: template_release
+            tests: true
+            sconsflags: debug_symbols=no use_mingw=yes
+            bin: ./bin/godot.windows.template_release.x86_64.console.exe
+            compiler: gcc
 
     steps:
       - name: Checkout
@@ -69,16 +79,21 @@ jobs:
         uses: dsaltares/[email protected]
         with:
           repo: godotengine/godot-angle-static
-          version: tags/chromium/6029
-          file: Windows.6029-1.MSVC_17.x86_64.x86_32.zip
+          version: tags/chromium/6601.2
+          file: godot-angle-static-x86_64-${{ matrix.compiler == 'gcc' && 'gcc' || 'msvc' }}-release.zip
           target: angle/angle.zip
 
       - name: Extract pre-built ANGLE static libraries
         run: Expand-Archive -Force angle/angle.zip ${{ github.workspace }}/
 
       - name: Setup MSVC problem matcher
+        if: matrix.compiler == 'msvc'
         uses: ammaraskar/msvc-problem-matcher@master
 
+      - name: Setup GCC problem matcher
+        if: matrix.compiler != 'msvc'
+        uses: ammaraskar/gcc-problem-matcher@master
+
       - name: Compilation
         uses: ./.github/actions/godot-build
         with:
@@ -94,12 +109,12 @@ jobs:
         continue-on-error: true
 
       - name: Prepare artifact
-        if: ${{ matrix.artifact }}
+        if: matrix.compiler == 'msvc'
         run: |
           Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force
 
       - name: Upload artifact
-        if: ${{ matrix.artifact }}
+        if: matrix.compiler == 'msvc'
         uses: ./.github/actions/upload-artifact
         with:
           name: ${{ matrix.cache-name }}

+ 6 - 0
drivers/d3d12/SCsub

@@ -4,6 +4,8 @@ from misc.utility.scons_hints import *
 import os
 from pathlib import Path
 
+import methods
+
 Import("env")
 
 env_d3d12_rdd = env.Clone()
@@ -139,6 +141,10 @@ else:
     extra_defines += [
         "HAVE_STRUCT_TIMESPEC",
     ]
+    if methods.using_gcc(env) and methods.get_compiler_version(env)["major"] < 13:
+        # `region` & `endregion` not recognized as valid pragmas.
+        env_d3d12_rdd.Append(CCFLAGS=["-Wno-unknown-pragmas"])
+        env.Append(CCFLAGS=["-Wno-unknown-pragmas"])
 
 # This is needed since rendering_device_d3d12.cpp needs to include some Mesa internals.
 env_d3d12_rdd.Prepend(CPPPATH=mesa_private_inc_paths)

+ 1 - 1
drivers/d3d12/dxil_hash.cpp

@@ -96,7 +96,7 @@ void compute_dxil_hash(const BYTE *pData, UINT byteCount, BYTE *pOutHash) {
 	UINT NextEndState = bTwoRowsPadding ? N - 2 : N - 1;
 	const BYTE *pCurrData = pData;
 	for (UINT i = 0; i < N; i++, offset += 64, pCurrData += 64) {
-		UINT x[16];
+		UINT x[16] = {};
 		const UINT *pX;
 		if (i == NextEndState) {
 			if (!bTwoRowsPadding && i == N - 1) {

+ 7 - 2
drivers/d3d12/rendering_device_driver_d3d12.cpp

@@ -1348,7 +1348,14 @@ RDD::TextureID RenderingDeviceDriverD3D12::texture_create(const TextureFormat &p
 	}
 	tex_info->states_ptr = &tex_info->owner_info.states;
 	tex_info->format = p_format.format;
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif
 	tex_info->desc = *(CD3DX12_RESOURCE_DESC *)&resource_desc;
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
 	tex_info->base_layer = 0;
 	tex_info->layers = resource_desc.ArraySize();
 	tex_info->base_mip = 0;
@@ -6578,8 +6585,6 @@ static Error create_command_signature(ID3D12Device *device, D3D12_INDIRECT_ARGUM
 
 Error RenderingDeviceDriverD3D12::_initialize_frames(uint32_t p_frame_count) {
 	Error err;
-	D3D12MA::ALLOCATION_DESC allocation_desc = {};
-	allocation_desc.HeapType = D3D12_HEAP_TYPE_DEFAULT;
 
 	//CD3DX12_RESOURCE_DESC resource_desc = CD3DX12_RESOURCE_DESC::Buffer(D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT);
 	uint32_t resource_descriptors_per_frame = GLOBAL_GET("rendering/rendering_device/d3d12/max_resource_descriptors_per_frame");

+ 4 - 3
platform/windows/detect.py

@@ -662,7 +662,7 @@ def get_ar_version(env):
         print_warning("Couldn't check version of `ar`.")
         return ret
 
-    match = re.search(r"GNU ar \(GNU Binutils\) (\d+)\.(\d+)(?:\.(\d+))?", output)
+    match = re.search(r"GNU ar(?: \(GNU Binutils\)| version) (\d+)\.(\d+)(?:\.(\d+))?", output)
     if match:
         ret["major"] = int(match[1])
         ret["minor"] = int(match[2])
@@ -788,8 +788,9 @@ def configure_mingw(env: "SConsEnvironment"):
         env["CXX"] = mingw_bin_prefix + "g++"
         if try_cmd("as --version", env["mingw_prefix"], env["arch"]):
             env["AS"] = mingw_bin_prefix + "as"
-        if try_cmd("gcc-ar --version", env["mingw_prefix"], env["arch"]):
-            env["AR"] = mingw_bin_prefix + "gcc-ar"
+        ar = "ar" if os.name == "nt" else "gcc-ar"
+        if try_cmd(f"{ar} --version", env["mingw_prefix"], env["arch"]):
+            env["AR"] = mingw_bin_prefix + ar
         if try_cmd("gcc-ranlib --version", env["mingw_prefix"], env["arch"]):
             env["RANLIB"] = mingw_bin_prefix + "gcc-ranlib"