From 3d4903ee0aab5512dd13ca6affdea0ed583d1a5b Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 20 Sep 2020 13:22:50 +0200 Subject: make both libpng and libjpeg optional --- main.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 8718978..c279805 100644 --- a/main.c +++ b/main.c @@ -20,10 +20,15 @@ #define LOG_MODULE "wbg" #define LOG_ENABLE_DBG 1 #include "log.h" -#include "png-wbg.h" -#include "jpg.h" #include "shm.h" +#if defined(WBG_HAVE_PNG) + #include "png-wbg.h" +#endif +#if defined(WBG_HAVE_JPG) + #include "jpg.h" +#endif + /* Top-level globals */ static struct wl_display *display; static struct wl_registry *registry; @@ -312,9 +317,16 @@ main(int argc, const char *const *argv) } const char *image_path = argv[1]; - image = jpg_load(image_path); + image = NULL; + +#if defined(WBG_HAVE_JPG) + if (image == NULL) + image = jpg_load(image_path); +#endif +#if defined(WBG_HAVE_PNG) if (image == NULL) image = png_load(image_path); +#endif if (image == NULL) { LOG_ERR("%s: failed to load", image_path); return EXIT_FAILURE; -- cgit v1.2.3