Add Arm64 Windows CI support, CMake
Github actions added support Windows Arm64 for public repositories with runner name windows-11-arm:
- Windows arm64 hosted runners now available in public preview
- Windows 11 by Arm Limited installed packages
Cmake has known issue related to build for Windows Arm64. CMAKE_SYSTEM_PROCESSOR on Arm64 target shows AMD64...
- https://github.com/toor1245/cpu_features/actions/runs/15084083163/job/42404469826#step:3:14
Issue discussion:
- https://gitlab.kitware.com/cmake/cmake/-/issues/15170
- https://gitlab.kitware.com/cmake/cmake/-/issues/25466
So CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID must be used to set PROCESSOR_IS_AARCH64 architecture:
- https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_PROCESSOR.html
- https://cmake.org/cmake/help/v3.16/variable/CMAKE_LANG_COMPILER_ARCHITECTURE_ID.html
Also, currently we have build fail for windows Arm64, I think it should be fixed as separate patch:
- One of the solution is to add check - https://github.com/google/cpu_features/pull/353
- Another way is just copy
LINEfeatures from src/impl_aarch64__base_implementation.inl#L31 - just to remind the root cause maybe we will find universal solution, https://github.com/google/cpu_features/pull/291 :
We can't use "define_introspection_and_hwcaps.inl" as a common file for all operating systems due to msvc compiler error C2099: initializer is not a constant, so as a workaround for Windows I used separate "define_introspection.inl"
@gchatelet, @Mizux, PR is ready to review
I think on windows most features flag are not populated.... Maybe this test will also need a #ifndef windows... https://github.com/google/cpu_features/blob/d3b2440fcfc25fe8e6d0d4a85f06d68e98312f5b/test/cpuinfo_aarch64_test.cc#L126-L137
cf: https://github.com/google/cpu_features/blob/d3b2440fcfc25fe8e6d0d4a85f06d68e98312f5b/src/impl_aarch64_linux_or_android.c#L67 vs https://github.com/google/cpu_features/blob/main/src/impl_aarch64_windows.c