blob: 5b1766d1cd05a8aa032bcd52ccbc32ace84b5b16 [file] [log] [blame]
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//common-mk/mojom_bindings_generator.gni")
import("//common-mk/pkg_config.gni")
import("//common-mk/proto_library.gni")
group("all") {
deps = [
":ml_cmdline",
":ml_service",
]
if (use.test) {
deps += [
":ml_cmdline_test",
":ml_service_test",
]
}
if (use.fuzzer) {
deps += [
":ml_service_impl_fuzzer",
":ml_service_load_flatbuffer_fuzzer",
]
}
}
generate_mojom_bindings("ml_mojo_bindings") {
mojo_root = "${platform2_root}"
sources = [
"mojom/graph_executor.mojom",
"mojom/handwriting_recognizer.mojom",
"mojom/machine_learning_service.mojom",
"mojom/model.mojom",
"mojom/tensor.mojom",
"mojom/text_classifier.mojom",
"mojom/time.mojom",
]
mojo_extra_args = [
"--typemap",
rebase_path("mojom/type_mappings.json"),
]
}
source_set("ml_mojo_bindings_lib") {
sources = [ "mojom/time_mojom_traits.h" ]
public_deps = [ ":ml_mojo_bindings" ]
}
pkg_config("ml_common_pkg_deps") {
pkg_deps = [
"libbrillo",
"libchrome-${libbase_ver}",
"libmetrics-${libbase_ver}",
"libmojo-${libbase_ver}",
"zlib",
]
}
proto_library("ml_handwriting_proto") {
proto_in_dir = "${sysroot}/usr/include/chromeos/libhandwriting/proto"
proto_out_dir = "chrome/knowledge/handwriting/"
sources = [
"${proto_in_dir}/interface.proto",
"${proto_in_dir}/validate.proto",
]
}
static_library("ml_common") {
include_dirs = [
"${sysroot}/usr/include/icu-chrome/common",
"${sysroot}/usr/include/icu-chrome/i18n",
"${sysroot}/usr/include/libtextclassifier",
"${sysroot}/usr/include/tensorflow",
]
libs = [
"icui18n-chrome",
"icuuc-chrome",
"tensorflowlite",
"textclassifier",
]
pkg_deps = [ "protobuf" ]
deps = [ ":ml_handwriting_proto" ]
public_deps = [ ":ml_mojo_bindings_lib" ]
all_dependent_configs = [ ":ml_common_pkg_deps" ]
sources = [
"daemon.cc",
"graph_executor_impl.cc",
"handwriting.cc",
"handwriting_proto_mojom_conversion.cc",
"handwriting_recognizer_impl.cc",
"machine_learning_service_impl.cc",
"metrics.cc",
"model_impl.cc",
"model_metadata.cc",
"request_metrics.cc",
"tensor_view.cc",
"text_classifier_impl.cc",
"util.cc",
]
if (use.ondevice_handwriting) {
defines = [ "ML_SUPPORT_HANDWRITING" ]
}
}
static_library("ml_cmdline_common") {
deps = [ ":ml_common" ]
sources = [ "simple.cc" ]
}
executable("ml_service") {
deps = [ ":ml_common" ]
sources = [ "main.cc" ]
}
executable("ml_cmdline") {
include_dirs = [ "${sysroot}/usr/include/tensorflow" ]
deps = [ ":ml_cmdline_common" ]
sources = [ "command_line.cc" ]
}
if (use.test) {
executable("ml_service_test") {
configs += [ "//common-mk:test" ]
include_dirs = [ "${sysroot}/usr/include/tensorflow" ]
deps = [
":ml_common",
":ml_handwriting_proto",
]
sources = [
"graph_executor_impl_test.cc",
"handwriting_proto_mojom_conversion_test.cc",
"handwriting_test.cc",
"machine_learning_service_impl_test.cc",
"model_impl_test.cc",
"test_utils.cc",
"testrunner.cc",
"util_test.cc",
]
if (use.ondevice_handwriting) {
defines = [ "ML_SUPPORT_HANDWRITING" ]
}
}
executable("ml_cmdline_test") {
configs += [ "//common-mk:test" ]
include_dirs = [ "${sysroot}/usr/include/tensorflow" ]
deps = [ ":ml_cmdline_common" ]
sources = [
"simple_test.cc",
"testrunner.cc",
]
}
}
# Fuzzer target.
if (use.fuzzer) {
executable("ml_service_impl_fuzzer") {
configs += [ "//common-mk/common_fuzzer:common_fuzzer" ]
deps = [ ":ml_common" ]
sources = [ "fuzzers/ml_service_impl_fuzzer.cc" ]
}
executable("ml_service_load_flatbuffer_fuzzer") {
configs += [ "//common-mk/common_fuzzer" ]
deps = [ ":ml_common" ]
sources = [ "fuzzers/ml_service_load_flatbuffer_fuzzer.cc" ]
}
}