pw_tokenizer: CMake build

Change-Id: I2fef5f7f3a9b5dfb01487ef678aa978875830dc8
diff --git a/pw_tokenizer/CMakeLists.txt b/pw_tokenizer/CMakeLists.txt
new file mode 100644
index 0000000..f9c1280
--- /dev/null
+++ b/pw_tokenizer/CMakeLists.txt
@@ -0,0 +1,117 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+pw_add_module_library(pw_tokenizer
+  SOURCES
+    tokenize.cc
+  PUBLIC_DEPS
+    pw_preprocessor
+    pw_span
+  PRIVATE_DEPS
+    pw_varint
+)
+
+pw_add_module_library(pw_tokenizer.decoder
+  SOURCES
+    decode.cc
+    detokenize.cc
+    token_database.cc
+  PUBLIC_DEPS
+    pw_span
+    pw_tokenizer
+  PRIVATE_DEPS
+    pw_varint
+)
+
+# Executable for generating test data for the C++ and Python detokenizers. This
+# target should only be built for the host.
+add_executable(pw_tokenizer.generate_decoding_test_data EXCLUDE_FROM_ALL
+    generate_decoding_test_data.cc)
+target_link_libraries(pw_tokenizer.generate_decoding_test_data PRIVATE
+    pw_varint pw_tokenizer)
+target_compile_options(pw_tokenizer.generate_decoding_test_data PRIVATE
+    -Wall -Werror)
+
+# Executable for generating a test ELF file for elf_reader_test.py. A host
+# version of this binary is checked in for use in elf_reader_test.py.
+add_executable(pw_tokenizer.elf_reader_test_binary EXCLUDE_FROM_ALL
+    py/elf_reader_test_binary.c)
+target_link_libraries(pw_tokenizer.elf_reader_test_binary PRIVATE
+    -Wl,--unresolved-symbols=ignore-all)  # main is not defined
+set_target_properties(pw_tokenizer.elf_reader_test_binary PROPERTIES
+    OUTPUT_NAME elf_reader_test_binary.elf)
+
+pw_add_test(pw_tokenizer.argument_types_test
+  SOURCES
+    argument_types_test.c
+    argument_types_test.cc
+  DEPS
+    pw_tokenizer
+  GROUPS
+    modules
+    pw_tokenizer
+)
+
+pw_add_test(pw_tokenizer.decode_test
+  SOURCES
+    decode_test.cc
+  DEPS
+    pw_varint
+    pw_tokenizer.decoder
+  GROUPS
+    modules
+    pw_tokenizer
+)
+
+pw_add_test(pw_tokenizer.detokenize_test
+  SOURCES
+    detokenize_test.cc
+  DEPS
+    pw_tokenizer.decoder
+  GROUPS
+    modules
+    pw_tokenizer
+)
+
+pw_add_test(pw_tokenizer.hash_test
+  SOURCES
+    hash_test.cc
+  DEPS
+    pw_tokenizer
+  GROUPS
+    modules
+    pw_tokenizer
+)
+
+pw_add_test(pw_tokenizer.token_database_test
+  SOURCES
+    token_database_test.cc
+  DEPS
+    pw_tokenizer.decoder
+  GROUPS
+    modules
+    pw_tokenizer
+)
+
+pw_add_test(pw_tokenizer.tokenize_test
+  SOURCES
+    tokenize_test.c
+    tokenize_test.cc
+  DEPS
+    pw_varint
+    pw_tokenizer
+  GROUPS
+    modules
+    pw_tokenizer
+)