Files
MINGW-packages/mingw-w64-angleproject/002-buildflags-fixes.patch
Raed Rizqie b1e6a41c9d angleproject: update to 2.1.r25748.890b5d8f (#24941)
- rebase most patches
- enable d3d11 compositor
- enable swiftshader on mingw64 and ucrt64
2025-07-25 04:18:46 +00:00

300 lines
9.1 KiB
Diff

diff --git a/.gn b/.gn
index dc3df25a1b..7fc44a7337 100644
--- a/.gn
+++ b/.gn
@@ -26,15 +26,6 @@ script_executable = "python3"
# These are the list of GN files that run exec_script. This allowlist exists
# to force additional review for new uses of exec_script, which is strongly
# discouraged except for gypi_to_gn calls.
-exec_script_allowlist = angle_dotfile_settings.exec_script_allowlist +
- build_dotfile_settings.exec_script_allowlist +
- [
- "//build/config/sysroot.gni",
- "//build/config/win/BUILD.gn",
- "//build/config/win/visual_studio_version.gni",
- "//build/gn_helpers.py",
- "//build_overrides/build.gni",
- ]
default_args = {
clang_use_chrome_plugins = false
diff --git a/BUILD.gn b/BUILD.gn
index 957af7e194..1935b75749 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -18,7 +18,10 @@ if (angle_has_build) {
import("//build/config/linux/pkg_config.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
- import("//testing/libfuzzer/fuzzer_test.gni")
+
+ if (use_fuzzing_engine) {
+ import("//testing/libfuzzer/fuzzer_test.gni")
+ }
if (is_android) {
# android/rules.gni can only be imported for Android targets
@@ -108,10 +111,11 @@ if (angle_build_all) {
":angle",
":angle_shader_translator",
":translator_fuzzer",
- ":xxhash_fuzzer",
"$angle_root/samples:angle_samples",
- "$angle_root/src/tests:angle_tests",
]
+ if (use_fuzzing_engine) {
+ deps += [ ":xxhash_fuzzer" ]
+ }
if (angle_enable_cl) {
deps += [ "$angle_root/src/libOpenCL:angle_cl" ]
}
@@ -339,7 +343,7 @@ config("extra_warnings") {
}
# Enable more default warnings on Windows.
- if (is_win) {
+ if (is_msvc) {
cflags += [
"/we4244", # Conversion: possible loss of data.
"/we4312", # Conversion: greater size.
@@ -381,6 +385,17 @@ config("extra_warnings") {
]
}
+ if (is_mingw && !is_clang) {
+ cflags_cc = [
+ "-Wno-conversion-null",
+ "-Wno-dangling-pointer",
+ "-Wno-deprecated-copy",
+ "-Wno-sign-compare",
+ "-Wno-stringop-truncation",
+ "-Wno-unused-function",
+ ]
+ }
+
if (is_gcc) {
cflags_cc = [ "-Wdeprecated-copy" ]
}
@@ -402,7 +417,7 @@ config("build_id_config") {
ldflags = [ "-Wl,--build-id" ]
}
-_use_copy_compiler_dll = angle_has_build && is_win
+_use_copy_compiler_dll = angle_has_build && is_msvc
if (_use_copy_compiler_dll) {
copy("copy_compiler_dll") {
@@ -487,7 +502,7 @@ config("angle_common_config") {
if (is_win && !angle_is_winuwp && !build_with_chromium) {
# Needed for futex support
- libs += [ "synchronization.lib" ]
+ libs += [ "synchronization" ]
}
defines = []
@@ -517,7 +532,7 @@ angle_source_set("xxhash") {
}
}
-if (angle_has_build) {
+if (angle_has_build && use_fuzzing_engine) {
fuzzer_test("xxhash_fuzzer") {
sources = [ "src/common/third_party/xxhash/xxhash_fuzzer.cpp" ]
deps = [ ":xxhash" ]
@@ -682,9 +697,9 @@ angle_static_library("angle_gpu_info_util") {
if (is_win) {
sources += libangle_gpu_info_util_win_sources
if (!angle_is_winuwp) {
- libs += [ "setupapi.lib" ]
+ libs += [ "setupapi" ]
}
- libs += [ "dxgi.lib" ]
+ libs += [ "dxgi" ]
}
if (is_linux || is_chromeos) {
@@ -827,7 +842,7 @@ angle_static_library("translator") {
":angle_version_info",
]
- if (is_win) {
+ if (is_msvc) {
# Necessary to suppress some system header xtree warnings in Release.
# For some reason this warning doesn't get triggered in Chromium
cflags = [ "/wd4718" ]
@@ -986,7 +1001,7 @@ config("libANGLE_config") {
ldflags = []
defines += [ "LIBANGLE_IMPLEMENTATION" ]
- if (is_win) {
+ if (is_msvc) {
cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics
# are not enabled.
}
@@ -1087,8 +1102,8 @@ angle_source_set("libANGLE_no_vulkan") {
if (is_win && !angle_is_winuwp) {
libs += [
- "gdi32.lib",
- "user32.lib",
+ "gdi32",
+ "user32",
]
}
@@ -1117,7 +1132,7 @@ angle_source_set("libANGLE_no_vulkan") {
}
if (angle_enable_d3d11) {
- libs += [ "dxguid.lib" ]
+ libs += [ "dxguid" ]
}
if (angle_enable_metal) {
@@ -1129,7 +1144,7 @@ angle_source_set("libANGLE_no_vulkan") {
}
# Enable extra Chromium style warnings for libANGLE.
- if (is_clang && angle_has_build && !is_nacl) {
+ if (is_clang && angle_has_build && !is_nacl && !is_mingw) {
suppressed_configs -= [ "//build/config/clang:find_bad_constructs" ]
}
@@ -1467,11 +1482,14 @@ angle_static_library("libGLESv2_thin_static") {
public_configs += [ ":angle_static_config" ]
deps = [ ":includes" ]
+ output_name = "libGLESv2_thin"
public_deps = [ ":libANGLE" ]
}
angle_static_library("libGLESv2_static") {
sources = libglesv2_sources
+ complete_static_lib = true
+ output_name = "libGLESv2"
public_deps = [ ":libGLESv2_thin_static" ]
}
@@ -1588,6 +1606,7 @@ if (angle_enable_vulkan) {
}
libEGL_template("libEGL_static") {
+ output_name = "libEGL"
target_type = "angle_static_library"
public_configs = [ ":angle_static_config" ]
deps = [ ":libGLESv2_static" ]
diff --git a/gni/angle.gni b/gni/angle.gni
index bdefa2e04c..2d87b3927b 100644
--- a/gni/angle.gni
+++ b/gni/angle.gni
@@ -53,7 +53,6 @@ if (angle_has_build) {
import("//build/config/ozone.gni") # import the ozone_platform_x11 variable
import("//build/config/sanitizers/sanitizers.gni")
import("//build_overrides/build.gni")
- import("//testing/test.gni")
if (is_android) {
import("//build/config/android/config.gni")
}
@@ -153,7 +152,7 @@ declare_args() {
# Windows App SDK is almost UWP but for Win32, so we want all the same things
angle_is_winuwp = (is_win && target_os == "winuwp") || angle_is_winappsdk
- angle_is_msvc = is_win && !is_clang
+ angle_is_msvc = is_win && !is_clang && !is_mingw
# Default to using "_angle" suffix on Android
if (is_android) {
@@ -212,13 +211,13 @@ declare_args() {
# anglebug.com/42266968
angle_enable_wgpu =
!is_official_build && !(is_android || is_fuchsia || angle_is_winuwp) &&
- (!is_win || is_clang) && (!is_linux || angle_use_x11) &&
+ (!is_win || is_clang) && (!is_linux || angle_use_x11) && !is_mingw &&
defined(angle_dawn_dir)
}
declare_args() {
# ASTC emulation is only built on standalone non-android builds
- angle_has_astc_encoder = angle_has_build && angle_standalone && !is_android
+ angle_has_astc_encoder = angle_has_build && angle_standalone && !is_android && !is_mingw
}
declare_args() {
@@ -350,7 +349,7 @@ angle_remove_configs = []
if (angle_has_build) {
angle_remove_configs += [ "//build/config/compiler:default_include_dirs" ]
- if (is_clang && !is_nacl) {
+ if (is_clang && !is_nacl && !is_mingw) {
angle_remove_configs += [ "//build/config/clang:find_bad_constructs" ]
}
diff --git a/src/libANGLE/renderer/d3d/BUILD.gn b/src/libANGLE/renderer/d3d/BUILD.gn
index 55227c34b3..a1a027773c 100644
--- a/src/libANGLE/renderer/d3d/BUILD.gn
+++ b/src/libANGLE/renderer/d3d/BUILD.gn
@@ -27,14 +27,16 @@ angle_source_set("angle_d3d_shared") {
if (angle_enable_d3d9) {
config("angle_d3d9_backend_config") {
defines = [ "ANGLE_ENABLE_D3D9" ]
- ldflags = [ "/DELAYLOAD:d3d9.dll" ]
+ if (is_msvc) {
+ ldflags = [ "/DELAYLOAD:d3d9.dll" ]
+ }
}
angle_source_set("angle_d3d9_backend") {
sources = d3d9_backend_sources
libs = [
- "d3d9.lib",
- "delayimp.lib",
+ "d3d9",
+ "delayimp",
]
public_deps = [ ":angle_d3d_shared" ]
public_configs = [ ":angle_d3d9_backend_config" ]
@@ -52,7 +54,7 @@ if (angle_enable_d3d11) {
angle_source_set("angle_d3d11_backend") {
sources = d3d11_backend_sources
- libs = [ "dxguid.lib" ]
+ libs = [ "dxguid" ]
public_deps = [ ":angle_d3d_shared" ]
public_configs = [ ":angle_d3d11_backend_config" ]
diff --git a/src/tests/BUILD.gn b/src/tests/BUILD.gn
index c0dc92ae34..d10eceb320 100644
--- a/src/tests/BUILD.gn
+++ b/src/tests/BUILD.gn
@@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import("//testing/test.gni")
import("../../gni/angle.gni")
import("angle_unittests.gni")
diff --git a/util/BUILD.gn b/util/BUILD.gn
index 6cff850678..ff8e74551d 100644
--- a/util/BUILD.gn
+++ b/util/BUILD.gn
@@ -396,7 +396,7 @@ foreach(is_shared_library,
}
}
-if (is_win && !angle_is_winuwp) {
+if (is_msvc && !angle_is_winuwp) {
angle_source_set("angle_stack_walker") {
sources = [
"windows/third_party/StackWalker/src/StackWalker.cpp",
@@ -452,7 +452,7 @@ angle_source_set("angle_test_utils") {
sources += [ "windows/test_utils_win.cpp" ]
if (angle_is_winuwp) {
sources += [ "windows/test_utils_winuwp.cpp" ]
- } else {
+ } else if (is_msvc) {
deps += [ ":angle_stack_walker" ]
sources += [ "windows/win32/test_utils_win32.cpp" ]
}