Add static build option

Use static dependencies if the option is set.
This commit is contained in:
Romain Vimont 2024-11-21 23:28:33 +01:00
parent d2e8f93a73
commit 79e79cc765
2 changed files with 10 additions and 7 deletions

View File

@ -109,20 +109,22 @@ endif
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
static = get_option('static')
dependencies = [ dependencies = [
dependency('libavformat', version: '>= 57.33'), dependency('libavformat', version: '>= 57.33', static: static),
dependency('libavcodec', version: '>= 57.37'), dependency('libavcodec', version: '>= 57.37', static: static),
dependency('libavutil'), dependency('libavutil', static: static),
dependency('libswresample'), dependency('libswresample', static: static),
dependency('sdl2', version: '>= 2.0.5'), dependency('sdl2', version: '>= 2.0.5', static: static),
] ]
if v4l2_support if v4l2_support
dependencies += dependency('libavdevice') dependencies += dependency('libavdevice', static: static)
endif endif
if usb_support if usb_support
dependencies += dependency('libusb-1.0') dependencies += dependency('libusb-1.0', static: static)
endif endif
if host_machine.system() == 'windows' if host_machine.system() == 'windows'

View File

@ -2,6 +2,7 @@ option('compile_app', type: 'boolean', value: true, description: 'Build the clie
option('compile_server', type: 'boolean', value: true, description: 'Build the server') option('compile_server', type: 'boolean', value: true, description: 'Build the server')
option('prebuilt_server', type: 'string', description: 'Path of the prebuilt server') option('prebuilt_server', type: 'string', description: 'Path of the prebuilt server')
option('portable', type: 'boolean', value: false, description: 'Use scrcpy-server from the same directory as the scrcpy executable') option('portable', type: 'boolean', value: false, description: 'Use scrcpy-server from the same directory as the scrcpy executable')
option('static', type: 'boolean', value: false, description: 'Use static dependencies')
option('server_debugger', type: 'boolean', value: false, description: 'Run a server debugger and wait for a client to be attached') option('server_debugger', type: 'boolean', value: false, description: 'Run a server debugger and wait for a client to be attached')
option('server_debugger_method', type: 'combo', choices: ['old', 'new'], value: 'new', description: 'Select the debugger method (Android < 9: "old", Android >= 9: "new")') option('server_debugger_method', type: 'combo', choices: ['old', 'new'], value: 'new', description: 'Select the debugger method (Android < 9: "old", Android >= 9: "new")')
option('v4l2', type: 'boolean', value: true, description: 'Enable V4L2 feature when supported') option('v4l2', type: 'boolean', value: true, description: 'Enable V4L2 feature when supported')