Skip to content

Commit ddeaa1f

Browse files
committed
TensorFlow: constrict TensorFlow addition further
This package only makes sense if the `TENSORFLOW_SWIFT_APIS` is defined. We would previously attempt to install content from the tensorflow/swift-apis repository unconditionally.
1 parent 1e1c482 commit ddeaa1f

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

stdlib/public/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ if(SWIFT_BUILD_STDLIB)
7575

7676
# Note: Python should be built before TensorFlow because Python is a
7777
# dependency for `numpy.ndarray` bridging to `ShapedArray`/`Tensor`.
78-
if(SWIFT_ENABLE_TENSORFLOW)
78+
if(SWIFT_ENABLE_TENSORFLOW AND TENSORFLOW_SWIFT_APIS)
7979
# TODO: Add TensorFlow support for iOS/Raspberry Pi.
8080
add_subdirectory(TensorFlow)
8181
endif()

stdlib/public/TensorFlow/CMakeLists.txt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
find_package(TensorFlow REQUIRED)
1818
message(STATUS "Building TensorFlow.")
19+
message(STATUS "Using TensorFlow high-level APIs library.")
20+
1921

2022
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
2123
set(swift_stdlib_compile_flags "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}")
@@ -29,17 +31,13 @@ list(APPEND swift_stdlib_compile_flags "-DCOMPILING_TENSORFLOW_STDLIB_MODULE")
2931

3032
set(SOURCES "")
3133

32-
# Copy TensorFlow high-level API sources, if they exist.
33-
if (TENSORFLOW_SWIFT_APIS)
34-
message(STATUS "Using TensorFlow high-level APIs library.")
35-
36-
file(GLOB_RECURSE TENSORFLOW_SWIFT_API_SOURCES
37-
"${TENSORFLOW_SWIFT_APIS}/Sources/*.swift")
38-
foreach(_TENSORFLOW_SWIFT_APIS_SOURCE ${TENSORFLOW_SWIFT_API_SOURCES})
39-
file(TO_CMAKE_PATH ${_TENSORFLOW_SWIFT_APIS_SOURCE} _TENSORFLOW_SWIFT_APIS_SOURCE)
40-
list(APPEND SOURCES ${_TENSORFLOW_SWIFT_APIS_SOURCE})
41-
endforeach()
42-
endif()
34+
# Copy TensorFlow high-level API sources.
35+
file(GLOB_RECURSE TENSORFLOW_SWIFT_API_SOURCES
36+
"${TENSORFLOW_SWIFT_APIS}/Sources/*.swift")
37+
foreach(_TENSORFLOW_SWIFT_APIS_SOURCE ${TENSORFLOW_SWIFT_API_SOURCES})
38+
file(TO_CMAKE_PATH ${_TENSORFLOW_SWIFT_APIS_SOURCE} _TENSORFLOW_SWIFT_APIS_SOURCE)
39+
list(APPEND SOURCES ${_TENSORFLOW_SWIFT_APIS_SOURCE})
40+
endforeach()
4341

4442
add_swift_target_library(swiftTensorFlow ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
4543
"${SOURCES}"

0 commit comments

Comments
 (0)