Compile scrcpy under Windows

Source code download address: https://github.com/Genymobile/scrcpy

The source code: BUILD.md file introduces the compilation method of each operating system, this chapter only involves Windows.

Download Msys2: http://www.msys2.org/

After installation, open msys2.exe in D:\Msys2 (installation path), which will enter a command line-like interface

Execute in turn:

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

After installation, close the command line, open mingw64.exe (if it is a 32-bit version, open mingw32.exe), and set the environment variables

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"

Compile the server part of scrcpy

cd 进入scrcpy的代码目录:

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

Compile scrcpy.exe on PC

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

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

 

common problem:

It prompts that pkg-config and cmake cannot be found. Check whether the installation is complete. Check if there is a corresponding exe under D:\Msys2\mingw64\bin.

Guess you like

Origin blog.csdn.net/weixin_41486477/article/details/111315058