aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-09-20 13:22:50 +0200
committerDaniel Eklöf <daniel@ekloef.se>2020-09-20 13:22:50 +0200
commit3d4903ee0aab5512dd13ca6affdea0ed583d1a5b (patch)
tree565b2c82f430ad67edfb1b09cbf34dad44838f20 /main.c
parentd384b2b902b55f8de9fdbb826175711f4f61547f (diff)
downloadwbg-3d4903ee0aab5512dd13ca6affdea0ed583d1a5b.tar.gz
make both libpng and libjpeg optional
Diffstat (limited to 'main.c')
-rw-r--r--main.c18
1 files changed, 15 insertions, 3 deletions
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;