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
|
# TensorFlow Lite Objective-C API.
package(default_visibility = ["//visibility:private"])
licenses(["notice"]) # Apache 2.0
load("//tools/build_defs/apple:ios.bzl", "ios_unit_test")
SOURCES = glob([
"sources/*.h",
"sources/*.m",
"sources/*.mm",
])
API_HEADERS = glob([
"apis/*.h",
])
MINIMUM_OS_VERSION = "8.0"
# Compiler flags for building regular non-test libraries.
RELEASE_COPTS = [
# Enables language-specific warnings for Objective-C, Objective-C++, C, and C++.
"-Wall",
# Warns if functions, variables, and types marked with the deprecated attribute are being used.
"-Wdeprecated-declarations",
# Warns for errors in documentation.
"-Wdocumentation",
# Turns all warnings into errors.
"-Werror",
# Enables extra warning flags that are not enabled by -Wall.
"-Wextra",
# Warns if a global function is defined without a previous prototype declaration.
"-Wmissing-prototypes",
# From -Wextra. Disables warning when signed value is converted to unsigned value during comparison.
"-Wno-sign-compare",
# From -Wextra. Disables warning for unused parameters, which are common in delegate methods and block callbacks.
"-Wno-unused-parameter",
# Warns if a global or local variable or type declaration shadows another variable, parameter, type, class member, or instance variable.
"-Wshadow",
# Warns if a function is declared or defined without specifying the argument types. For a block with no args, use (void) instead of ().
"-Wstrict-prototypes",
# Warns if an @selector() expression is encountered with a method name that hasn't been defined yet.
"-Wundeclared-selector",
# Turn off warnings for headers not part of TensorFlow Lite Objective-C API.
"--system-header-prefix=third_party/tensorflow/contrib/lite/experimental/c/",
]
# Compiler flags for building test libraries.
TEST_COPTS = RELEASE_COPTS + [
# From -Wall. Disables warning when passing nil to a callee that requires a non-null argument.
"-Wno-nonnull",
# Disables warning when a global or local variable or type declaration shadows another.
"-Wno-shadow",
]
objc_library(
name = "TensorFlowLiteObjCLib",
srcs = SOURCES,
hdrs = API_HEADERS,
copts = RELEASE_COPTS,
deps = [
"//tensorflow/contrib/lite/experimental/c:c_api",
],
alwayslink = 1,
)
ios_unit_test(
name = "TensorFlowLiteObjCTests",
size = "small",
minimum_os_version = MINIMUM_OS_VERSION,
deps = [":TensorFlowLiteObjCTestLib"],
)
objc_library(
name = "TensorFlowLiteObjCTestLib",
testonly = 1,
srcs = glob([
"tests/*.m",
]),
hdrs = glob([
"apis/*.h",
"sources/*.h",
"tests/*.h",
]),
copts = TEST_COPTS,
resources = [
"//tensorflow/contrib/lite:testdata/add.bin",
],
deps = [
":TensorFlowLiteObjCLib",
],
)
|