Windows下编译scrcpy

源码下载地址:https://github.com/Genymobile/scrcpy

在源码的:BUILD.md 文件里介绍了各操作系统编译方式,本章只涉及Windows.

下载Msys2:http://www.msys2.org/

安装后在D:\Msys2(安装路径),打开msys2.exe,这会进入一个类似命令行的界面

依次执行:

pacman -S mingw-w64-x86_64-SDL2 
pacman -S mingw-w64-x86_64-ffmpeg
pacman -S mingw-w64-x86_64-make 
pacman -S mingw-w64-x86_64-gcc 
pacman -S mingw-w64-x86_64-pkg-config 
pacman -S mingw-w64-x86_64-meson

安装完毕后关闭命令行,打开mingw64.exe(如果是32位的打开mingw32.exe),进行环境变量设置

export JAVA_HOME="C:\Program Files\Java\jdk-15.0.1"
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/mingw64/lib/pkgconfig
export ANDROID_SDK_ROOT="D:\android\SDK"
export PATH=$PATH:"D:\platform-tools_r28.0.1-windows\platform-tools"

编译scrcpy的server部分

cd 进入scrcpy的代码目录:

./server/scripts/build-wrapper.sh  "server" "server/scrcpy-server" "release"

编译PC端的scrcpy.exe

meson x --buildtype release --strip -Db_lto=true

ninja -Cx    //x为目录名,可以更换

常见问题:

提示pkg-config、cmake找不到,检查下安装好了没,在D:\Msys2\mingw64\bin下查看有没有对应的exe。

猜你喜欢

转载自blog.csdn.net/weixin_41486477/article/details/111315058