2023/09/21 更新
来自评论:HolyDragon
github自带的Action可以编译Windows/Andorid/IOS 而且比较方便,不用再自己电脑装这么多的软件,https://rustdesk.com/docs/en/dev/build/all/
2023/09/15 更新
补充VCPKG_ROOT环境变量设置,这个一直忘记写上去,补上。
2023/08/31 更新
1、更新需安装依赖,见安装依赖部分
2、修复【安装打包程序】图片丢失问题
本文环境
Windows 11 Home Edition
Visual Studio 2022 Enterprise
Rust 1.62.1
GCC 6.4.0
LLVM 14.0.6
NSIS 3.0.8
安装rust编程环境
官网:https://www.rust-lang.org/
安装包:https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe

下载运行,默认配置即可。
测试:
打开命令提示符(cmd)输入:rustc --version与cargo --version

安装C++编程环境
启动vs installer

安装C++桌面开发
安装其他环境
安装LLVM
官网:https://llvm.org/
安装包:https://github.com/llvm/llvm-project/releases/tag/llvmorg-14.0.6

默认配置安装即可。(记得添加环境变量Add Path)
如果没有勾选,配置环境变量如下:
- Path中添加LLVM安装路径\LLVM\bin
- 新建LIBCLANG_PATH值LLVM安装路径\LLVM\lib
如图
Path

LIBCLANG_PATH

安装GCC环境
下载:MinGW64
地址:https://sourceforge.net/projects/mingw-w64/files/

解压到任意位置。
添加Path环境变量
解压路径\bin
如图:

测试:
打开命令提示符(cmd)输入:gcc --version

安装VCPKG
下载VCPKG
官网:https://github.com/microsoft/vcpkg
> git clone https://github.com/microsoft/vcpkg
> .\vcpkg\bootstrap-vcpkg.bat
或者下载code解压,然后运行bootstrap-vcpkg.bat

2023/09/15更新:新增VCPKG_ROOT环境变量设置
设置环境变量VCPKG_ROOT
如下图

然后在本文件夹打开命令提示符(cmd)输入:vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static(无科学可能无法安装,可下载依赖到下级downloads目录中)
2023/08/31更新:新增aom
然后在本文件夹打开命令提示符(cmd)输入:vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static aom:x64-windows-static(无科学可能无法安装,可下载依赖到下级downloads目录中)
依赖文件:http://192.168.0.150:8000/f/9ce5e0834af14e938d80/
放到:vcpkg路径\downloads

安装打包程序
官网:https://nsis.sourceforge.io/Download

下载运行,默认配置安装即可。
下载sciter
官网:https://sciter.com/
Windows下载地址:https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll
将sciter.dll文件复制一份到源码根目录,编译后同样复制一份到debug与release目录。
编译
下载代码
地址:https://github.com/rustdesk/rustdesk
在源码根目录:cargo run
附:
cargo run–编译并运行,文件位于:target\debug\xxx.exe
cargo build–仅编译
cargo build --release–编译release包,文件位于:target\release\xxx.exe
注意:单独运行编译后的文件需要将src文件夹复制一份到debug目录或release目录。
打包
需修改源码根目录setup.nsi文件
注释第81行File "${PRODUCT_NAME}.exe"
后面添加:
  File "target\release\${PRODUCT_NAME}.exe"
  File "target\release\sciter.dll"
  SetOutPath $INSTDIR\src
  File /r "src\ui"
  SetOutPath $INSTDIR

然后运行nsis。

点击Compile NSI scripts

点击Load Script然后选择setup.nsi文件。

如上图,打包完成,源码根目录出现:rustdesk-版本号-setup.exe
安装测试
启动本地服务器
下载server
地址:https://github.com/rustdesk/rustdesk-server/releases/tag/1.1.6

解压得到

在命令提示符(cmd)下直接运行即可。

此时程序根目录会生成密钥文件。

其中id_ed25519.pub即为KEY
使用任意文件编辑器即可打开。
配置中继服务器

填写ID服务器地址与KEY即可。
安装与测试



参考资料
https://copyfuture.com/blogs-details/202207090624461569
https://github.com/rustdesk/rustdesk/blob/master/README-ZH.md
 
         
       
        
评论区