# Copyright (c) 2023 Arm Limited.
#
# SPDX-License-Identifier: MIT
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

#---------------------------------------------------------------------
# Neon examples

cc_binary(
    name = "neon_cnn",
    srcs = ["neon_cnn.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "neon_copy_objects",
    srcs = ["neon_copy_objects.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "neon_gemm_qasymm8",
    srcs = ["neon_gemm_qasymm8.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "neon_permute",
    srcs = ["neon_permute.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "neon_scale",
    srcs = ["neon_scale.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "neon_sgemm",
    srcs = ["neon_sgemm.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

#---------------------------------------------------------------------
# Graph examples

cc_binary(
    name = "graph_alexnet",
    srcs = ["graph_alexnet.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_deepspeech_v0_4_1",
    srcs = ["graph_deepspeech_v0_4_1.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_edsr",
    srcs = [
        "graph_edsr.cpp",
        "graph_edsr.h",
    ],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_googlenet",
    srcs = ["graph_googlenet.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_inception_resnet_v1",
    srcs = ["graph_inception_resnet_v1.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_inception_resnet_v2",
    srcs = ["graph_inception_resnet_v2.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_inception_v3",
    srcs = ["graph_inception_v3.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_inception_v4",
    srcs = ["graph_inception_v4.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_lenet",
    srcs = ["graph_lenet.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_mobilenet",
    srcs = ["graph_mobilenet.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_mobilenet_v2",
    srcs = ["graph_mobilenet_v2.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_resnet12",
    srcs = ["graph_resnet12.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_resnet50",
    srcs = ["graph_resnet50.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_resnet_v2_50",
    srcs = ["graph_resnet_v2_50.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_resnext50",
    srcs = ["graph_resnext50.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_shufflenet",
    srcs = ["graph_shufflenet.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_squeezenet",
    srcs = ["graph_squeezenet.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_squeezenet_v1_1",
    srcs = ["graph_squeezenet_v1_1.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_srcnn955",
    srcs = ["graph_srcnn955.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_ssd_mobilenet",
    srcs = ["graph_ssd_mobilenet.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_vgg16",
    srcs = ["graph_vgg16.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_vgg19",
    srcs = ["graph_vgg19.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_vgg_vdsr",
    srcs = ["graph_vgg_vdsr.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)

cc_binary(
    name = "graph_yolov3",
    srcs = ["graph_yolov3.cpp"],
    copts = select({
                  "//:arch_armv8-a": ["-march=armv8-a"],
                  "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"],
                  "//conditions:default": ["-march=armv8-a"],
              }),
    linkstatic = False,
    deps = [
        "//:arm_compute",
        "//:arm_compute_graph",
        "//include",
        "//utils",
    ],
)
