Skip to content

Commit 49dea1d

Browse files
committed
build: specify a compiler target for tensorflow-swift-apis on macOS
Because the rest of the components have a deployment target of 10.13 explicitly, pass the same triple for the tensorflow-swift-apis build.
1 parent 7c265e7 commit 49dea1d

File tree

1 file changed

+8
-2
lines changed
  • utils/swift_build_support/swift_build_support/products

1 file changed

+8
-2
lines changed

utils/swift_build_support/swift_build_support/products/tensorflow.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,13 @@ def build(self, host_target):
6060
except OSError:
6161
pass
6262

63-
with shell.pushd(self.build_dir):
63+
# SWIFT_ENABLE_TENSORFLOW
64+
target = ''
65+
if host_target.startswith('macosx'):
66+
target = '-DCMAKE_Swift_COMPILER_TARGET=x86_64-apple-macosx10.13'
67+
# SWIFT_ENABLE_TENSORFLOW END
6468

69+
with shell.pushd(self.build_dir):
6570
shell.call([
6671
self.toolchain.cmake,
6772
'-G', 'Ninja',
@@ -71,15 +76,16 @@ def build(self, host_target):
7176
'-D', 'CMAKE_MAKE_PROGRAM={}'.format(self.toolchain.ninja),
7277
'-D', 'CMAKE_Swift_COMPILER={}'.format(swiftc),
7378
# SWIFT_ENABLE_TENSORFLOW
79+
target,
7480
'-D', 'USE_BUNDLED_CTENSORFLOW=YES',
75-
# SWIFT_ENABLE_TENSORFLOW END
7681
'-D', 'TensorFlow_INCLUDE_DIR={}'.format(tensorflow_source_dir),
7782
'-D', 'TensorFlow_LIBRARY={}'.format(
7883
os.path.join(tensorflow_source_dir, 'bazel-bin', 'tensorflow',
7984
lib_name)),
8085
'-D', 'CMAKE_Swift_FLAGS={}'.format('-L{}'.format(
8186
os.path.join(tensorflow_source_dir, 'bazel-bin', 'tensorflow'))
8287
),
88+
# SWIFT_ENABLE_TENSORFLOW END
8389
'-B', self.build_dir,
8490
'-S', self.source_dir,
8591
])

0 commit comments

Comments
 (0)