blob: 2500f0012d1970fb71f63c5fb3c75cec5472d37e [file] [log] [blame]
Wyatt Hepler80c6ee52020-01-03 09:54:58 -08001# Copyright 2020 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7# https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
Armando Montanezfb3d3fb2020-06-09 18:12:12 -070015import("//build_overrides/pigweed.gni")
16
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -070017import("$dir_pw_arduino_build/arduino.gni")
Wyatt Hepler6639c452020-05-06 11:43:07 -070018import("$dir_pw_build/facade.gni")
Wyatt Hepler86632c72020-10-15 08:45:50 -070019import("$dir_pw_build/module_config.gni")
Alexei Frolovedd2f142020-06-09 19:11:27 -070020import("$dir_pw_build/target_types.gni")
Wyatt Hepler80c6ee52020-01-03 09:54:58 -080021import("$dir_pw_docgen/docs.gni")
karthik bharadwajeabe9a22020-04-14 09:28:28 -070022import("$dir_pw_fuzzer/fuzzer.gni")
Wyatt Heplerde20d742021-06-02 23:34:14 -070023import("$dir_pw_protobuf_compiler/proto.gni")
Wyatt Hepler80c6ee52020-01-03 09:54:58 -080024import("$dir_pw_unit_test/test.gni")
Alexei Frolov4c0428a2020-06-10 10:46:04 -070025import("backend.gni")
Wyatt Heplerd49f8fe2020-10-15 10:13:47 -070026
Wyatt Hepler86632c72020-10-15 08:45:50 -070027declare_args() {
28 # The build target that overrides the default configuration options for this
29 # module. This should point to a source set that provides defines through a
30 # public config (which may -include a file or add defines directly).
31 pw_tokenizer_CONFIG = pw_build_DEFAULT_MODULE_CONFIG
32}
33
34config("public_include_path") {
Wyatt Hepler80c6ee52020-01-03 09:54:58 -080035 include_dirs = [ "public" ]
Wyatt Hepler86632c72020-10-15 08:45:50 -070036 visibility = [ ":*" ]
37}
38
Wyatt Hepler3a8df982020-11-03 14:06:28 -080039config("linker_script") {
40 inputs = [ "pw_tokenizer_linker_sections.ld" ]
41
42 # Automatically add the tokenizer linker sections when cross-compiling or
43 # building for Linux. macOS and Windows executables are not supported.
44 if (current_os == "") {
45 ldflags = [
46 "-T",
Michael Spangc8b93902021-05-30 15:53:56 -040047 rebase_path("pw_tokenizer_linker_sections.ld", root_build_dir),
Wyatt Hepler3a8df982020-11-03 14:06:28 -080048 ]
Wyatt Hepler1df2e5b2021-01-28 12:39:22 -080049 } else if (current_os == "linux" && !pw_toolchain_OSS_FUZZ_ENABLED) {
Wyatt Hepler3a8df982020-11-03 14:06:28 -080050 # When building for Linux, the linker provides a default linker script.
51 # The add_tokenizer_sections_to_default_script.ld wrapper includes the
52 # pw_tokenizer_linker_sections.ld script in a way that appends to the the
53 # default linker script instead of overriding it.
54 ldflags = [
55 "-T",
Michael Spangc8b93902021-05-30 15:53:56 -040056 rebase_path("add_tokenizer_sections_to_default_script.ld",
57 root_build_dir),
Wyatt Hepler3a8df982020-11-03 14:06:28 -080058 ]
Michael Spangc8b93902021-05-30 15:53:56 -040059 lib_dirs = [ "." ]
60
Wyatt Hepler3a8df982020-11-03 14:06:28 -080061 inputs += [ "add_tokenizer_sections_to_default_script.ld" ]
62 }
63 visibility = [ ":*" ]
64}
65
Wyatt Hepler86632c72020-10-15 08:45:50 -070066pw_source_set("config") {
67 public = [ "public/pw_tokenizer/config.h" ]
68 public_configs = [ ":public_include_path" ]
69 public_deps = [ pw_tokenizer_CONFIG ]
Wyatt Hepler80c6ee52020-01-03 09:54:58 -080070}
71
Alexei Frolovedd2f142020-06-09 19:11:27 -070072pw_source_set("pw_tokenizer") {
Wyatt Hepler86632c72020-10-15 08:45:50 -070073 public_configs = [ ":public_include_path" ]
Wyatt Hepler3a8df982020-11-03 14:06:28 -080074 all_dependent_configs = [ ":linker_script" ]
Wyatt Hepler80c6ee52020-01-03 09:54:58 -080075 public_deps = [
Wyatt Hepler86632c72020-10-15 08:45:50 -070076 ":config",
Wyatt Hepler6639c452020-05-06 11:43:07 -070077 dir_pw_preprocessor,
Wyatt Hepler80c6ee52020-01-03 09:54:58 -080078 ]
Wyatt Hepler6639c452020-05-06 11:43:07 -070079 deps = [ dir_pw_varint ]
Wyatt Hepler80c6ee52020-01-03 09:54:58 -080080 public = [
Wyatt Hepler7c8b3392021-04-05 18:00:24 -070081 "public/pw_tokenizer/encode_args.h",
Wyatt Heplereb020a12020-10-28 14:01:51 -070082 "public/pw_tokenizer/hash.h",
Wyatt Hepler80c6ee52020-01-03 09:54:58 -080083 "public/pw_tokenizer/tokenize.h",
84 ]
85 sources = [
Wyatt Hepler6639c452020-05-06 11:43:07 -070086 "encode_args.cc",
Wyatt Hepler656fac62020-10-28 14:30:59 -070087 "hash.cc",
Wyatt Hepler80c6ee52020-01-03 09:54:58 -080088 "public/pw_tokenizer/internal/argument_types.h",
89 "public/pw_tokenizer/internal/argument_types_macro_4_byte.h",
90 "public/pw_tokenizer/internal/argument_types_macro_8_byte.h",
91 "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_128_hash_macro.h",
Wyatt Hepler63c9bee2021-02-23 11:37:15 -080092 "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_256_hash_macro.h",
Wyatt Hepler80c6ee52020-01-03 09:54:58 -080093 "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_80_hash_macro.h",
94 "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_96_hash_macro.h",
95 "public/pw_tokenizer/internal/tokenize_string.h",
96 "tokenize.cc",
97 ]
Wyatt Heplera8557ef2020-05-04 16:29:23 -070098 friend = [ ":*" ]
Wyatt Hepler80c6ee52020-01-03 09:54:58 -080099}
100
Wyatt Hepler6639c452020-05-06 11:43:07 -0700101# As a temporary workaround, if no backend is set, use an empty test backend so
102# that the test can define the handler function.
103# TODO(hepler): Switch this to a facade test when available.
Alexei Frolov4c0428a2020-06-10 10:46:04 -0700104if (pw_tokenizer_GLOBAL_HANDLER_BACKEND == "" &&
105 pw_tokenizer_GLOBAL_HANDLER_WITH_PAYLOAD_BACKEND == "") {
Wyatt Hepler6639c452020-05-06 11:43:07 -0700106 # This is an empty library to use as the backend for global_handler and
107 # global_handler_with_payload tests.
Alexei Frolovedd2f142020-06-09 19:11:27 -0700108 pw_source_set("test_backend") {
Wyatt Hepler6639c452020-05-06 11:43:07 -0700109 visibility = [ ":*" ]
110 }
111
Alexei Frolov4c0428a2020-06-10 10:46:04 -0700112 pw_tokenizer_GLOBAL_HANDLER_BACKEND = ":test_backend"
113 pw_tokenizer_GLOBAL_HANDLER_WITH_PAYLOAD_BACKEND = ":test_backend"
Wyatt Hepler6639c452020-05-06 11:43:07 -0700114
115 enable_global_handler_test = true
116} else {
117 enable_global_handler_test = false
118}
119
120pw_facade("global_handler") {
Alexei Frolov4c0428a2020-06-10 10:46:04 -0700121 backend = pw_tokenizer_GLOBAL_HANDLER_BACKEND
Wyatt Hepler6639c452020-05-06 11:43:07 -0700122
Wyatt Hepler86632c72020-10-15 08:45:50 -0700123 public_configs = [ ":public_include_path" ]
Wyatt Hepler6639c452020-05-06 11:43:07 -0700124 public = [ "public/pw_tokenizer/tokenize_to_global_handler.h" ]
125 sources = [ "tokenize_to_global_handler.cc" ]
126 public_deps = [ ":pw_tokenizer" ]
127}
128
129pw_facade("global_handler_with_payload") {
Alexei Frolov4c0428a2020-06-10 10:46:04 -0700130 backend = pw_tokenizer_GLOBAL_HANDLER_WITH_PAYLOAD_BACKEND
Wyatt Hepler6639c452020-05-06 11:43:07 -0700131
Wyatt Hepler86632c72020-10-15 08:45:50 -0700132 public_configs = [ ":public_include_path" ]
Wyatt Hepler6639c452020-05-06 11:43:07 -0700133 public = [ "public/pw_tokenizer/tokenize_to_global_handler_with_payload.h" ]
134 sources = [ "tokenize_to_global_handler_with_payload.cc" ]
135 public_deps = [ ":pw_tokenizer" ]
136}
137
Alexei Frolovedd2f142020-06-09 19:11:27 -0700138pw_source_set("base64") {
Wyatt Hepler86632c72020-10-15 08:45:50 -0700139 public_configs = [ ":public_include_path" ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800140 public = [ "public/pw_tokenizer/base64.h" ]
Wyatt Heplera8557ef2020-05-04 16:29:23 -0700141 sources = [ "base64.cc" ]
Wyatt Hepler3c2e9522020-01-09 16:08:54 -0800142 public_deps = [
Wyatt Heplercdafbb42020-10-05 11:51:05 -0700143 ":pw_tokenizer",
144 dir_pw_base64,
Wyatt Hepler6639c452020-05-06 11:43:07 -0700145 dir_pw_preprocessor,
Wyatt Hepler3c2e9522020-01-09 16:08:54 -0800146 ]
Wyatt Hepler3c2e9522020-01-09 16:08:54 -0800147}
148
Alexei Frolovedd2f142020-06-09 19:11:27 -0700149pw_source_set("decoder") {
Wyatt Hepler86632c72020-10-15 08:45:50 -0700150 public_configs = [ ":public_include_path" ]
Wyatt Hepler6639c452020-05-06 11:43:07 -0700151 deps = [ dir_pw_varint ]
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800152 public = [
153 "public/pw_tokenizer/detokenize.h",
154 "public/pw_tokenizer/token_database.h",
155 ]
156 sources = [
157 "decode.cc",
158 "detokenize.cc",
159 "public/pw_tokenizer/internal/decode.h",
160 "token_database.cc",
161 ]
Wyatt Heplera8557ef2020-05-04 16:29:23 -0700162 friend = [ ":*" ]
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800163}
164
165# Executable for generating test data for the C++ and Python detokenizers. This
166# target should only be built for the host.
Alexei Frolov2e55ee22020-06-17 17:00:10 -0700167pw_executable("generate_decoding_test_data") {
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800168 deps = [
169 ":decoder",
170 ":pw_tokenizer",
Wyatt Hepler6639c452020-05-06 11:43:07 -0700171 dir_pw_varint,
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800172 ]
Ewout van Bekkume4d7b692020-10-15 13:12:30 -0700173 sources = [ "generate_decoding_test_data.cc" ]
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800174}
175
Wyatt Heplerbc254972020-01-06 18:35:30 -0800176# Executable for generating a test ELF file for elf_reader_test.py. A host
177# version of this binary is checked in for use in elf_reader_test.py.
Alexei Frolov2e55ee22020-06-17 17:00:10 -0700178pw_executable("elf_reader_test_binary") {
Wyatt Heplerbc254972020-01-06 18:35:30 -0800179 deps = [
180 ":pw_tokenizer",
181 "$dir_pw_varint",
182 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800183 sources = [ "py/elf_reader_test_binary.c" ]
Wyatt Heplerbc254972020-01-06 18:35:30 -0800184 ldflags = [ "-Wl,--unresolved-symbols=ignore-all" ] # main is not defined
185}
186
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800187pw_test_group("tests") {
188 tests = [
189 ":argument_types_test",
Wyatt Hepler3c2e9522020-01-09 16:08:54 -0800190 ":base64_test",
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800191 ":decode_test",
karthik bharadwajeabe9a22020-04-14 09:28:28 -0700192 ":detokenize_fuzzer",
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800193 ":detokenize_test",
Wyatt Hepler6639c452020-05-06 11:43:07 -0700194 ":global_handlers_test",
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800195 ":hash_test",
Wyatt Heplera6d5cc62020-01-17 14:15:40 -0800196 ":simple_tokenize_test_cpp11",
197 ":simple_tokenize_test_cpp14",
198 ":simple_tokenize_test_cpp17",
karthik bharadwaj2ee244b2020-04-16 14:08:22 -0700199 ":token_database_fuzzer",
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800200 ":token_database_test",
201 ":tokenize_test",
202 ]
Wyatt Hepler7abd8cc2021-01-19 16:49:33 -0800203 group_deps = [ "$dir_pw_preprocessor:tests" ]
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800204}
205
206pw_test("argument_types_test") {
207 sources = [
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800208 "argument_types_test.cc",
Michael Spanga99220e2020-06-11 20:07:16 -0400209 "argument_types_test_c.c",
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800210 "pw_tokenizer_private/argument_types_test.h",
211 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800212 deps = [ ":pw_tokenizer" ]
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -0700213
Anthony DiGirolamo383be052020-11-26 12:06:41 -0800214 if (pw_arduino_build_CORE_PATH != "") {
Anthony DiGirolamoeea0d772020-08-06 12:00:36 -0700215 remove_configs = [ "$dir_pw_build:strict_warnings" ]
216 }
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800217}
218
Wyatt Hepler3c2e9522020-01-09 16:08:54 -0800219pw_test("base64_test") {
Rob Mohra0ba54f2020-02-27 11:43:49 -0800220 sources = [ "base64_test.cc" ]
221 deps = [ ":base64" ]
Wyatt Hepler3c2e9522020-01-09 16:08:54 -0800222}
223
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800224pw_test("decode_test") {
225 sources = [
226 "decode_test.cc",
227 "pw_tokenizer_private/tokenized_string_decoding_test_data.h",
228 "pw_tokenizer_private/varint_decoding_test_data.h",
229 ]
230 deps = [
231 ":decoder",
232 "$dir_pw_varint",
233 ]
Anthony DiGirolamob5079172020-11-05 12:59:50 -0800234
235 # TODO(tonymd): This fails on Teensyduino 1.54 beta core. It may be related to
236 # linking in stl functions. Will debug when 1.54 is released.
237 enable_if = pw_build_EXECUTABLE_TARGET_TYPE != "arduino_executable"
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800238}
239
240pw_test("detokenize_test") {
Rob Mohra0ba54f2020-02-27 11:43:49 -0800241 sources = [ "detokenize_test.cc" ]
242 deps = [ ":decoder" ]
Anthony DiGirolamob5079172020-11-05 12:59:50 -0800243
244 # TODO(tonymd): This fails on Teensyduino 1.54 beta core. It may be related to
245 # linking in stl functions. Will debug when 1.54 is released.
246 enable_if = pw_build_EXECUTABLE_TARGET_TYPE != "arduino_executable"
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800247}
248
Wyatt Hepler6639c452020-05-06 11:43:07 -0700249pw_test("global_handlers_test") {
250 sources = [
Wyatt Hepler6639c452020-05-06 11:43:07 -0700251 "global_handlers_test.cc",
Michael Spanga99220e2020-06-11 20:07:16 -0400252 "global_handlers_test_c.c",
Wyatt Hepler6639c452020-05-06 11:43:07 -0700253 "pw_tokenizer_private/tokenize_test.h",
254 ]
255 deps = [
256 ":global_handler",
257 ":global_handler_with_payload",
258 ]
259
260 # TODO(hepler): Switch this to a facade test when available.
261 enable_if = enable_global_handler_test
262}
263
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800264pw_test("hash_test") {
265 sources = [
266 "hash_test.cc",
267 "pw_tokenizer_private/generated_hash_test_cases.h",
268 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800269 deps = [ ":pw_tokenizer" ]
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800270}
271
Wyatt Heplera6d5cc62020-01-17 14:15:40 -0800272# Fully test C++11 and C++14 compatibility by compiling all sources as C++11 or
273# C++14.
274_simple_tokenize_test_sources = [
Rob Mohra0ba54f2020-02-27 11:43:49 -0800275 "$dir_pw_varint/public/pw_varint/varint.h",
276 "$dir_pw_varint/varint.cc",
Wyatt Hepler6639c452020-05-06 11:43:07 -0700277 "encode_args.cc",
Wyatt Heplera6d5cc62020-01-17 14:15:40 -0800278 "public/pw_tokenizer/config.h",
Wyatt Hepler7c8b3392021-04-05 18:00:24 -0700279 "public/pw_tokenizer/encode_args.h",
Wyatt Heplereb020a12020-10-28 14:01:51 -0700280 "public/pw_tokenizer/hash.h",
Wyatt Heplera6d5cc62020-01-17 14:15:40 -0800281 "public/pw_tokenizer/internal/argument_types.h",
282 "public/pw_tokenizer/internal/argument_types_macro_4_byte.h",
283 "public/pw_tokenizer/internal/argument_types_macro_8_byte.h",
284 "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_128_hash_macro.h",
285 "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_80_hash_macro.h",
286 "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_96_hash_macro.h",
287 "public/pw_tokenizer/internal/tokenize_string.h",
Rob Mohra0ba54f2020-02-27 11:43:49 -0800288 "public/pw_tokenizer/tokenize.h",
Wyatt Hepler6639c452020-05-06 11:43:07 -0700289 "public/pw_tokenizer/tokenize_to_global_handler.h",
290 "public/pw_tokenizer/tokenize_to_global_handler_with_payload.h",
Wyatt Heplera6d5cc62020-01-17 14:15:40 -0800291 "simple_tokenize_test.cc",
Rob Mohra0ba54f2020-02-27 11:43:49 -0800292 "tokenize.cc",
Wyatt Hepler6639c452020-05-06 11:43:07 -0700293 "tokenize_to_global_handler.cc",
294 "tokenize_to_global_handler_with_payload.cc",
Wyatt Heplera6d5cc62020-01-17 14:15:40 -0800295]
296_simple_tokenize_test_configs = [
Wyatt Hepler86632c72020-10-15 08:45:50 -0700297 ":public_include_path",
Wyatt Heplera6d5cc62020-01-17 14:15:40 -0800298 "$dir_pw_varint:default_config",
299]
300
301pw_test("simple_tokenize_test_cpp11") {
Alexei Frolov844ff0f2020-05-06 12:15:29 -0700302 remove_configs = [ "$dir_pw_build:cpp17" ]
Wyatt Heplera6d5cc62020-01-17 14:15:40 -0800303 configs = [ "$dir_pw_build:cpp11" ] + _simple_tokenize_test_configs
304 sources = _simple_tokenize_test_sources
Rob Mohra0ba54f2020-02-27 11:43:49 -0800305 deps = [ dir_pw_preprocessor ]
Wyatt Heplera6d5cc62020-01-17 14:15:40 -0800306}
307
308pw_test("simple_tokenize_test_cpp14") {
Alexei Frolov844ff0f2020-05-06 12:15:29 -0700309 remove_configs = [ "$dir_pw_build:cpp17" ]
Wyatt Heplera6d5cc62020-01-17 14:15:40 -0800310 configs = [ "$dir_pw_build:cpp14" ] + _simple_tokenize_test_configs
311 sources = _simple_tokenize_test_sources
Rob Mohra0ba54f2020-02-27 11:43:49 -0800312 deps = [ dir_pw_preprocessor ]
Wyatt Heplera6d5cc62020-01-17 14:15:40 -0800313}
314
315pw_test("simple_tokenize_test_cpp17") {
Alexei Frolov844ff0f2020-05-06 12:15:29 -0700316 configs = _simple_tokenize_test_configs
Wyatt Heplera6d5cc62020-01-17 14:15:40 -0800317 sources = _simple_tokenize_test_sources
Rob Mohra0ba54f2020-02-27 11:43:49 -0800318 deps = [ dir_pw_preprocessor ]
Wyatt Heplera6d5cc62020-01-17 14:15:40 -0800319}
320
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800321pw_test("token_database_test") {
Rob Mohra0ba54f2020-02-27 11:43:49 -0800322 sources = [ "token_database_test.cc" ]
323 deps = [ ":decoder" ]
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800324}
325
326pw_test("tokenize_test") {
327 sources = [
328 "pw_tokenizer_private/tokenize_test.h",
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800329 "tokenize_test.cc",
Michael Spanga99220e2020-06-11 20:07:16 -0400330 "tokenize_test_c.c",
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800331 ]
332 deps = [
333 ":pw_tokenizer",
334 "$dir_pw_varint",
335 ]
336}
337
karthik bharadwaj2ee244b2020-04-16 14:08:22 -0700338pw_fuzzer("token_database_fuzzer") {
339 sources = [ "token_database_fuzzer.cc" ]
340 deps = [
341 ":decoder",
342 "$dir_pw_fuzzer",
343 "$dir_pw_preprocessor",
karthik bharadwaj2ee244b2020-04-16 14:08:22 -0700344 ]
345}
346
karthik bharadwajeabe9a22020-04-14 09:28:28 -0700347pw_fuzzer("detokenize_fuzzer") {
348 sources = [ "detokenize_fuzzer.cc" ]
349 deps = [
350 ":decoder",
351 "$dir_pw_fuzzer",
352 "$dir_pw_preprocessor",
353 ]
354}
355
Wyatt Heplerde20d742021-06-02 23:34:14 -0700356pw_proto_library("proto") {
357 sources = [ "options.proto" ]
358 prefix = "pw_tokenizer/proto"
359 python_package = "py"
360}
361
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800362declare_args() {
Alexei Frolov4c0428a2020-06-10 10:46:04 -0700363 # pw_JAVA_NATIVE_INTERFACE_INCLUDE_DIRS specifies the paths to use for
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800364 # building Java Native Interface libraries. If no paths are provided, targets
365 # that require JNI may not build correctly.
366 #
367 # Example JNI include paths for a Linux system:
368 #
Alexei Frolov4c0428a2020-06-10 10:46:04 -0700369 # pw_JAVA_NATIVE_INTERFACE_INCLUDE_DIRS = [
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800370 # "/usr/local/buildtools/java/jdk/include/",
371 # "/usr/local/buildtools/java/jdk/include/linux",
372 # ]
373 #
Alexei Frolov4c0428a2020-06-10 10:46:04 -0700374 pw_JAVA_NATIVE_INTERFACE_INCLUDE_DIRS = []
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800375}
376
377# Create a shared library for the tokenizer JNI wrapper. The include paths for
378# the JNI headers must be available in the system or provided with the
Alexei Frolov4c0428a2020-06-10 10:46:04 -0700379# pw_JAVA_NATIVE_INTERFACE_INCLUDE_DIRS variable.
Alexei Frolovedd2f142020-06-09 19:11:27 -0700380pw_shared_library("detokenizer_jni") {
Wyatt Hepler86632c72020-10-15 08:45:50 -0700381 public_configs = [ ":public_include_path" ]
Alexei Frolov4c0428a2020-06-10 10:46:04 -0700382 include_dirs = pw_JAVA_NATIVE_INTERFACE_INCLUDE_DIRS
Rob Mohra0ba54f2020-02-27 11:43:49 -0800383 sources = [ "java/dev/pigweed/tokenizer/detokenizer.cc" ]
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800384 public_deps = [
385 ":decoder",
386 "$dir_pw_preprocessor",
387 ]
388}
389
390pw_doc_group("docs") {
Wyatt Heplerde20d742021-06-02 23:34:14 -0700391 sources = [
392 "docs.rst",
393 "proto.rst",
394 ]
Wyatt Heplerf5e984a2020-04-15 18:15:09 -0700395 inputs = [ "py/pw_tokenizer/encode.py" ]
Wyatt Hepler80c6ee52020-01-03 09:54:58 -0800396}