From bbafe14970cf2a101b8b04dbfafeeaa9ddfb5d4d Mon Sep 17 00:00:00 2001 From: "ocean (they/them)" Date: Tue, 29 Aug 2023 17:56:25 -0400 Subject: [PATCH] Build system: add option for MSVC incremental linking. --- methods.py | 3 +++ platform/windows/detect.py | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/methods.py b/methods.py index 7c1781d699d8..97e9026fea84 100644 --- a/methods.py +++ b/methods.py @@ -874,6 +874,9 @@ def build_commandline(self, commands): if env["precision"] == "double": common_build_postfix.append("precision=double") + if env["incremental_link"]: + common_build_postfix.append("incremental_link=yes") + result = " ^& ".join(common_build_prefix + [" ".join([commands] + common_build_postfix)]) return result diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 9548939695a4..6e56f2a5257a 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -185,6 +185,7 @@ def get_opts(): BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True), BoolVariable("use_asan", "Use address sanitizer (ASAN)", False), BoolVariable("debug_crt", "Compile with MSVC's debug CRT (/MDd)", False), + BoolVariable("incremental_link", "Use MSVC incremental linking. May increase or decrease build times.", False), ] @@ -355,8 +356,9 @@ def configure_msvc(env, vcvars_msvc_config): else: env.AppendUnique(CCFLAGS=["/MD"]) - # MSVC incremental linking is broken and _increases_ link time (GH-77968). - env.Append(LINKFLAGS=["/INCREMENTAL:NO"]) + # MSVC incremental linking is broken and may _increase_ link time (GH-77968). + if not env["incremental_link"]: + env.Append(LINKFLAGS=["/INCREMENTAL:NO"]) if env["arch"] == "x86_32": env["x86_libtheora_opt_vc"] = True