Skip to content

Display and control your Android device

Simplify portable build configuration

Romain Vimonteb34098add98
diff --git a/Makefile.CrossWindows b/Makefile.CrossWindows
index 0f7b14a6..960983df 100644
--- a/Makefile.CrossWindows
+++ b/Makefile.CrossWindows
@@ -57,7 +57,7 @@ build-win32: prepare-deps-win32
--buildtype release --strip -Db_lto=true \
-Dcrossbuild_windows=true \
-Dbuild_server=false \
- -Doverride_server_path=scrcpy-server.jar )
+ -Dportable=true )
ninja -C "$(WIN32_BUILD_DIR)"
build-win32-noconsole: prepare-deps-win32
@@ -68,7 +68,7 @@ build-win32-noconsole: prepare-deps-win32
-Dcrossbuild_windows=true \
-Dbuild_server=false \
-Dwindows_noconsole=true \
- -Doverride_server_path=scrcpy-server.jar )
+ -Dportable=true )
ninja -C "$(WIN32_NOCONSOLE_BUILD_DIR)"
prepare-deps-win64:
@@ -81,7 +81,7 @@ build-win64: prepare-deps-win64
--buildtype release --strip -Db_lto=true \
-Dcrossbuild_windows=true \
-Dbuild_server=false \
- -Doverride_server_path=scrcpy-server.jar )
+ -Dportable=true )
ninja -C "$(WIN64_BUILD_DIR)"
build-win64-noconsole: prepare-deps-win64
@@ -92,7 +92,7 @@ build-win64-noconsole: prepare-deps-win64
-Dcrossbuild_windows=true \
-Dbuild_server=false \
-Dwindows_noconsole=true \
- -Doverride_server_path=scrcpy-server.jar )
+ -Dportable=true )
ninja -C "$(WIN64_NOCONSOLE_BUILD_DIR)"
dist-win32: build-server build-win32 build-win32-noconsole
diff --git a/app/meson.build b/app/meson.build
index 37e2372a..673892cd 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -93,16 +93,9 @@ conf.set_quoted('SCRCPY_VERSION', meson.project_version())
# the prefix used during configuration (meson --prefix=PREFIX)
conf.set_quoted('PREFIX', get_option('prefix'))
-# the path of the server to be used "as is"
-# this is useful for building a "portable" version (with the server in the same
-# directory as the client)
-override_server_path = get_option('override_server_path')
-if override_server_path != ''
- conf.set_quoted('OVERRIDE_SERVER_PATH', override_server_path)
-else
- # undefine it
- conf.set('OVERRIDE_SERVER_PATH', false)
-endif
+# build a "portable" version (with scrcpy-server.jar accessible from the
+# current directory)
+conf.set('PORTABLE', get_option('portable'))
# the default client TCP port for the "adb reverse" tunnel
# overridden by option --port
diff --git a/app/src/server.c b/app/src/server.c
index 6dbf6c76..47e0780f 100644
--- a/app/src/server.c
+++ b/app/src/server.c
@@ -12,8 +12,8 @@
#define SOCKET_NAME "scrcpy"
-#ifdef OVERRIDE_SERVER_PATH
-# define DEFAULT_SERVER_PATH OVERRIDE_SERVER_PATH
+#ifdef PORTABLE
+# define DEFAULT_SERVER_PATH "scrcpy-server.jar"
#else
# define DEFAULT_SERVER_PATH PREFIX "/share/scrcpy/scrcpy-server.jar"
#endif
diff --git a/meson_options.txt b/meson_options.txt
index 567f0a39..90b4293c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -3,6 +3,6 @@ option('build_server', type: 'boolean', value: true, description: 'Build the ser
option('crossbuild_windows', type: 'boolean', value: false, description: 'Build for Windows from Linux')
option('windows_noconsole', type: 'boolean', value: false, description: 'Disable console on Windows (pass -mwindows flag)')
option('prebuilt_server', type: 'string', description: 'Path of the prebuilt server')
-option('override_server_path', type: 'string', description: 'Hardcoded path to find the server at runtime')
+option('portable', type: 'boolean', description: 'Use scrcpy-server.jar from the current directory')
option('skip_frames', type: 'boolean', value: true, description: 'Always display the most recent frame')
option('hidpi_support', type: 'boolean', value: true, description: 'Enable High DPI support')