Skip to content

How to Build

nullname edited this page Feb 25, 2025 · 18 revisions

This guide describes the steps to build a Windows release of the project.

Windows

Build with Visual Studio 2022

  1. Download Qualcomm AI Engine Direct SDK, from here, and then extract it into a folder

  2. Install the latest Visual Studio, make sure clang toolchain and 'cmake' are installed Image Image

  3. Launch vs2022, tap Continue without code, and then in File menu, select Open -> CMake, in file open dialog, navigate to llama.cpp root directory, select CMakeLists.txt

  4. Edit llama.cpp\CMakePresets.json, add following line to config arm64-windows-llvm

    {
        "name": "arm64-windows-llvm", "hidden": true,
        "architecture": { "value": "arm64",    "strategy": "external" },
        "toolset":      { "value": "host=x64", "strategy": "external" },
        "cacheVariables": {
    -        "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/arm64-windows-llvm.cmake"
    +        "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/arm64-windows-llvm.cmake",
    +        "GGML_QNN": "ON",
    +        "GGML_QNN_SDK_PATH": "<path to your Qualcomm AI Engine Direct SDK, like x:/ml/qnn_sdk/qairt/2.31.0.250130/>",
    +        "BUILD_SHARED_LIBS": "OFF"
        }
    },
  5. Select config arm64-windows-llvm-debug Image

  6. In Build menu, tap Build All, output file are located at build-arm64-windows-llvm-debug\bin\

  7. Please copy those files from sdk lib directory (at qairt\2.31.0.250130\lib\aarch64-windows-msvc\) to the output directory before run:

QnnSystem.dll
QnnCpu.dll
QnnGpu.dll
QnnHtp.dll
QnnHtp*.dll
Clone this wiki locally