mirror of https://github.com/Genymobile/scrcpy
Refactor build system
The client was built with Meson, the server with Gradle, and were run by a Makefile. Add a Meson script for the server (which delegates to Gradle), and a parent script to build and install both the client and the server to the system, typically with: meson --buildtype release build cd build ninja sudo ninja install In addition, use a separate Makefile to build a "portable" version of the application (where the client expects the server to be in the current directory). Typically: make release-portable cd dist/scrcpy ./scrcpy This is especially useful for Windows builds, which are not "installed".hidpi
parent
396df8a9d8
commit
ff94462d8a
@ -0,0 +1 @@
|
|||||||
|
option('override_server_jar', type: 'string')
|
@ -0,0 +1,6 @@
|
|||||||
|
project('scrcpy', 'c', subproject_dir: '.')
|
||||||
|
|
||||||
|
subproject('app')
|
||||||
|
subproject('server')
|
||||||
|
|
||||||
|
run_target('run', command: ['scripts/run-scrcpy.sh'])
|
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRCPY_SERVER_JAR="$MESON_BUILD_ROOT/server/scrcpy-server.jar" "$MESON_BUILD_ROOT/app/scrcpy"
|
@ -0,0 +1,11 @@
|
|||||||
|
project('scrcpy-server', 'c') # not really c, but meson expects something
|
||||||
|
|
||||||
|
# does not track dependencies, so meson does not guarantees that server is up to date
|
||||||
|
# call "touch server" or "ninja -t clean server/scrcpy-server.jar" before to rebuild
|
||||||
|
custom_target('scrcpy-server',
|
||||||
|
build_always: false, # do not enable, otherwise "sudo ninja install" will execute gradle!
|
||||||
|
input: '.',
|
||||||
|
output: 'scrcpy-server.jar',
|
||||||
|
command: [find_program('./scripts/build-wrapper.sh'), '@INPUT@', '@OUTPUT@', get_option('buildtype')],
|
||||||
|
install: true,
|
||||||
|
install_dir: 'share/scrcpy')
|
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Wrapper script to invoke gradle from meson
|
||||||
|
set -e
|
||||||
|
|
||||||
|
PROJECT_ROOT="$1"
|
||||||
|
OUTPUT="$2"
|
||||||
|
BUILDTYPE="$3"
|
||||||
|
|
||||||
|
# gradlew is in the parent of the server directory
|
||||||
|
GRADLE=${GRADLE:-$PROJECT_ROOT/../gradlew}
|
||||||
|
|
||||||
|
if [[ "$BUILDTYPE" == debug ]]
|
||||||
|
then
|
||||||
|
"$GRADLE" -p "$PROJECT_ROOT" assembleDebug
|
||||||
|
cp "$PROJECT_ROOT/build/outputs/apk/debug/server-debug.apk" "$OUTPUT"
|
||||||
|
else
|
||||||
|
"$GRADLE" -p "$PROJECT_ROOT" assembleRelease
|
||||||
|
cp "$PROJECT_ROOT/build/outputs/apk/release/server-release-unsigned.apk" "$OUTPUT"
|
||||||
|
fi
|
Loading…
Reference in New Issue