From 53ff1aa410f7fb38ff9d0640cd4a10063522cbf4 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 7 Feb 2018 12:02:15 +0100 Subject: [PATCH] Use meson to configure default values Make meson generate config.h with configured values. --- app/meson.build | 16 ++++++++++++++++ app/src/main.c | 4 +--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/meson.build b/app/meson.build index a9a7ae90..4536aab4 100644 --- a/app/meson.build +++ b/app/meson.build @@ -30,6 +30,22 @@ dependencies = [ dependency('SDL2_net'), ] +conf = configuration_data() + +# 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 + +configure_file(configuration: conf, output: 'config.h') + executable('scrcpy', src, dependencies: dependencies) diff --git a/app/src/main.c b/app/src/main.c index 7ab41b75..4fe4e9a9 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -5,9 +5,7 @@ #include #include -#define DEFAULT_LOCAL_PORT 27183 -#define DEFAULT_MAX_SIZE 0 // unlimited -#define DEFAULT_BIT_RATE 4000000 // 4Mbps +#include "config.h" struct args { const char *serial;