# Description:
# Mace core.
#
package(
    default_visibility = ["//visibility:public"],
)

licenses(["notice"])  # Apache 2.0

load("//mace:mace.bzl", "if_android", "if_profiling_enabled")

cc_library(
    name = "opencl_runtime",
    srcs = glob([
        "runtime/opencl/*.cc",
    ]),
    hdrs = glob([
        "runtime/opencl/cl2.hpp",
        "runtime/opencl/*.h",
    ]),
    copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"] +
            if_profiling_enabled(["-DMACE_OPENCL_PROFILING"]),
    linkopts = ["-ldl"],
    deps = [
        ":core",
        "//mace/utils:logging",
        "//mace/utils:tuner",
        "@opencl_headers//:opencl20_headers",
    ],
    alwayslink = 1,
)


cc_library(
    name = "core",
    srcs = glob(["*.cc"]),
    hdrs = glob(["*.h"]),
    copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"],
    linkopts = if_android(["-pie"]),
    deps = [
        "//mace/utils:utils_hdrs",
        "//mace/utils:logging",
    ],
)

cc_library(
    name = "test_benchmark_main",
    testonly = 1,
    hdrs = [
        "testing/test_benchmark.h",
    ],
    srcs = [
        "testing/test_benchmark.cc",
        "testing/test_benchmark_main.cc",
    ],
    copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"],
    alwayslink = 1,
    deps = [
        ":core",
        "//mace/utils:utils_hdrs",
    ],
)
