build: add a configure switch for building examples
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 7 Dec 2020 19:38:30 +0000 (20:38 +0100)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 14 Dec 2020 14:57:12 +0000 (15:57 +0100)
Example code for bindings is currently always built if bindings are
enabled. Make it conditional with a new configure switch.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
bindings/cxx/Makefile.am
bindings/python/Makefile.am
configure.ac

index 5c40cebf591f10607f22cac7384ad8225a593d26..87463b0d699e62912c30fa41f98280647cc454a0 100644 (file)
@@ -18,10 +18,16 @@ include_HEADERS = gpiod.hpp
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libgpiodcxx.pc
 
-SUBDIRS = . examples
+SUBDIRS = .
 
 if WITH_TESTS
 
 SUBDIRS += tests
 
 endif
+
+if WITH_EXAMPLES
+
+SUBDIRS += examples
+
+endif
index 124f152b6dbb54a676d27e03dc8a9c9cccc28c9f..5403bcba22a0640957b57129ecd1314105e0c17c 100644 (file)
@@ -6,8 +6,6 @@
 # Copyright (C) 2017-2018 Bartosz Golaszewski <bartekgola@gmail.com>
 #
 
-SUBDIRS = . examples
-
 pyexec_LTLIBRARIES = gpiod.la
 
 gpiod_la_SOURCES = gpiodmodule.c
@@ -17,8 +15,16 @@ gpiod_la_CFLAGS += -Wall -Wextra -g -std=gnu89 $(PYTHON_CPPFLAGS)
 gpiod_la_LDFLAGS = -module -avoid-version
 gpiod_la_LIBADD = $(top_builddir)/lib/libgpiod.la $(PYTHON_LIBS)
 
+SUBDIRS = .
+
 if WITH_TESTS
 
 SUBDIRS += tests
 
 endif
+
+if WITH_EXAMPLES
+
+SUBDIRS += examples
+
+endif
index 57c99a861526fdacda3a07002d1a9302607406a9..90a63240ea192fd3e1f87ee5afc7455491d4b402 100644 (file)
@@ -155,6 +155,12 @@ then
        fi
 fi
 
+AC_ARG_ENABLE([examples],
+       [AS_HELP_STRING([--enable-examples], [enable building code examples[default=no]])],
+       [if test "x$enableval" = xyes; then with_examples=true; fi],
+       [with_examples=false])
+AM_CONDITIONAL([WITH_EXAMPLES], [test "x$with_examples" = xtrue])
+
 AC_ARG_ENABLE([bindings-cxx],
        [AS_HELP_STRING([--enable-bindings-cxx],[enable C++ bindings [default=no]])],
        [if test "x$enableval" = xyes; then with_bindings_cxx=true; fi],