From 9bd459e4ceba14f9bb1af98d52a109325de952e8 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 9 Oct 2018 17:14:39 -0700 Subject: Adds an Objective-C API to TensorFlow Lite experimental. PiperOrigin-RevId: 216451263 --- tensorflow/contrib/lite/experimental/objc/BUILD | 94 +++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 tensorflow/contrib/lite/experimental/objc/BUILD (limited to 'tensorflow/contrib/lite/experimental/objc/BUILD') diff --git a/tensorflow/contrib/lite/experimental/objc/BUILD b/tensorflow/contrib/lite/experimental/objc/BUILD new file mode 100644 index 0000000000..236b96adb5 --- /dev/null +++ b/tensorflow/contrib/lite/experimental/objc/BUILD @@ -0,0 +1,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", + ], +) -- cgit v1.2.3