Skip to content

Commit 447ab2d

Browse files
StefanStojanovicaduh95
authored andcommitted
build,win: fix VS2022 arm64 PGO build
Refs: #62761 Signed-off-by: StefanStojanovic <stefan.stojanovic@janeasystems.com> PR-URL: #63413 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
1 parent cfb80a2 commit 447ab2d

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

‎configure.py‎

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,18 +1959,29 @@ def configure_node(o):
19591959
msvc_dir=target_arch# 'x64' or 'arm64'
19601960

19611961
vc_tools_dir=os.environ.get('VCToolsInstallDir', '')
1962-
ifvc_tools_dir:
1963-
clang_profile_lib=os.path.join(vc_tools_dir, 'lib', msvc_dir, lib_name)
1964-
ifos.path.isfile(clang_profile_lib):
1965-
o['variables']['clang_profile_lib'] =clang_profile_lib
1966-
else:
1967-
raiseException(
1968-
f'PGO profile runtime library not found at {clang_profile_lib}. '
1969-
'Ensure the ClangCL toolset is installed.')
1970-
else:
1962+
ifnotvc_tools_dir:
19711963
raiseException(
19721964
'VCToolsInstallDir not set. Run from a Visual Studio command prompt.')
19731965

1966+
# Primary location: VS2026 and VS2022 x64
1967+
candidates= [os.path.join(vc_tools_dir, 'lib', msvc_dir, lib_name)]
1968+
1969+
# Secondary location: VS2022 arm64 fallback
1970+
clang_major=options.clang_cl.split('.', 1)[0]
1971+
candidates.append(os.path.normpath(os.path.join(
1972+
vc_tools_dir, '..', '..', 'Llvm', msvc_dir,
1973+
'lib', 'clang', clang_major, 'lib', 'windows', lib_name)))
1974+
1975+
clang_profile_lib=next(
1976+
(pforpincandidatesifos.path.isfile(p)), None)
1977+
ifclang_profile_lib:
1978+
o['variables']['clang_profile_lib'] =clang_profile_lib
1979+
else:
1980+
raiseException(
1981+
f'PGO profile runtime library {lib_name} not found. Searched:\n '+
1982+
'\n '.join(candidates) +
1983+
'\nEnsure the ClangCL toolset is installed.')
1984+
19741985
ifflavor!='win'andoptions.enable_thin_lto:
19751986
raiseException(
19761987
'Use --enable-lto instead.')

0 commit comments

Comments
 (0)