CMake

CMake is a widely used open-source, cross-platform family of tools designed to build, test, and package software.

Project homepage: https://cmake.org/

Source code: https://gitlab.kitware.com/cmake/cmake

Status

  • Native CMake support for windows on arm has been completed and official installers are available now from official CMake download pages https://cmake.org/download/

  • Emulated CMake can be used successfully but is no longer required as native CMake support is available.

Getting CMake on win-arm64

Native

Official Installers

Build from source

x86 or x64 emulated

 

- Windows i386 (Win 10) or Windows x86_64 (Win 11)

Python package

 

Build from source

OpenSSL:

cmake . -DCMAKE_INSTALL_PREFIX=<install dir path> -DCMAKE_BUILD_TYPE=Release -A ARM64 cmake --build . cmake --install .

I needed to create release build, because of the debug DLL issue:

Note: Please check out a commit with

Python distribution

CMake (and Ninja) is distributed via Python wheels also. These distributions are replacement installation of the host projects, using Python’s distribution system.

In other words, if you are able to install them with pip, you’ll be fine and shouldn’t worry about downloading binaries and setting environment variables.

This project provides a setup.py script that build CMake Python wheels.

PyPi release:

Github source:

It relies on scikit-build and not setuptools.

sci-kit build win-arm64 support was released in 0.13.0:

The Python distribution tries to download the corresponding release binary of CMake for the given platform, but for win-arm64 there aren’t any. The fallback could be to build CMake from source, but it requires OpenSSL, what is also not yet released for win-arm64. Moreover building native CMake with ported local OpenSSL doesn’t pass all the tests of CMake.

So the current solution is to wrap the x86 emulated CMake as it works on every WoA machine as expected.

As soon as this patch will be included by a following release, this should get x86 emulated CMake:

pip install cmake

As soon as official native win-arm64 CMake is released, this should be updated to deploy that binary.

Build native win-arm64 CMake via Python distribution

If you still would like to build CMake from source this are the steps:

OpenSSL:

Tutorial:

python setup.py bdist_wheel -DBUILD_CMAKE_FROM_SOURCE:BOOL=ON -DOPENSSL_ROOT_DIR="c:\Program Files\OpenSSL"

Using CMake on win-arm64

Generator: Ninja

Compiler: MSVC

Compiler: LLVM

Using inline attributes

Using environment variables

Compiler: MSVC, Linker: LLVM

Example:

Environment variable for linker is ignored.

 

Generator: Visual Studio

Compiler: MSVC

Compiler: LLVM

In general "-T llvm" would be the switch to use LLVM as a different toolset for a generator, but this option is not yet enabled for win-arm64.

Identify win-arm64 in CMake

The following CMake variable can help: {CMAKE_SYSTEM_PROCESSOR}

This works only on a native CMake instance and would give incorrect value with an emulated CMake

* Known issue

Can’t find installed Visual Studio, so only Ninja is working as a generator.

This has been fixed with

CI

https://open.cdash.org/index.php?project=CMake