From 34bd25bacb9dca108a3feadd408ba166969abe43 Mon Sep 17 00:00:00 2001 From: Nicolas Capens Date: Fri, 31 May 2024 10:39:12 -0400 Subject: [PATCH] Ensure --msvc_path and --sdk_path are used together Changing to a non-default MSVC version (as determined by vswhere) requires providing both the path to the compiler and the path to the Windows SDK. --- build_lib.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build_lib.py b/build_lib.py index 7a33bd8b0..96e8725d8 100644 --- a/build_lib.py +++ b/build_lib.py @@ -124,8 +124,10 @@ def find_cuda_sdk(): # setup MSVC and WinSDK paths if os.name == "nt": - if args.sdk_path and args.msvc_path: - # user provided MSVC + if args.msvc_path or args.sdk_path: + # user provided MSVC and Windows SDK + assert args.msvc_path and args.sdk_path, "--msvc_path and --sdk_path must be used together." + args.host_compiler = set_msvc_env(msvc_path=args.msvc_path, sdk_path=args.sdk_path) else: # attempt to find MSVC in environment (will set vcvars)