| import("//build/buildflag_header.gni") |
| import("//build/config/features.gni") |
| import("//chrome/services/machine_learning/features.gni") |
| |
| source_set("machine_learning") { |
| sources = [ |
| "decision_tree_predictor.cc", |
| "decision_tree_predictor.h", |
| "machine_learning_service.cc", |
| "machine_learning_service.h", |
| ] |
| |
| deps = [ |
| "//base", |
| "//chrome:strings", |
| "//mojo/public/cpp/bindings", |
| ] |
| |
| if (build_with_tflite_lib) { |
| sources += [ |
| "machine_learning_tflite_predictor.cc", |
| "machine_learning_tflite_predictor.h", |
| ] |
| |
| deps += [ |
| ":tflite_lib", |
| ":tflite_simple_test", |
| ] |
| |
| lib_dirs = [ "$root_out_dir" ] |
| libs = [ "tensorflowlite_c" ] |
| } |
| |
| public_deps = [ |
| ":machine_learning_tflite_buildflags", |
| "//chrome/services/machine_learning/public/cpp:decision_tree", |
| "//chrome/services/machine_learning/public/mojom", |
| "//mojo/public/mojom/base", |
| ] |
| } |
| |
| source_set("unit_tests") { |
| testonly = true |
| |
| sources = [ |
| "decision_tree_predictor_unittest.cc", |
| "machine_learning_service_unittest.cc", |
| "public/cpp/decision_tree/decision_tree_prediction_model_unittest.cc", |
| "public/cpp/decision_tree/prediction_model_unittest.cc", |
| "public/cpp/decision_tree_model_unittest.cc", |
| "public/cpp/test_support/fake_service_connection_unittest.cc", |
| ] |
| |
| if (build_with_tflite_lib) { |
| sources += [ "machine_learning_tflite_predictor_unittest.cc" ] |
| } |
| |
| deps = [ |
| ":machine_learning", |
| "//base", |
| "//base/test:test_support", |
| "//chrome/services/machine_learning/public/cpp:cpp", |
| "//chrome/services/machine_learning/public/cpp:test_support", |
| "//testing/gtest", |
| ] |
| } |
| |
| if (build_with_tflite_lib) { |
| copy("tflite_simple_test") { |
| sources = [ "//chrome/test/data/simple_test.tflite" ] |
| outputs = [ "$root_out_dir/test_data/simple_test.tflite" ] |
| } |
| |
| if (is_android) { |
| copy("tflite_lib") { |
| sources = [ "//third_party/tensorflow/libtensorflowlite_c_arm64.so" ] |
| outputs = [ "$root_out_dir/libtensorflowlite_c.so" ] |
| } |
| } else { |
| copy("tflite_lib") { |
| sources = [ "//third_party/tensorflow/libtensorflowlite_c.so" ] |
| outputs = [ "$root_out_dir/libtensorflowlite_c.so" ] |
| } |
| } |
| } |
| |
| buildflag_header("machine_learning_tflite_buildflags") { |
| header = "machine_learning_tflite_buildflags.h" |
| flags = [ "BUILD_WITH_TFLITE_LIB=$build_with_tflite_lib" ] |
| } |