Adds new podspecs for the TensorFlow Lite iOS libraries.
PiperOrigin-RevId: 239748653
diff --git a/configure.py b/configure.py
index 499714d..5ca6df7 100644
--- a/configure.py
+++ b/configure.py
@@ -56,12 +56,18 @@
'lib64/', 'lib/powerpc64le-linux-gnu/', 'lib/x86_64-linux-gnu/', ''
]
-# List of files to be configured for using Bazel on Apple platforms.
+# List of files to configure when building Bazel on Apple platforms.
APPLE_BAZEL_FILES = [
'tensorflow/lite/experimental/objc/BUILD',
'tensorflow/lite/experimental/swift/BUILD'
]
+# List of files to move when building for iOS.
+IOS_FILES = [
+ 'tensorflow/lite/experimental/objc/TensorFlowLiteObjC.podspec',
+ 'tensorflow/lite/experimental/swift/TensorFlowLiteSwift.podspec',
+]
+
if platform.machine() == 'ppc64le':
_DEFAULT_TENSORRT_PATH_LINUX = '/usr/lib/powerpc64le-linux-gnu/'
else:
@@ -1585,24 +1591,24 @@
print('\t--config=%-12s\t# %s' % (name, help_text))
-def configure_apple_bazel_rules():
- """Configures Bazel rules for building on Apple platforms.
+def configure_ios():
+ """Configures TensorFlow for iOS builds.
- Enables analyzing and building Apple Bazel rules on Apple platforms. This
- function will only be executed if `is_macos()` is true.
+ This function will only be executed if `is_macos()` is true.
"""
if not is_macos():
return
- for filepath in APPLE_BAZEL_FILES:
- print(
- 'Configuring %s file to analyze and build Bazel rules on Apple platforms.'
- % filepath)
- existing_filepath = os.path.join(_TF_WORKSPACE_ROOT, filepath + '.apple')
- renamed_filepath = os.path.join(_TF_WORKSPACE_ROOT, filepath)
- os.rename(existing_filepath, renamed_filepath)
if _TF_CURRENT_BAZEL_VERSION is None or _TF_CURRENT_BAZEL_VERSION < 23000:
print(
'Building Bazel rules on Apple platforms requires Bazel 0.23 or later.')
+ for filepath in APPLE_BAZEL_FILES:
+ existing_filepath = os.path.join(_TF_WORKSPACE_ROOT, filepath + '.apple')
+ renamed_filepath = os.path.join(_TF_WORKSPACE_ROOT, filepath)
+ symlink_force(existing_filepath, renamed_filepath)
+ for filepath in IOS_FILES:
+ filename = os.path.basename(filepath)
+ new_filepath = os.path.join(_TF_WORKSPACE_ROOT, filename)
+ symlink_force(filepath, new_filepath)
def main():
@@ -1648,7 +1654,7 @@
if is_macos():
environ_cp['TF_NEED_TENSORRT'] = '0'
else:
- environ_cp['TF_CONFIGURE_APPLE_BAZEL_RULES'] = '0'
+ environ_cp['TF_CONFIGURE_IOS'] = '0'
# The numpy package on ppc64le uses OpenBLAS which has multi-threading
# issues that lead to incorrect answers. Set OMP_NUM_THREADS=1 at
@@ -1753,13 +1759,11 @@
system_specific_config(os.environ)
- if get_var(
- environ_cp, 'TF_CONFIGURE_APPLE_BAZEL_RULES',
- 'Configure Bazel rules for Apple platforms', False,
- ('Would you like to configure Bazel rules for building on Apple platforms?'
- ), 'Configuring Bazel rules for Apple platforms.',
- 'Not configuring Bazel rules for Apple platforms.'):
- configure_apple_bazel_rules()
+ if get_var(environ_cp, 'TF_CONFIGURE_IOS', 'Configure TensorFlow for iOS',
+ False, ('Would you like to configure TensorFlow for iOS builds?'),
+ 'Configuring TensorFlow for iOS builds.',
+ 'Not configuring TensorFlow for iOS builds.'):
+ configure_ios()
print('Preconfigured Bazel build configs. You can use any of the below by '
'adding "--config=<>" to your build command. See .bazelrc for more '