环境
Windows 11 Professional 24H2
Visual Studio Professional 2022
准备
1.1.1. VS2022
请安装 CMake
工具。该工具自带 Ninja
编译工具,编译 Skia
时需要用到。
安装 Miniconda3
1.1.1. 安装最新版本的 Miniconda3
,并把安装目录(例如:C:\Apps\miniconda3
)设置到环境变量。
2.2.2. 到安装目录中,复制一份 python.exe
,改名为 python3.exe
。
3.3.3. 关闭 python.exe
和 python3.exe
的 应用执行别名
设置。
- 设置 -> 应用 -> 高级应用设置 -> 应用执行别名
安装 LLVM
1.1.1. 安装最新版本的 LLVM
,并把安装目录中 bin
子目录(例如:C:\Apps\LLVM\bin
)设置到环境变量。
设置 Git
1.1.1. 使用了 VPN
的情况下,进入系统设置中查看端口号。
- 设置 -> 网络和 Internet -> 代理 -> 使用代理服务器 -> 编辑
使用 Git Bash 工具
git config --global https.proxy 127.0.0.1:<port>
git config --global http.proxy 127.0.0.1:<port>
git config --global http.sslVerify false
2.2.2. <port>
就是需要填写的代理服务器的端口号。
下载
使用 Git Bash 工具
git clone https://github.com/google/skia.git
git clone https://github.com/xvch666/gn.git
使用 x64 Native Tools Command Prompt for VS 2022 工具
cd gn
python build/gen.py
ninja -C out
1.1.1. 将 gn\out\gn.exe
复制到 skia\bin
目录中。
下载第三方依赖库
使用 x64 Native Tools Command Prompt for VS 2022 工具
cd skia
python3 tools/git-sync-deps
设置编译参数配置
使用 x64 Native Tools Command Prompt for VS 2022 工具
.\bin\gn.exe gen out/LLVM.x64.Release.Dll --args="target_cpu=\"x64\" cc=\"clang\" cxx=\"clang++\" clang_win=\"C:/Apps/LLVM\" clang_win_version=\"19\" is_component_build=true is_official_build=false is_debug=false extra_cflags=[\"/MD\"]"
查看编译参数配置
使用 x64 Native Tools Command Prompt for VS 2022 工具
.\bin\gn.exe args out/LLVM.x64.Release.Dll --list
编译
使用 x64 Native Tools Command Prompt for VS 2022 工具
ninja -C out/LLVM.x64.Release.Dll