0001-build-add-a-configure-switch-for-building-examples.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. From 5e9e7223a3633ee82b557d21b1f18aa15becd450 Mon Sep 17 00:00:00 2001
  2. From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
  3. Date: Mon, 7 Dec 2020 20:38:30 +0100
  4. Subject: build: add a configure switch for building examples
  5. Example code for bindings is currently always built if bindings are
  6. enabled. Make it conditional with a new configure switch.
  7. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
  8. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  9. [Retrieved from:
  10. https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/commit/?id=5e9e7223a3633ee82b557d21b1f18aa15becd450]
  11. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  12. ---
  13. bindings/cxx/Makefile.am | 8 +++++++-
  14. bindings/python/Makefile.am | 10 ++++++++--
  15. configure.ac | 6 ++++++
  16. 3 files changed, 21 insertions(+), 3 deletions(-)
  17. diff --git a/bindings/cxx/Makefile.am b/bindings/cxx/Makefile.am
  18. index 5c40ceb..87463b0 100644
  19. --- a/bindings/cxx/Makefile.am
  20. +++ b/bindings/cxx/Makefile.am
  21. @@ -18,10 +18,16 @@ include_HEADERS = gpiod.hpp
  22. pkgconfigdir = $(libdir)/pkgconfig
  23. pkgconfig_DATA = libgpiodcxx.pc
  24. -SUBDIRS = . examples
  25. +SUBDIRS = .
  26. if WITH_TESTS
  27. SUBDIRS += tests
  28. endif
  29. +
  30. +if WITH_EXAMPLES
  31. +
  32. +SUBDIRS += examples
  33. +
  34. +endif
  35. diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am
  36. index 124f152..5403bcb 100644
  37. --- a/bindings/python/Makefile.am
  38. +++ b/bindings/python/Makefile.am
  39. @@ -6,8 +6,6 @@
  40. # Copyright (C) 2017-2018 Bartosz Golaszewski <bartekgola@gmail.com>
  41. #
  42. -SUBDIRS = . examples
  43. -
  44. pyexec_LTLIBRARIES = gpiod.la
  45. gpiod_la_SOURCES = gpiodmodule.c
  46. @@ -17,8 +15,16 @@ gpiod_la_CFLAGS += -Wall -Wextra -g -std=gnu89 $(PYTHON_CPPFLAGS)
  47. gpiod_la_LDFLAGS = -module -avoid-version
  48. gpiod_la_LIBADD = $(top_builddir)/lib/libgpiod.la $(PYTHON_LIBS)
  49. +SUBDIRS = .
  50. +
  51. if WITH_TESTS
  52. SUBDIRS += tests
  53. endif
  54. +
  55. +if WITH_EXAMPLES
  56. +
  57. +SUBDIRS += examples
  58. +
  59. +endif
  60. diff --git a/configure.ac b/configure.ac
  61. index 57c99a8..90a6324 100644
  62. --- a/configure.ac
  63. +++ b/configure.ac
  64. @@ -155,6 +155,12 @@ then
  65. fi
  66. fi
  67. +AC_ARG_ENABLE([examples],
  68. + [AS_HELP_STRING([--enable-examples], [enable building code examples[default=no]])],
  69. + [if test "x$enableval" = xyes; then with_examples=true; fi],
  70. + [with_examples=false])
  71. +AM_CONDITIONAL([WITH_EXAMPLES], [test "x$with_examples" = xtrue])
  72. +
  73. AC_ARG_ENABLE([bindings-cxx],
  74. [AS_HELP_STRING([--enable-bindings-cxx],[enable C++ bindings [default=no]])],
  75. [if test "x$enableval" = xyes; then with_bindings_cxx=true; fi],
  76. --
  77. cgit 1.2.3-1.el7