# dev 服务端采用rust 语言开发,客户端采用 flutter开发,windows 客户端依赖 vcpkg 界面功能。 ## 构建开发容器 构建开发容器,可以直接在codespaces中运行: .devcontainer\Dockerfile ``` # 安装依赖 RUN sudo apt update -y && sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake unzip zip sudo libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev # 安装 vcpkg RUN git clone https://github.com/microsoft/vcpkg WORKDIR vcpkg RUN git checkout 2023.04.15 RUN /vcpkg/bootstrap-vcpkg.sh -disableMetrics ENV VCPKG_ROOT=/vcpkg # 安装 rust RUN wget https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh RUN chmod +x rustup.sh RUN $HOME/rustup.sh -y # 安装flutter 3.10.1 RUN wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.10.1-stable.tar.xz RUN tar xf flutter_linux_3.10.1-stable.tar.xz && rm flutter_linux_3.10.1-stable.tar.xz ENV PATH="$PATH:$HOME/flutter/bin" ``` 在 .devcontainer\devcontainer.json 配置镜像,并设置初始化脚本 .devcontainer\build.sh ,以及默认插件,默认执行: ``` build(){ pwd $WORKDIR/entrypoint $1 } ``` 构建镜像较久,首次启动会很慢。 配置国内镜像: ``` RUN sed -i "s/deb.debian.org/mirrors.163.com/g" /etc/apt/sources.list RUN sed -i "s/security.debian.org/mirrors.163.com/g" /etc/apt/sources.list RUN echo '[source.crates-io]' > ~/.cargo/config \ && echo 'registry = "https://github.com/rust-lang/crates.io-index"' >> ~/.cargo/config \ && echo '# 替换成你偏好的镜像源' >> ~/.cargo/config \ && echo "replace-with = 'sjtu'" >> ~/.cargo/config \ && echo '# 上海交通大学' >> ~/.cargo/config \ && echo '[source.sjtu]' >> ~/.cargo/config \ && echo 'registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"' >> ~/.cargo/config \ && echo '' >> ~/.cargo/config ENV http_proxy=http://host:port ENV https_proxy=http://host:port ``` 构建和运行: ``` docker build -t "rustdesk-builder" . --build-arg http_proxy=http://host:port --build-arg https_proxy=http://host:port # 启动 rustdesk-builder 容器构建 docker run --rm -it -v $PWD:/home/user/rustdesk -v rustdesk-git-cache:/home/user/.cargo/git -v rustdesk-registry-cache:/home/user/.cargo/registry -e PUID="$(id -u)" -e PGID="$(id -g)" rustdesk-builder # 运行 ./target/debug/rustdesk ``` ## 构建 Ubuntu 本地开发环境 跨平台项目一般都在Linux上开发,可以依照 dockerfile 中参考,安装并构建: ``` sudo apt install ca-certificates -y sudo apt update -y sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang cmake libclang-dev ninja-build llvm-dev libclang-10-dev llvm-10-dev pkg-config git clone https://github.com/microsoft/vcpkg cd vcpkg git checkout 2023.04.15 cd .. vcpkg/bootstrap-vcpkg.bat export VCPKG_ROOT=$PWD/vcpkg vcpkg/vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static aom:x64-windows-static curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env git clone https://github.com/rustdesk/rustdesk cd rustdesk mkdir -p target/debug wget https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll mv sciter.dll target/debug cargo install VCPKG_ROOT=$HOME/vcpkg cargo run flutter_rust_bridge_codegen pushd flutter && flutter pub get && popd ``` ## 构建 windows 本地开发环境 也可以在windows开发,安装rust,flutter,Android,vs,vcpkg等: ``` ```