编译指南
Blinue edited this page 2025-08-10 12:37:15 +00:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

先决条件

为了编译 Magpie你首先需要安装

  1. Visual Studio 2022 的最新版本,需要安装“使用 C++ 的桌面开发”和“通用 Windows 平台开发”两个工作负荷以及 Windows SDK build 26100 或更高版本。

  2. CMake

    你也可以使用 Visual Studio 内置的 CMake它位于 %ProgramFiles%\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin

  3. Python 3.11+

  4. Conan

    pip install conan
    

    确保上述依赖均已被添加入系统路径,使用以下命令检查:

    cmake --version
    python --version
    conan --version
    

编译

  1. 克隆存储库

    git clone https://github.com/Blinue/Magpie
    
  2. 打开根目录的 Magpie.sln 然后生成解决方案。

启用触控支持

为了支持触控输入TouchHelper.exe 应签名。签名是在 CI 中自动进行的,但你也可以手动签名,请执行以下步骤:

  1. 创建自签名证书,将其导出为 pfx。
  2. src/Magpie/TouchHelper.cpp 中的 CERT_FINGERPRINT 常量替换为你的证书的 SHA-1 哈希值(也即该证书的指纹)。
  3. 在存储库根目录下执行以下命令:
python scripts/publish.py --pfx-path=<pfx 路径> --pfx-password=<pfx 密码>

这将编译 Magpie 并为 TouchHelper.exe 签名。编译出的程序位于 publish\x64