Skip to content

Commit

Permalink
Merge branch 'dev' into input_method
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/src/input_manager.c
#	server/meson.build
  • Loading branch information
pangliang committed Nov 15, 2019
2 parents 539a41d + 771bd84 commit 61a22d0
Show file tree
Hide file tree
Showing 26 changed files with 788 additions and 328 deletions.
14 changes: 6 additions & 8 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ Then, build:

```bash
meson x --buildtype release --strip -Db_lto=true
cd x
ninja
ninja -Cx
```

_Note: `ninja` [must][ninja-user] be run as a non-root user (only `ninja
Expand All @@ -219,13 +218,13 @@ To run without installing:
After a successful build, you can install _scrcpy_ on the system:

```bash
sudo ninja install # without sudo on Windows
sudo ninja -Cx install # without sudo on Windows
```

This installs two files:

- `/usr/local/bin/scrcpy`
- `/usr/local/share/scrcpy/scrcpy-server.jar`
- `/usr/local/share/scrcpy/scrcpy-server`

Just remove them to "uninstall" the application.

Expand All @@ -244,8 +243,7 @@ configuration:

```bash
meson x --buildtype release --strip -Db_lto=true \
-Dprebuilt_server=/path/to/scrcpy-server.jar
cd x
ninja
sudo ninja install
-Dprebuilt_server=/path/to/scrcpy-server
ninja -Cx
sudo ninja -Cx install
```
34 changes: 32 additions & 2 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Overview

This application is composed of two parts:
- the server (`scrcpy-server.jar`), to be executed on the device,
- the server (`scrcpy-server`), to be executed on the device,
- the client (the `scrcpy` binary), executed on the host computer.

The client is responsible to push the server to the device and start its
Expand Down Expand Up @@ -49,7 +49,7 @@ application may not replace the server just before the client executes it._
Instead of a raw _dex_ file, `app_process` accepts a _jar_ containing
`classes.dex` (e.g. an [APK]). For simplicity, and to benefit from the gradle
build system, the server is built to an (unsigned) APK (renamed to
`scrcpy-server.jar`).
`scrcpy-server`).

[dex]: https://en.wikipedia.org/wiki/Dalvik_(software)
[apk]: https://en.wikipedia.org/wiki/Android_application_package
Expand Down Expand Up @@ -268,3 +268,33 @@ For more details, go read the code!

If you find a bug, or have an awesome idea to implement, please discuss and
contribute ;-)


### Debug the server

The server is pushed to the device by the client on startup.

To debug it, enable the server debugger during configuration:

```bash
meson x -Dserver_debugger=true
# or, if x is already configured
meson configure x -Dserver_debugger=true
```

Then recompile.

When you start scrcpy, it will start a debugger on port 5005 on the device.
Redirect that port to the computer:

```bash
adb forward tcp:5005 tcp:5005
```

In Android Studio, _Run_ > _Debug_ > _Edit configurations..._ On the left, click on
`+`, _Remote_, and fill the form:

- Host: `localhost`
- Port: `5005`

Then click on _Debug_.
6 changes: 3 additions & 3 deletions Makefile.CrossWindows
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Here, "portable" means that the client and server binaries are expected to be
# anywhere, but in the same directory, instead of well-defined separate
# locations (e.g. /usr/bin/scrcpy and /usr/share/scrcpy/scrcpy-server.jar).
# locations (e.g. /usr/bin/scrcpy and /usr/share/scrcpy/scrcpy-server).
#
# In particular, this implies to change the location from where the client push
# the server to the device.
Expand Down Expand Up @@ -97,7 +97,7 @@ build-win64-noconsole: prepare-deps-win64

dist-win32: build-server build-win32 build-win32-noconsole
mkdir -p "$(DIST)/$(WIN32_TARGET_DIR)"
cp "$(SERVER_BUILD_DIR)"/server/scrcpy-server.jar "$(DIST)/$(WIN32_TARGET_DIR)/"
cp "$(SERVER_BUILD_DIR)"/server/scrcpy-server "$(DIST)/$(WIN32_TARGET_DIR)/"
cp "$(WIN32_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN32_TARGET_DIR)/"
cp "$(WIN32_NOCONSOLE_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN32_TARGET_DIR)/scrcpy-noconsole.exe"
cp prebuilt-deps/ffmpeg-4.1.4-win32-shared/bin/avutil-56.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
Expand All @@ -112,7 +112,7 @@ dist-win32: build-server build-win32 build-win32-noconsole

dist-win64: build-server build-win64 build-win64-noconsole
mkdir -p "$(DIST)/$(WIN64_TARGET_DIR)"
cp "$(SERVER_BUILD_DIR)"/server/scrcpy-server.jar "$(DIST)/$(WIN64_TARGET_DIR)/"
cp "$(SERVER_BUILD_DIR)"/server/scrcpy-server "$(DIST)/$(WIN64_TARGET_DIR)/"
cp "$(WIN64_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN64_TARGET_DIR)/"
cp "$(WIN64_NOCONSOLE_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN64_TARGET_DIR)/scrcpy-noconsole.exe"
cp prebuilt-deps/ffmpeg-4.1.4-win64-shared/bin/avutil-56.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ This is useful for example to mirror only one eye of the Oculus Go:

```bash
scrcpy --crop 1224:1440:0:0 # 1224x1440 at offset (0,0)
scrcpy -c 1224:1440:0:0 # short version
```

If `--max-size` is also specified, resizing is applied after cropping.
Expand Down Expand Up @@ -226,7 +225,6 @@ The window of app can always be above others by:

```bash
scrcpy --always-on-top
scrcpy -T # short version
```


Expand Down Expand Up @@ -358,7 +356,7 @@ To use a specific _adb_ binary, configure its path in the environment variable

ADB=/path/to/adb scrcpy

To override the path of the `scrcpy-server.jar` file, configure its path in
To override the path of the `scrcpy-server` file, configure its path in
`SCRCPY_SERVER_PATH`.

[useful]: https://github.com/Genymobile/scrcpy/issues/278#issuecomment-429330345
Expand Down
7 changes: 6 additions & 1 deletion app/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ conf.set_quoted('SCRCPY_VERSION', meson.project_version())
# the prefix used during configuration (meson --prefix=PREFIX)
conf.set_quoted('PREFIX', get_option('prefix'))

# build a "portable" version (with scrcpy-server.jar accessible from the same
# build a "portable" version (with scrcpy-server accessible from the same
# directory as the executable)
conf.set('PORTABLE', get_option('portable'))

Expand All @@ -115,6 +115,9 @@ conf.set('HIDPI_SUPPORT', get_option('hidpi_support'))
# disable console on Windows
conf.set('WINDOWS_NOCONSOLE', get_option('windows_noconsole'))

# run a server debugger and wait for a client to be attached
conf.set('SERVER_DEBUGGER', get_option('server_debugger'))

configure_file(configuration: conf, output: 'config.h')

src_dir = include_directories('src')
Expand All @@ -134,6 +137,8 @@ executable('scrcpy', src,
c_args: c_args,
link_args: link_args)

install_man('scrcpy.1')


### TESTS

Expand Down
Loading

0 comments on commit 61a22d0

Please sign in to comment.