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/frames.c',
R
Romain Vimont 已提交
10
    'src/lockutil.c',
R
Romain Vimont 已提交
11
    'src/netutil.c',
R
Romain Vimont 已提交
12
    'src/scrcpy.c',
13
    'src/screen.c',
14
    'src/screencontrol.c',
R
Romain Vimont 已提交
15
    'src/server.c',
R
Romain Vimont 已提交
16
    'src/strutil.c',
R
Romain Vimont 已提交
17
    'src/tinyxpm.c',
R
Romain Vimont 已提交
18 19 20
]

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

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

34 35
conf = configuration_data()

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

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

R
Romain Vimont 已提交
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
# the prefix used during configuration (meson --prefix=PREFIX)
conf.set('PREFIX', '"' + get_option('prefix') + '"')

# 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
conf.set('PREFIXED_SERVER_JAR', '"/share/scrcpy/scrcpy-server.jar"')

# 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 != ''
    conf.set('OVERRIDE_SERVER_JAR', '"' + override_server_jar + '"')
endif

59 60 61 62 63 64 65 66 67 68 69 70
# 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

71 72 73 74 75
# 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)

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

R
Romain Vimont 已提交
78
executable('scrcpy', src, dependencies: dependencies, install: true)
R
Romain Vimont 已提交
79 80 81 82 83 84


### TESTS

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

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