Windows下面zerotier托盘程序 DesktopUI 编译步骤
1、安装windows下的 gcc,make,cargo 工具
2、下载源码 https://github.com/zerotier/DesktopUI.git
3、cd DestopUI 删除目录下面所有的 Cargo.lock 文件
4、搜索widestring的版本为0.4.3的替换为 0.5.1
5、执行 cargo vendor -s .\Cargo.toml
6、修改Makefile文件, 把Windows部分的这三行代码删除, 代表不编译32位的可执行文件, 仅仅编译64位的可执行文件
make -C tray clean
make -C tray zt_lib WIN_32BIT=1
set "RUSTFLAGS=-C link-args=/SAFESEH:NO" && cargo build $(CARGO_FLAGS) --target=x86_64-pc-windows-msvc
安装npm
Node.jshttps://nodejs.org/en/安装parcel和yarn
DesktopUI\ui>npm i -g parcel-bundler
删除package.json文件中下面所包含的 “ && rm dist/index-min.js dist/index.js” ,最终如下所示:
"scripts": {
"build": "parcel build --no-content-hash --no-source-maps ./src/index.jsx && babel --minified --no-comments -o dist/index-min.js dist/index.js && parcel build --no-content-hash --no-source-maps ./src/index.html",
"build-css-dark": "parcel build --no-content-hash --no-source-maps src/themes/zerotier/dark.scss",
"build-css-light": "parcel build --no-content-hash --no-source-maps src/themes/zerotier/light.scss"
}
然后编译
DesktopUI\ui>yarn build
7、然后执行make即可把UI相关的更改编译进可执行文件中
Finished dev [unoptimized + debuginfo] target(s) in 3.26s
生成的文件 D:\DesktopUI\target\x86_64-pc-windows-msvc\debug\zerotier_desktop_ui.exe