2018-05-13 14:03:39 +00:00
|
|
|
# This makefile provides recipes to build a "portable" version of scrcpy for
|
|
|
|
# Windows.
|
|
|
|
#
|
|
|
|
# Here, "portable" means that the client and server binaries are expected to be
|
|
|
|
# anywhere, but in the same directory, instead of well-defined separate
|
2019-10-30 22:40:10 +00:00
|
|
|
# locations (e.g. /usr/bin/scrcpy and /usr/share/scrcpy/scrcpy-server).
|
2018-05-13 14:03:39 +00:00
|
|
|
#
|
|
|
|
# In particular, this implies to change the location from where the client push
|
|
|
|
# the server to the device.
|
|
|
|
|
|
|
|
.PHONY: default clean \
|
2024-09-18 21:39:45 +00:00
|
|
|
test test-client test-server \
|
2018-05-13 14:03:39 +00:00
|
|
|
build-server \
|
2024-09-18 20:32:28 +00:00
|
|
|
prepare-deps-win32 prepare-deps-win64 \
|
2020-12-15 20:50:46 +00:00
|
|
|
build-win32 build-win64 \
|
2018-05-13 14:03:39 +00:00
|
|
|
dist-win32 dist-win64 \
|
|
|
|
zip-win32 zip-win64 \
|
2020-12-17 13:54:04 +00:00
|
|
|
release
|
2018-05-13 14:03:39 +00:00
|
|
|
|
|
|
|
GRADLE ?= ./gradlew
|
|
|
|
|
2020-12-17 13:54:04 +00:00
|
|
|
TEST_BUILD_DIR := build-test
|
2018-05-13 14:03:39 +00:00
|
|
|
SERVER_BUILD_DIR := build-server
|
|
|
|
WIN32_BUILD_DIR := build-win32
|
|
|
|
WIN64_BUILD_DIR := build-win64
|
|
|
|
|
2024-09-06 21:07:15 +00:00
|
|
|
VERSION ?= $(shell git describe --tags --exclude='*install-release' --always)
|
2022-12-21 12:31:18 +00:00
|
|
|
|
|
|
|
DIST := dist
|
|
|
|
WIN32_TARGET_DIR := scrcpy-win32-$(VERSION)
|
|
|
|
WIN64_TARGET_DIR := scrcpy-win64-$(VERSION)
|
|
|
|
WIN32_TARGET := $(WIN32_TARGET_DIR).zip
|
|
|
|
WIN64_TARGET := $(WIN64_TARGET_DIR).zip
|
2018-05-13 14:03:39 +00:00
|
|
|
|
2020-12-17 13:54:04 +00:00
|
|
|
RELEASE_DIR := release-$(VERSION)
|
|
|
|
|
|
|
|
release: clean test build-server zip-win32 zip-win64
|
|
|
|
mkdir -p "$(RELEASE_DIR)"
|
|
|
|
cp "$(SERVER_BUILD_DIR)/server/scrcpy-server" \
|
|
|
|
"$(RELEASE_DIR)/scrcpy-server-$(VERSION)"
|
|
|
|
cp "$(DIST)/$(WIN32_TARGET)" "$(RELEASE_DIR)"
|
|
|
|
cp "$(DIST)/$(WIN64_TARGET)" "$(RELEASE_DIR)"
|
|
|
|
cd "$(RELEASE_DIR)" && \
|
|
|
|
sha256sum "scrcpy-server-$(VERSION)" \
|
|
|
|
"scrcpy-win32-$(VERSION).zip" \
|
|
|
|
"scrcpy-win64-$(VERSION).zip" > SHA256SUMS.txt
|
|
|
|
@echo "Release generated in $(RELEASE_DIR)/"
|
2018-05-13 14:03:39 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
$(GRADLE) clean
|
2020-12-17 13:54:04 +00:00
|
|
|
rm -rf "$(DIST)" "$(TEST_BUILD_DIR)" "$(SERVER_BUILD_DIR)" \
|
|
|
|
"$(WIN32_BUILD_DIR)" "$(WIN64_BUILD_DIR)"
|
|
|
|
|
2024-09-18 21:39:45 +00:00
|
|
|
test-client:
|
2020-12-17 13:54:04 +00:00
|
|
|
[ -d "$(TEST_BUILD_DIR)" ] || ( mkdir "$(TEST_BUILD_DIR)" && \
|
2022-12-21 12:29:27 +00:00
|
|
|
meson setup "$(TEST_BUILD_DIR)" -Db_sanitize=address )
|
2020-12-17 13:54:04 +00:00
|
|
|
ninja -C "$(TEST_BUILD_DIR)"
|
2024-09-18 21:39:45 +00:00
|
|
|
|
|
|
|
test-server:
|
2020-12-17 13:54:04 +00:00
|
|
|
$(GRADLE) -p server check
|
2018-05-13 14:03:39 +00:00
|
|
|
|
2024-09-18 21:39:45 +00:00
|
|
|
test: test-client test-server
|
|
|
|
|
2018-05-13 14:03:39 +00:00
|
|
|
build-server:
|
2024-09-18 21:40:27 +00:00
|
|
|
$(GRADLE) -p server assembleRelease
|
|
|
|
mkdir -p "$(SERVER_BUILD_DIR)/server"
|
|
|
|
cp server/build/outputs/apk/release/server-release-unsigned.apk \
|
|
|
|
"$(SERVER_BUILD_DIR)/server/scrcpy-server"
|
2018-05-13 14:03:39 +00:00
|
|
|
|
2024-03-01 19:02:00 +00:00
|
|
|
prepare-deps-win32:
|
|
|
|
@app/deps/adb.sh win32
|
|
|
|
@app/deps/sdl.sh win32
|
|
|
|
@app/deps/ffmpeg.sh win32
|
|
|
|
@app/deps/libusb.sh win32
|
|
|
|
|
|
|
|
prepare-deps-win64:
|
|
|
|
@app/deps/adb.sh win64
|
|
|
|
@app/deps/sdl.sh win64
|
|
|
|
@app/deps/ffmpeg.sh win64
|
|
|
|
@app/deps/libusb.sh win64
|
|
|
|
|
|
|
|
build-win32: prepare-deps-win32
|
2023-11-24 20:25:13 +00:00
|
|
|
rm -rf "$(WIN32_BUILD_DIR)"
|
|
|
|
mkdir -p "$(WIN32_BUILD_DIR)/local"
|
|
|
|
meson setup "$(WIN32_BUILD_DIR)" \
|
2024-03-01 19:02:00 +00:00
|
|
|
--pkg-config-path="app/deps/work/install/win32/lib/pkgconfig" \
|
|
|
|
-Dc_args="-I$(PWD)/app/deps/work/install/win32/include" \
|
|
|
|
-Dc_link_args="-L$(PWD)/app/deps/work/install/win32/lib" \
|
2023-11-24 20:25:13 +00:00
|
|
|
--cross-file=cross_win32.txt \
|
|
|
|
--buildtype=release --strip -Db_lto=true \
|
|
|
|
-Dcompile_server=false \
|
|
|
|
-Dportable=true
|
2018-05-13 14:03:39 +00:00
|
|
|
ninja -C "$(WIN32_BUILD_DIR)"
|
|
|
|
|
2024-03-01 19:02:00 +00:00
|
|
|
build-win64: prepare-deps-win64
|
2023-11-24 20:25:13 +00:00
|
|
|
rm -rf "$(WIN64_BUILD_DIR)"
|
|
|
|
mkdir -p "$(WIN64_BUILD_DIR)/local"
|
|
|
|
meson setup "$(WIN64_BUILD_DIR)" \
|
2024-03-01 19:02:00 +00:00
|
|
|
--pkg-config-path="app/deps/work/install/win64/lib/pkgconfig" \
|
|
|
|
-Dc_args="-I$(PWD)/app/deps/work/install/win64/include" \
|
|
|
|
-Dc_link_args="-L$(PWD)/app/deps/work/install/win64/lib" \
|
2023-11-24 20:25:13 +00:00
|
|
|
--cross-file=cross_win64.txt \
|
|
|
|
--buildtype=release --strip -Db_lto=true \
|
|
|
|
-Dcompile_server=false \
|
|
|
|
-Dportable=true
|
2018-05-13 14:03:39 +00:00
|
|
|
ninja -C "$(WIN64_BUILD_DIR)"
|
|
|
|
|
2020-12-15 20:50:46 +00:00
|
|
|
dist-win32: build-server build-win32
|
2018-05-13 14:03:39 +00:00
|
|
|
mkdir -p "$(DIST)/$(WIN32_TARGET_DIR)"
|
2019-10-30 22:40:10 +00:00
|
|
|
cp "$(SERVER_BUILD_DIR)"/server/scrcpy-server "$(DIST)/$(WIN32_TARGET_DIR)/"
|
2018-05-13 14:03:39 +00:00
|
|
|
cp "$(WIN32_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN32_TARGET_DIR)/"
|
2023-11-24 20:25:13 +00:00
|
|
|
cp app/data/scrcpy-console.bat "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
cp app/data/scrcpy-noconsole.vbs "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
cp app/data/icon.png "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
cp app/data/open_a_terminal_here.bat "$(DIST)/$(WIN32_TARGET_DIR)/"
|
2024-03-01 19:02:00 +00:00
|
|
|
cp app/deps/work/install/win32/bin/*.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
cp app/deps/work/install/win32/bin/adb.exe "$(DIST)/$(WIN32_TARGET_DIR)/"
|
2018-05-13 14:03:39 +00:00
|
|
|
|
2020-12-15 20:50:46 +00:00
|
|
|
dist-win64: build-server build-win64
|
2018-05-13 14:03:39 +00:00
|
|
|
mkdir -p "$(DIST)/$(WIN64_TARGET_DIR)"
|
2019-10-30 22:40:10 +00:00
|
|
|
cp "$(SERVER_BUILD_DIR)"/server/scrcpy-server "$(DIST)/$(WIN64_TARGET_DIR)/"
|
2018-05-13 14:03:39 +00:00
|
|
|
cp "$(WIN64_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN64_TARGET_DIR)/"
|
2023-11-24 20:25:13 +00:00
|
|
|
cp app/data/scrcpy-console.bat "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
cp app/data/scrcpy-noconsole.vbs "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
cp app/data/icon.png "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
cp app/data/open_a_terminal_here.bat "$(DIST)/$(WIN64_TARGET_DIR)/"
|
2024-03-01 19:02:00 +00:00
|
|
|
cp app/deps/work/install/win64/bin/*.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
cp app/deps/work/install/win64/bin/adb.exe "$(DIST)/$(WIN64_TARGET_DIR)/"
|
2018-05-13 14:03:39 +00:00
|
|
|
|
|
|
|
zip-win32: dist-win32
|
2022-12-21 12:31:18 +00:00
|
|
|
cd "$(DIST)"; \
|
|
|
|
zip -r "$(WIN32_TARGET)" "$(WIN32_TARGET_DIR)"
|
2018-05-13 14:03:39 +00:00
|
|
|
|
|
|
|
zip-win64: dist-win64
|
2022-12-21 12:31:18 +00:00
|
|
|
cd "$(DIST)"; \
|
|
|
|
zip -r "$(WIN64_TARGET)" "$(WIN64_TARGET_DIR)"
|