CMake
- 2 Using CMake on win-arm64
- 2.1 Generator: Ninja
- 2.1.1 Compiler: MSVC
- 2.1.2 Compiler: LLVM
- 2.1.2.1 Using inline attributes
- 2.1.2.2 Using environment variables
- 2.1.3 Compiler: MSVC, Linker: LLVM
- 2.2 Generator: Visual Studio
- 2.2.1 Compiler: MSVC
- 2.2.2 Compiler: LLVM
- 2.3 Identify win-arm64 in CMake
- 2.4 * Known issue
- 2.5 CI
- 2.1 Generator: Ninja
CMake is a widely used open-source, cross-platform family of tools designed to build, test, and package software.
Project homepage: CMake - Upgrade Your Software Build System
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 Download CMake
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 |
| Download CMake - Windows i386 (Win 10) or Windows x86_64 (Win 11) |
Python package |
|
Build from source
OpenSSL: A tale of a dependency chain: Pillow and the crew | 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: Debug run-time DLL issue
Note: Please check out a commit with https://gitlab.kitware.com/cmake/cmake/-/commit/3eb9f69ffe3bf9a8a69195a54d147abfc6146cf5
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: cmake
Github source:GitHub - scikit-build/cmake-python-distributions: This project provides the infrastructure to build CMake Python wheels.
It relies on scikit-build and not setuptools.
sci-kit build win-arm64 support was released in 0.13.0: Add ARM64 as a new Windows platform by gaborkertesz-linaro · Pull Request #612 · scikit-build/scikit-build
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.
Enable win-arm64 by x86-emulated version by gaborkertesz-linaro · Pull Request #231 · scikit-build/cmake-python-distributions
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: A tale of a dependency chain: Pillow and the crew | OpenSSL
Tutorial: https://cmake-python-distributions.readthedocs.io/en/latest/building.html
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 https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7159