# Copyright 2020 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/buildflag_header.gni")
import("//build/config/rust.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
declare_args() {
# Enables building a development / debugging binary.
enable_qr_print = false
}
# Error type shared between C++ and Rust.
source_set("error") {
sources = [ "error.h" ]
}
source_set("bitmap_generator") {
sources = [
"bitmap_generator.cc",
"bitmap_generator.h",
"dino_image.h",
]
public_deps = [ ":error" ]
deps = [
":qr_code_generator",
"//base",
"//components/vector_icons",
"//skia",
"//ui/gfx",
]
}
source_set("qr_code_generator") {
sources = [
"qr_code_generator.cc",
"qr_code_generator.h",
]
deps = [
":qr_code_generator_ffi_glue",
"//base",
]
public_deps = [
":error",
"//base",
]
}
rust_static_library("qr_code_generator_ffi_glue") {
allow_unsafe = true # Needed for FFI that underpins the `cxx` crate.
crate_root = "qr_code_generator_ffi_glue.rs"
sources = [ "qr_code_generator_ffi_glue.rs" ]
cxx_bindings = [ "qr_code_generator_ffi_glue.rs" ]
visibility = [ ":qr_code_generator" ]
deps = [
":error",
"//third_party/rust/qr_code/v2:lib",
]
}
source_set("unit_tests") {
testonly = true
sources = [
"bitmap_generator_unittest.cc",
"qr_code_generator_unittest.cc",
]
deps = [
":bitmap_generator",
":qr_code_generator",
"//base",
"//base/test:test_support",
"//testing/gtest",
]
}
if (enable_qr_print) {
executable("qr_print") {
sources = [ "qr_print.cc" ]
deps = [ ":qr_code_generator" ]
}
}
fuzzer_test("qr_code_generator_fuzzer") {
sources = [ "qr_code_generator_fuzzer.cc" ]
deps = [ ":qr_code_generator" ]
}