diff --git a/tensorflow/BUILD b/tensorflow/BUILD index 2eed0b63141..97427af477b 100644 --- a/tensorflow/BUILD +++ b/tensorflow/BUILD @@ -35,6 +35,14 @@ config_setting( visibility = ["//visibility:public"], ) +config_setting( + name = "ios", + values = { + "crosstool_top": "//tools/osx/crosstool:crosstool", + }, + visibility = ["//visibility:public"], +) + package_group( name = "internal", packages = [ diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD index e0a396fb9a5..cfacf0b829e 100644 --- a/tensorflow/core/BUILD +++ b/tensorflow/core/BUILD @@ -54,6 +54,7 @@ licenses(["notice"]) # Apache 2.0 load( "//tensorflow:tensorflow.bzl", "if_android", + "if_ios", "tf_copts", "tf_cc_test", "tf_cc_tests", @@ -649,6 +650,27 @@ cc_library( alwayslink = 1, ) +# Native library support for iOS applications. +# +# bazel build --config=ios_x86_64 \ +# //third_party/tensorflow/core:ios_tensorflow_lib +cc_library( + name = "ios_tensorflow_lib", + srcs = if_ios([ + ":android_op_registrations_and_gradients", + "//tensorflow/core:android_srcs", + "//tensorflow/core/kernels:android_core_ops", + "//tensorflow/core/kernels:android_extended_ops", + ]), + copts = tf_copts() + ["-Os"] + ["-std=c++11"], + visibility = ["//visibility:public"], + deps = [ + ":protos_cc", + "//third_party/eigen3", + ], + alwayslink = 1, +) + # Full TensorFlow library with operator support. Use this unless reducing # binary size (by packaging a reduced operator set) is a concern. cc_library( diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index 194309b134b..acbe96ad50e 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -101,6 +101,12 @@ def if_android(a): "//conditions:default": [], }) +def if_ios(a): + return select({ + "//tensorflow:ios": a, + "//conditions:default": [], + }) + def tf_copts(): return (["-fno-exceptions", "-DEIGEN_AVOID_STL_ARRAY"] + if_cuda(["-DGOOGLE_CUDA=1"]) + @@ -112,6 +118,7 @@ def tf_copts(): "-O2", ], "//tensorflow:darwin": [], + "//tensorflow:ios": ["-std=c++11",], "//conditions:default": ["-pthread"]})) def tf_opts_nortti_if_android():