| 1 |
// SPDX-License-Identifier: GPL-2.0-or-later |
| 2 |
// SPDX-FileCopyrightText: 2023 Benjamin Li <[email protected]> |
| 3 |
|
| 4 |
// Instructions: |
| 5 |
// - Check out this repository as external/libgpiod. |
| 6 |
// - Move this build file to the project's root directory. |
| 7 |
|
| 8 |
// |
| 9 |
// libgpiod main library |
| 10 |
// |
| 11 |
|
| 12 |
cc_library { |
| 13 |
name: "libgpiod", |
| 14 |
defaults: [ |
| 15 |
"libgpiod_defaults", |
| 16 |
], |
| 17 |
srcs: [ |
| 18 |
"lib/*.c", |
| 19 |
"bindings/cxx/*.cpp", |
| 20 |
], |
| 21 |
export_include_dirs: [ |
| 22 |
"include", |
| 23 |
"bindings/cxx", |
| 24 |
], |
| 25 |
} |
| 26 |
|
| 27 |
cc_defaults { |
| 28 |
name: "libgpiod_defaults", |
| 29 |
device_specific: true, |
| 30 |
cpp_std: "gnu++17", |
| 31 |
cflags: [ |
| 32 |
// You may want to edit this with the version from configure.ac of |
| 33 |
// the release you are using. |
| 34 |
"-DGPIOD_VERSION_STR=\"unstable\"", |
| 35 |
], |
| 36 |
cppflags: [ |
| 37 |
// Google C++ style is to not use exceptions, but this library does |
| 38 |
// use them. |
| 39 |
"-fexceptions", |
| 40 |
], |
| 41 |
// Google C++ style is to not use runtime type information, but this |
| 42 |
// library does use it. |
| 43 |
rtti: true, |
| 44 |
} |
| 45 |
|
| 46 |
// |
| 47 |
// libgpiod tools |
| 48 |
// |
| 49 |
|
| 50 |
phony { |
| 51 |
name: "libgpiod_tools", |
| 52 |
required: [ |
| 53 |
"gpiodetect", |
| 54 |
"gpioget", |
| 55 |
"gpioinfo", |
| 56 |
"gpiomon", |
| 57 |
"gpionotify", |
| 58 |
"gpioset", |
| 59 |
], |
| 60 |
} |
| 61 |
|
| 62 |
cc_binary { |
| 63 |
name: "gpiodetect", |
| 64 |
defaults: [ |
| 65 |
"libgpiod_defaults", |
| 66 |
"libgpiod_tools_defaults", |
| 67 |
], |
| 68 |
srcs: [ |
| 69 |
"tools/gpiodetect.c", |
| 70 |
], |
| 71 |
} |
| 72 |
|
| 73 |
cc_binary { |
| 74 |
name: "gpioget", |
| 75 |
defaults: [ |
| 76 |
"libgpiod_defaults", |
| 77 |
"libgpiod_tools_defaults", |
| 78 |
], |
| 79 |
srcs: [ |
| 80 |
"tools/gpioget.c", |
| 81 |
], |
| 82 |
} |
| 83 |
|
| 84 |
cc_binary { |
| 85 |
name: "gpioinfo", |
| 86 |
defaults: [ |
| 87 |
"libgpiod_defaults", |
| 88 |
"libgpiod_tools_defaults", |
| 89 |
], |
| 90 |
srcs: [ |
| 91 |
"tools/gpioinfo.c", |
| 92 |
], |
| 93 |
} |
| 94 |
|
| 95 |
cc_binary { |
| 96 |
name: "gpiomon", |
| 97 |
defaults: [ |
| 98 |
"libgpiod_defaults", |
| 99 |
"libgpiod_tools_defaults", |
| 100 |
], |
| 101 |
srcs: [ |
| 102 |
"tools/gpiomon.c", |
| 103 |
], |
| 104 |
} |
| 105 |
|
| 106 |
cc_binary { |
| 107 |
name: "gpionotify", |
| 108 |
defaults: [ |
| 109 |
"libgpiod_defaults", |
| 110 |
"libgpiod_tools_defaults", |
| 111 |
], |
| 112 |
srcs: [ |
| 113 |
"tools/gpionotify.c", |
| 114 |
], |
| 115 |
} |
| 116 |
|
| 117 |
cc_binary { |
| 118 |
name: "gpioset", |
| 119 |
defaults: [ |
| 120 |
"libgpiod_defaults", |
| 121 |
"libgpiod_tools_defaults", |
| 122 |
], |
| 123 |
srcs: [ |
| 124 |
"tools/gpioset.c", |
| 125 |
], |
| 126 |
} |
| 127 |
|
| 128 |
cc_defaults { |
| 129 |
name: "libgpiod_tools_defaults", |
| 130 |
srcs: [ |
| 131 |
"tools/tools-common.c", |
| 132 |
], |
| 133 |
shared_libs: [ |
| 134 |
"libgpiod", |
| 135 |
], |
| 136 |
} |