aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tools/proto_text/BUILD
blob: b4b70e0a78e1c86d01aa1f56438e5f7798f7be56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Description:
# This package provides build-time generation of proto3 text format functions
# (ProtoDebugString, ProtoShortDebugString, and ProtoParseFromString) which
# provide equivalent functionality as proto.DebugString, proto.ShortDebugString,
# and TextFormat parsing, but can be used with protos generated with
# LITE_RUNTIME.
#
# Note that proto3 well-known types (e.g. Any) are not handled in a special way
# by the generated code.

package(default_visibility = ["//visibility:private"])

licenses(["notice"])  # Apache 2.0

exports_files([
    "LICENSE",
    "placeholder.txt",
])

load(
    "//tensorflow:tensorflow.bzl",
    "if_ios",
    "tf_generate_proto_text_sources",
    "tf_cc_test",
)

# For platform specific build config
load(
    "//tensorflow/core:platform/default/build_config.bzl",
    "tf_proto_library_cc",
)

cc_binary(
    name = "gen_proto_text_functions",
    srcs = ["gen_proto_text_functions.cc"],
    copts = if_ios(["-DGOOGLE_LOGGING"]),
    visibility = ["//tensorflow:internal"],
    deps = [
        ":gen_proto_text_functions_lib",
        "@protobuf_archive//:protobuf",
        "//tensorflow/core:lib_proto_parsing",
        "//tensorflow/core:lib_proto_compiler",
    ] + if_ios(["//tensorflow/core/platform/default/build_config:logging"]),
)

cc_library(
    name = "gen_proto_text_functions_lib",
    srcs = ["gen_proto_text_functions_lib.cc"],
    hdrs = ["gen_proto_text_functions_lib.h"],
    copts = if_ios(["-DGOOGLE_LOGGING"]),
    linkopts = select({
        "//tensorflow:windows": [],
        "//tensorflow:darwin": [
            "-lm",
            "-lpthread",
        ],
        "//tensorflow:ios": [
            "-lm",
            "-lpthread",
        ],
        "//conditions:default": [
            "-lm",
            "-lpthread",
            "-lrt",
        ],
    }),
    deps = [
        "//tensorflow/core:lib_proto_parsing",
    ] + if_ios(["//tensorflow/core/platform/default/build_config:logging"]),
)

tf_proto_library_cc(
    name = "test_proto",
    srcs = ["test.proto"],
)

tf_generate_proto_text_sources(
    name = "test_proto_text",
    srcs = ["test.proto"],
    srcs_relative_dir = "tensorflow/tools/proto_text/",
    deps = [
        ":test_proto_cc",
        "//tensorflow/core:lib",
        "//tensorflow/core:lib_internal",
    ],
)

tf_cc_test(
    name = "gen_proto_text_functions_lib_test",
    size = "small",
    srcs = [
        "gen_proto_text_functions_lib_test.cc",
        ":test_proto_text_srcs",
    ],
    deps = [
        ":gen_proto_text_functions_lib",
        ":test_proto_cc",
        "//tensorflow/core:lib",
        "//tensorflow/core:lib_internal",
        "//tensorflow/core:test",
        "//tensorflow/core:test_main",
    ],
)