Simplify portable build configuration

To create a portable build (with scrcpy-server.jar accessible from the
scrcpy directory), replace OVERRIDE_SERVER_PATH by a simple compilation
flag: PORTABLE.

This paves the way to use more complex rules to determine the path of
scrcpy-server.jar in portable builds.
This commit is contained in:
Romain Vimont 2019-06-08 19:03:22 +02:00
parent b777760bca
commit eb34098add
4 changed files with 10 additions and 17 deletions

View file

@ -57,7 +57,7 @@ build-win32: prepare-deps-win32
--buildtype release --strip -Db_lto=true \ --buildtype release --strip -Db_lto=true \
-Dcrossbuild_windows=true \ -Dcrossbuild_windows=true \
-Dbuild_server=false \ -Dbuild_server=false \
-Doverride_server_path=scrcpy-server.jar ) -Dportable=true )
ninja -C "$(WIN32_BUILD_DIR)" ninja -C "$(WIN32_BUILD_DIR)"
build-win32-noconsole: prepare-deps-win32 build-win32-noconsole: prepare-deps-win32
@ -68,7 +68,7 @@ build-win32-noconsole: prepare-deps-win32
-Dcrossbuild_windows=true \ -Dcrossbuild_windows=true \
-Dbuild_server=false \ -Dbuild_server=false \
-Dwindows_noconsole=true \ -Dwindows_noconsole=true \
-Doverride_server_path=scrcpy-server.jar ) -Dportable=true )
ninja -C "$(WIN32_NOCONSOLE_BUILD_DIR)" ninja -C "$(WIN32_NOCONSOLE_BUILD_DIR)"
prepare-deps-win64: prepare-deps-win64:
@ -81,7 +81,7 @@ build-win64: prepare-deps-win64
--buildtype release --strip -Db_lto=true \ --buildtype release --strip -Db_lto=true \
-Dcrossbuild_windows=true \ -Dcrossbuild_windows=true \
-Dbuild_server=false \ -Dbuild_server=false \
-Doverride_server_path=scrcpy-server.jar ) -Dportable=true )
ninja -C "$(WIN64_BUILD_DIR)" ninja -C "$(WIN64_BUILD_DIR)"
build-win64-noconsole: prepare-deps-win64 build-win64-noconsole: prepare-deps-win64
@ -92,7 +92,7 @@ build-win64-noconsole: prepare-deps-win64
-Dcrossbuild_windows=true \ -Dcrossbuild_windows=true \
-Dbuild_server=false \ -Dbuild_server=false \
-Dwindows_noconsole=true \ -Dwindows_noconsole=true \
-Doverride_server_path=scrcpy-server.jar ) -Dportable=true )
ninja -C "$(WIN64_NOCONSOLE_BUILD_DIR)" ninja -C "$(WIN64_NOCONSOLE_BUILD_DIR)"
dist-win32: build-server build-win32 build-win32-noconsole dist-win32: build-server build-win32 build-win32-noconsole

View file

@ -93,16 +93,9 @@ conf.set_quoted('SCRCPY_VERSION', meson.project_version())
# the prefix used during configuration (meson --prefix=PREFIX) # the prefix used during configuration (meson --prefix=PREFIX)
conf.set_quoted('PREFIX', get_option('prefix')) conf.set_quoted('PREFIX', get_option('prefix'))
# the path of the server to be used "as is" # build a "portable" version (with scrcpy-server.jar accessible from the
# this is useful for building a "portable" version (with the server in the same # current directory)
# directory as the client) conf.set('PORTABLE', get_option('portable'))
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
# the default client TCP port for the "adb reverse" tunnel # the default client TCP port for the "adb reverse" tunnel
# overridden by option --port # overridden by option --port

View file

@ -12,8 +12,8 @@
#define SOCKET_NAME "scrcpy" #define SOCKET_NAME "scrcpy"
#ifdef OVERRIDE_SERVER_PATH #ifdef PORTABLE
# define DEFAULT_SERVER_PATH OVERRIDE_SERVER_PATH # define DEFAULT_SERVER_PATH "scrcpy-server.jar"
#else #else
# define DEFAULT_SERVER_PATH PREFIX "/share/scrcpy/scrcpy-server.jar" # define DEFAULT_SERVER_PATH PREFIX "/share/scrcpy/scrcpy-server.jar"
#endif #endif

View file

@ -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('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('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('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('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') option('hidpi_support', type: 'boolean', value: true, description: 'Enable High DPI support')