aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Li <benl@squareup.com>2023-03-06 10:45:45 -0800
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2023-03-12 14:37:39 +0100
commit1dd855ae6b7a8dbe0386b15feecbf2a361264456 (patch)
treed41ca3640869b31e4ade04edcc67705c6d9801cb
parent5fa9cb92dfb3bb61f33f8b418f752b87bd2dc665 (diff)
downloadlibgpiod-1dd855ae6b7a8dbe0386b15feecbf2a361264456.tar.gz
contrib: add sample Android.bp to build within an Android tree
Add an Android.bp file for Soong, the Android build system, to build the library including C++ bindings along with all the CLI tools. This reference Android build file will live in a contrib/ folder to indiciate it is a less-maintained part of libgpiod. It will need to be moved to the root directory in order to use it, though, as Soong doesn't let Blueprint files reference sources in a parent directory. error: external/libgpiod/contrib/Android.bp:5:1: module "libgpiod" variant "...": Path is outside directory: ../include error: external/libgpiod/contrib/Android.bp:5:1: module "libgpiod" variant "...": Path is outside directory: ../bindings/cxx error: external/libgpiod/contrib/Android.bp:5:1: module "libgpiod" variant "...": Path is outside directory: ../lib/*.c error: external/libgpiod/contrib/Android.bp:5:1: module "libgpiod" variant "...": Path is outside directory: ../bindings/cxx/*.cpp Signed-off-by: Benjamin Li <benl@squareup.com> [Bartosz: add the build file to the release tarball generated by 'make dist'] Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac1
-rw-r--r--contrib/Android.bp136
-rw-r--r--contrib/Makefile.am4
4 files changed, 142 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 59d87626..3807dca5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,7 @@
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = foreign
-SUBDIRS = include lib
+SUBDIRS = include lib contrib
EXTRA_DIST = \
LICENSES/GPL-2.0-or-later.txt \
diff --git a/configure.ac b/configure.ac
index 131655b1..7d72c247 100644
--- a/configure.ac
+++ b/configure.ac
@@ -267,6 +267,7 @@ AC_CONFIG_FILES([Makefile
include/Makefile
lib/Makefile
lib/libgpiod.pc
+ contrib/Makefile
tools/Makefile
tests/Makefile
tests/gpiosim/Makefile
diff --git a/contrib/Android.bp b/contrib/Android.bp
new file mode 100644
index 00000000..fbc21961
--- /dev/null
+++ b/contrib/Android.bp
@@ -0,0 +1,136 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+// SPDX-FileCopyrightText: 2023 Benjamin Li <benl@squareup.com>
+
+// Instructions:
+// - Check out this repository as external/libgpiod.
+// - Move this build file to the project's root directory.
+
+//
+// libgpiod main library
+//
+
+cc_library {
+ name: "libgpiod",
+ defaults: [
+ "libgpiod_defaults",
+ ],
+ srcs: [
+ "lib/*.c",
+ "bindings/cxx/*.cpp",
+ ],
+ export_include_dirs: [
+ "include",
+ "bindings/cxx",
+ ],
+}
+
+cc_defaults {
+ name: "libgpiod_defaults",
+ device_specific: true,
+ cpp_std: "gnu++17",
+ cflags: [
+ // You may want to edit this with the version from configure.ac of
+ // the release you are using.
+ "-DGPIOD_VERSION_STR=\"unstable\"",
+ ],
+ cppflags: [
+ // Google C++ style is to not use exceptions, but this library does
+ // use them.
+ "-fexceptions",
+ ],
+ // Google C++ style is to not use runtime type information, but this
+ // library does use it.
+ rtti: true,
+}
+
+//
+// libgpiod tools
+//
+
+phony {
+ name: "libgpiod_tools",
+ required: [
+ "gpiodetect",
+ "gpioget",
+ "gpioinfo",
+ "gpiomon",
+ "gpionotify",
+ "gpioset",
+ ],
+}
+
+cc_binary {
+ name: "gpiodetect",
+ defaults: [
+ "libgpiod_defaults",
+ "libgpiod_tools_defaults",
+ ],
+ srcs: [
+ "tools/gpiodetect.c",
+ ],
+}
+
+cc_binary {
+ name: "gpioget",
+ defaults: [
+ "libgpiod_defaults",
+ "libgpiod_tools_defaults",
+ ],
+ srcs: [
+ "tools/gpioget.c",
+ ],
+}
+
+cc_binary {
+ name: "gpioinfo",
+ defaults: [
+ "libgpiod_defaults",
+ "libgpiod_tools_defaults",
+ ],
+ srcs: [
+ "tools/gpioinfo.c",
+ ],
+}
+
+cc_binary {
+ name: "gpiomon",
+ defaults: [
+ "libgpiod_defaults",
+ "libgpiod_tools_defaults",
+ ],
+ srcs: [
+ "tools/gpiomon.c",
+ ],
+}
+
+cc_binary {
+ name: "gpionotify",
+ defaults: [
+ "libgpiod_defaults",
+ "libgpiod_tools_defaults",
+ ],
+ srcs: [
+ "tools/gpionotify.c",
+ ],
+}
+
+cc_binary {
+ name: "gpioset",
+ defaults: [
+ "libgpiod_defaults",
+ "libgpiod_tools_defaults",
+ ],
+ srcs: [
+ "tools/gpioset.c",
+ ],
+}
+
+cc_defaults {
+ name: "libgpiod_tools_defaults",
+ srcs: [
+ "tools/tools-common.c",
+ ],
+ shared_libs: [
+ "libgpiod",
+ ],
+}
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
new file mode 100644
index 00000000..1b50e86b
--- /dev/null
+++ b/contrib/Makefile.am
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# SPDX-FileCopyrightText: 2023 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
+
+EXTRA_DIST = Android.bp