Include dependencies version

On --version, also print the dependencies version scrcpy has been
compiled against.
This commit is contained in:
Romain Vimont 2018-02-07 15:01:19 +01:00
parent 9f6464acff
commit 7fe11033cb

View file

@ -4,6 +4,7 @@
#include <unistd.h> #include <unistd.h>
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <SDL2/SDL_net.h>
#include "config.h" #include "config.h"
@ -87,6 +88,17 @@ static void usage(const char *arg0) {
DEFAULT_LOCAL_PORT); DEFAULT_LOCAL_PORT);
} }
static void print_version(void) {
fprintf(stderr, "scrcpy v%s\n\n", SCRCPY_VERSION);
fprintf(stderr, "dependencies:\n");
fprintf(stderr, " - SDL %d.%d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
fprintf(stderr, " - SDL_net %d.%d.%d\n", SDL_NET_MAJOR_VERSION, SDL_NET_MINOR_VERSION, SDL_NET_PATCHLEVEL);
fprintf(stderr, " - libavcodec %d.%d.%d\n", LIBAVCODEC_VERSION_MAJOR, LIBAVCODEC_VERSION_MINOR, LIBAVCODEC_VERSION_MICRO);
fprintf(stderr, " - libavformat %d.%d.%d\n", LIBAVFORMAT_VERSION_MAJOR, LIBAVFORMAT_VERSION_MINOR, LIBAVFORMAT_VERSION_MICRO);
fprintf(stderr, " - libavutil %d.%d.%d\n", LIBAVUTIL_VERSION_MAJOR, LIBAVUTIL_VERSION_MINOR, LIBAVUTIL_VERSION_MICRO);
}
static int parse_args(struct args *args, int argc, char *argv[]) { static int parse_args(struct args *args, int argc, char *argv[]) {
static const struct option long_options[] = { static const struct option long_options[] = {
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
@ -209,7 +221,7 @@ int main(int argc, char *argv[]) {
} }
if (args.version) { if (args.version) {
fprintf(stderr, "scrcpy v%s\n", SCRCPY_VERSION); print_version();
return 0; return 0;
} }