|  | # Copyright 2022 The Fuchsia 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("//build/components.gni") | 
|  | import("//build/cpp/cpp_fuzzer.gni") | 
|  | import("//build/cpp/sdk_source_set.gni") | 
|  | import("//build/fuzz.gni") | 
|  | import("//build/test.gni") | 
|  | import("//build/testing/cc_test_executable.gni") | 
|  |  | 
|  | cc_test_executable("unit-tests-bin") { | 
|  | testonly = true | 
|  | sources = [ "tests/unit-tests.cc" ] | 
|  |  | 
|  | deps = [ | 
|  | ":utf-utils", | 
|  | "//zircon/system/ulib/zxtest", | 
|  | ] | 
|  |  | 
|  | configs += [ ":enable-vector-extensions" ] | 
|  | } | 
|  |  | 
|  | fuchsia_unittest_package("utf-utils-unit-tests") { | 
|  | deps = [ ":unit-tests-bin" ] | 
|  | } | 
|  |  | 
|  | cpp_fuzzer("simple-compare-fuzzer") { | 
|  | sources = [ "tests/simple-compare-fuzzer.cc" ] | 
|  | deps = [ ":utf-utils" ] | 
|  | } | 
|  |  | 
|  | fuchsia_fuzzer_component("simple-compare-fuzzer-component") { | 
|  | manifest = "meta/simple-compare-fuzzer.cml" | 
|  | deps = [ ":simple-compare-fuzzer" ] | 
|  | } | 
|  |  | 
|  | if (is_fuchsia) { | 
|  | fuchsia_fuzzer_package("utf-utils-fuzzers") { | 
|  | cpp_fuzzer_components = [ ":simple-compare-fuzzer-component" ] | 
|  | } | 
|  | } else { | 
|  | group("utf-utils-fuzzers") { | 
|  | testonly = true | 
|  | deps = [ ":simple-compare-fuzzer" ] | 
|  | } | 
|  | } | 
|  |  | 
|  | # Enable SSSE3 and AVX2 instructions for tests that use dynamic dispatch to test vector extensions. | 
|  | config("enable-vector-extensions") { | 
|  | if (current_cpu == "x64") { | 
|  | cflags = [ | 
|  | "-mssse3", | 
|  | "-mavx2", | 
|  | ] | 
|  | } | 
|  | } | 
|  |  | 
|  | group("tests") { | 
|  | testonly = true | 
|  |  | 
|  | deps = [ | 
|  | ":utf-utils-fuzzers", | 
|  | ":utf-utils-unit-tests", | 
|  | ] | 
|  | } | 
|  |  | 
|  | ## BAZEL2GN SENTINEL - DO NOT EDIT BELOW THIS LINE ## | 
|  | # | 
|  | #  ________  _________  ________  ________ | 
|  | # |\   ____\|\___   ___\\   __  \|\   __  \ | 
|  | # \ \  \___|\|___ \  \_\ \  \|\  \ \  \|\  \ | 
|  | #  \ \_____  \   \ \  \ \ \  \\\  \ \   ____\ | 
|  | #   \|____|\  \   \ \  \ \ \  \\\  \ \  \___| | 
|  | #     ____\_\  \   \ \__\ \ \_______\ \__\ | 
|  | #    |\_________\   \|__|  \|_______|\|__| | 
|  | #    \|_________| | 
|  | # | 
|  | # | 
|  | # AUTO-GENERATED - DO NOT EDIT | 
|  | # | 
|  | # The targets below are auto-generated based on the targets defined in the | 
|  | # BUILD.bazel file from the same directory. If you made changes to targets in | 
|  | # Bazel, instead of editing this file manually, run: | 
|  | # | 
|  | #   > fx bazel2gn | 
|  | # | 
|  | # Please do NOT edit this file directly. Instead, edit the BUILD.bazel file and | 
|  | # rerun bazel2gn. | 
|  |  | 
|  | import("//build/tools/bazel2gn/bazel_migration.gni") | 
|  |  | 
|  | # A self-verification target for generated content in this file. | 
|  | if (is_host) { | 
|  | verify_bazel2gn("verify_bazel2gn") { | 
|  | } | 
|  | } | 
|  |  | 
|  | sdk_source_set("utf-utils") { | 
|  | sources = [ | 
|  | "internal/arm-neon.h", | 
|  | "internal/generic-simd.h", | 
|  | "internal/scalar.cc", | 
|  | "internal/scalar.h", | 
|  | "internal/x86-avx2.h", | 
|  | "internal/x86-ssse3.h", | 
|  | "utf-utils.cc", | 
|  | ] | 
|  | public = [ "utf-utils.h" ] | 
|  | sdk_area = "Unknown" | 
|  | build_as_static = true | 
|  | category = "partner" | 
|  | friend = [ ":*" ] | 
|  | sdk_name = "utf-utils" | 
|  | include_base = "//sdk" | 
|  | public_configs = [ "//sdk/config" ] | 
|  | stable = true | 
|  | visibility = [ "*" ] | 
|  | public_deps = [ "//sdk/lib/stdcompat" ] | 
|  | if (is_fuchsia) { | 
|  | public_deps += [ "//zircon/system/ulib/zx" ] | 
|  | } | 
|  | } |