@@ -1965,18 +1965,29 @@ def configure_node(o):
19651965 msvc_dir = target_arch # 'x64' or 'arm64'
19661966
19671967 vc_tools_dir = os .environ .get ('VCToolsInstallDir' , '' )
1968- if vc_tools_dir :
1969- clang_profile_lib = os .path .join (vc_tools_dir , 'lib' , msvc_dir , lib_name )
1970- if os .path .isfile (clang_profile_lib ):
1971- o ['variables' ]['clang_profile_lib' ] = clang_profile_lib
1972- else :
1973- raise Exception (
1974- f'PGO profile runtime library not found at { clang_profile_lib } . '
1975- 'Ensure the ClangCL toolset is installed.' )
1976- else :
1968+ if not vc_tools_dir :
19771969 raise Exception (
19781970 'VCToolsInstallDir not set. Run from a Visual Studio command prompt.' )
19791971
1972+ # Primary location: VS2026 and VS2022 x64
1973+ candidates = [os .path .join (vc_tools_dir , 'lib' , msvc_dir , lib_name )]
1974+
1975+ # Secondary location: VS2022 arm64 fallback
1976+ clang_major = options .clang_cl .split ('.' , 1 )[0 ]
1977+ candidates .append (os .path .normpath (os .path .join (
1978+ vc_tools_dir , '..' , '..' , 'Llvm' , msvc_dir ,
1979+ 'lib' , 'clang' , clang_major , 'lib' , 'windows' , lib_name )))
1980+
1981+ clang_profile_lib = next (
1982+ (p for p in candidates if os .path .isfile (p )), None )
1983+ if clang_profile_lib :
1984+ o ['variables' ]['clang_profile_lib' ] = clang_profile_lib
1985+ else :
1986+ raise Exception (
1987+ f'PGO profile runtime library { lib_name } not found. Searched:\n ' +
1988+ '\n ' .join (candidates ) +
1989+ '\n Ensure the ClangCL toolset is installed.' )
1990+
19801991 if flavor != 'win' and options .enable_thin_lto :
19811992 raise Exception (
19821993 'Use --enable-lto instead.' )
0 commit comments