meson.build 2.1 KB
Newer Older
R
Romain Vimont 已提交
1 2 3
project('scrcpy-app', 'c')

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

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

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

36 37
conf = configuration_data()

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

R
Romain Vimont 已提交
41
# the version, updated on release
42 43
# (conf.set_quoted() is not available on old versions of meson)
conf.set('SCRCPY_VERSION', '"0.1"')
R
Romain Vimont 已提交
44

45 46 47 48 49 50 51 52 53 54 55 56
# 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

57 58 59 60 61
# 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
conf.set('SKIP_FRAMES', true)

62
configure_file(configuration: conf, input: 'src/config.h.in', output: 'config.h')
63

R
Romain Vimont 已提交
64
executable('scrcpy', src, dependencies: dependencies)
R
Romain Vimont 已提交
65 66 67 68 69 70


### TESTS

tests = [
    ['test_control_event_queue', ['tests/test_control_event_queue.c', 'src/controlevent.c']],
71
    ['test_control_event_serialize', ['tests/test_control_event_serialize.c', 'src/controlevent.c']],
R
Romain Vimont 已提交
72
    ['test_strutil', ['tests/test_strutil.c', 'src/strutil.c']],
R
Romain Vimont 已提交
73 74 75 76 77 78 79 80
]

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