Build benchmarks for ARM64EC pipeline #5517
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #5492, I did not build the benchmarks because I didn't know how to get google-benchmark built for ARM64EC. Now I seem to find the solution.
To create static libraries for ARM64EC, the
/machine:arm64ecoption needs to be passed tolib.exe. CMake doc mentions that theSTATIC_LIBRARY_OPTIONStarget property holds the options forlib.exe. This meansbenchmarks/CMakeLists.txtneeds to set this property for each relevant target, including those defined by google-benchmark. But it turns out thatCMAKE_STATIC_LINKER_FLAGSwill also be passed tolib.exe.Setting
CMAKE_STATIC_LINKER_FLAGSis simpler, and it affects every target, including those added in the future (either by us or by google-benchmark), which is desirable in this specific case. So this PR chooses to setCMAKE_STATIC_LINKER_FLAGS.(Note: it seems that
CMAKE_STATIC_LINKER_FLAGSdefaults to/machine:arm64, so I decided to override it instead of appending/machine:arm64ecto it, but appending might be more future-proof.)(Note 2: just in case you are interested:
stl/CMakeLists.txthandles this by adding${VCLIBS_EXPLICIT_MACHINE}to theSTATIC_LIBRARY_OPTIONStarget property for every relevant target, where${VCLIBS_EXPLICIT_MACHINE}is/machine:arm64ecfor ARM64EC and empty otherwise.)