cpu_features icon indicating copy to clipboard operation
cpu_features copied to clipboard

Add Arm64 Windows CI support, CMake

Open toor1245 opened this issue 7 months ago • 2 comments

Github actions added support Windows Arm64 for public repositories with runner name windows-11-arm:

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 LINE features 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"

toor1245 avatar May 17 '25 10:05 toor1245

@gchatelet, @Mizux, PR is ready to review

toor1245 avatar May 17 '25 10:05 toor1245

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

Mizux avatar May 19 '25 08:05 Mizux