Use meson to configure default values

Make meson generate config.h with configured values.
This commit is contained in:
Romain Vimont 2018-02-07 12:02:15 +01:00
parent cb7e29180f
commit 53ff1aa410
2 changed files with 17 additions and 3 deletions

View file

@ -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)

View file

@ -5,9 +5,7 @@
#include <libavformat/avformat.h>
#include <SDL2/SDL.h>
#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;