meson.build 2.7 KB
Newer Older
R
Romain Vimont 已提交
1
src = [
R
Romain Vimont 已提交
2
    'src/main.c',
R
Romain Vimont 已提交
3
    'src/command.c',
R
Romain Vimont 已提交
4
    'src/controlevent.c',
R
Romain Vimont 已提交
5
    'src/controller.c',
R
Romain Vimont 已提交
6
    'src/convert.c',
R
Romain Vimont 已提交
7
    'src/decoder.c',
8
    'src/device.c',
R
Romain Vimont 已提交
9
    'src/fpscounter.c',
R
Romain Vimont 已提交
10
    'src/frames.c',
R
Romain Vimont 已提交
11
    'src/lockutil.c',
R
Romain Vimont 已提交
12
    'src/netutil.c',
R
Romain Vimont 已提交
13
    'src/scrcpy.c',
14
    'src/screen.c',
15
    'src/screencontrol.c',
R
Romain Vimont 已提交
16
    'src/server.c',
R
Romain Vimont 已提交
17
    'src/strutil.c',
R
Romain Vimont 已提交
18
    'src/tinyxpm.c',
R
Romain Vimont 已提交
19 20 21
]

if host_machine.system() == 'windows'
R
Romain Vimont 已提交
22
    src += [ 'src/sys/win/command.c' ]
R
Romain Vimont 已提交
23
else
R
Romain Vimont 已提交
24
    src += [ 'src/sys/unix/command.c' ]
R
Romain Vimont 已提交
25 26 27 28 29 30 31 32 33 34
endif

dependencies = [
    dependency('libavformat'),
    dependency('libavcodec'),
    dependency('libavutil'),
    dependency('sdl2'),
    dependency('SDL2_net'),
]

35 36
conf = configuration_data()

37 38 39
# expose the build type
conf.set('BUILD_DEBUG', get_option('buildtype') == 'debug')

R
Romain Vimont 已提交
40
# the version, updated on release
R
Romain Vimont 已提交
41
conf.set_quoted('SCRCPY_VERSION', '0.1')
R
Romain Vimont 已提交
42

R
Romain Vimont 已提交
43
# the prefix used during configuration (meson --prefix=PREFIX)
R
Romain Vimont 已提交
44
conf.set_quoted('PREFIX', get_option('prefix'))
R
Romain Vimont 已提交
45 46 47 48

# the path of the server, which will be appended to the prefix
# ignored if OVERRIDE_SERVER_JAR if defined
# must be consistent with the install_dir in server/meson.build
R
Romain Vimont 已提交
49
conf.set_quoted('PREFIXED_SERVER_JAR', '/share/scrcpy/scrcpy-server.jar')
R
Romain Vimont 已提交
50 51 52 53 54 55

# 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_jar = get_option('override_server_jar')
if override_server_jar != ''
R
Romain Vimont 已提交
56 57 58 59
    conf.set_quoted('OVERRIDE_SERVER_JAR', override_server_jar)
else
    # undefine it
    conf.set('OVERRIDE_SERVER_JAR', false)
R
Romain Vimont 已提交
60 61
endif

62 63 64 65 66 67 68 69 70 71 72 73
# the default client TCP port for the "adb reverse" tunnel
# overridden by option --port
conf.set('DEFAULT_LOCAL_PORT', '27183')

# the default max video size for both dimensions, in pixels
# overridden by option --max-size
conf.set('DEFAULT_MAX_SIZE', '0')  # 0: unlimited

# the default video bitrate, in bits/second
# overridden by option --bit-rate
conf.set('DEFAULT_BIT_RATE', '4000000')  # 4Mbps

74 75 76
# whether the app should always display the most recent available frame, even
# if the previous one has not been displayed
# SKIP_FRAMES improves latency at the cost of framerate
77
conf.set('SKIP_FRAMES', get_option('skip_frames'))
78

R
Romain Vimont 已提交
79
configure_file(configuration: conf, output: 'config.h')
80

R
Romain Vimont 已提交
81
executable('scrcpy', src, dependencies: dependencies, install: true)
R
Romain Vimont 已提交
82 83 84 85 86 87


### TESTS

tests = [
    ['test_control_event_queue', ['tests/test_control_event_queue.c', 'src/controlevent.c']],
88
    ['test_control_event_serialize', ['tests/test_control_event_serialize.c', 'src/controlevent.c']],
R
Romain Vimont 已提交
89
    ['test_strutil', ['tests/test_strutil.c', 'src/strutil.c']],
R
Romain Vimont 已提交
90 91 92 93 94 95 96 97
]

src_dir = include_directories('src')

foreach t : tests
    exe = executable(t[0], t[1], include_directories: src_dir, dependencies: dependencies)
    test(t[0], exe)
endforeach