Skip to content

TensorFlow: constrict TensorFlow addition further #29460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdlib/public/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ if(SWIFT_BUILD_STDLIB)

# Note: Python should be built before TensorFlow because Python is a
# dependency for `numpy.ndarray` bridging to `ShapedArray`/`Tensor`.
if(SWIFT_ENABLE_TENSORFLOW)
if(SWIFT_ENABLE_TENSORFLOW AND TENSORFLOW_SWIFT_APIS)
# TODO: Add TensorFlow support for iOS/Raspberry Pi.
add_subdirectory(TensorFlow)
endif()
Expand Down
20 changes: 9 additions & 11 deletions stdlib/public/TensorFlow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

find_package(TensorFlow REQUIRED)
message(STATUS "Building TensorFlow.")
message(STATUS "Using TensorFlow high-level APIs library.")


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

set(SOURCES "")

# Copy TensorFlow high-level API sources, if they exist.
if (TENSORFLOW_SWIFT_APIS)
message(STATUS "Using TensorFlow high-level APIs library.")

file(GLOB_RECURSE TENSORFLOW_SWIFT_API_SOURCES
"${TENSORFLOW_SWIFT_APIS}/Sources/*.swift")
foreach(_TENSORFLOW_SWIFT_APIS_SOURCE ${TENSORFLOW_SWIFT_API_SOURCES})
file(TO_CMAKE_PATH ${_TENSORFLOW_SWIFT_APIS_SOURCE} _TENSORFLOW_SWIFT_APIS_SOURCE)
list(APPEND SOURCES ${_TENSORFLOW_SWIFT_APIS_SOURCE})
endforeach()
endif()
# Copy TensorFlow high-level API sources.
file(GLOB_RECURSE TENSORFLOW_SWIFT_API_SOURCES
"${TENSORFLOW_SWIFT_APIS}/Sources/*.swift")
foreach(_TENSORFLOW_SWIFT_APIS_SOURCE ${TENSORFLOW_SWIFT_API_SOURCES})
file(TO_CMAKE_PATH ${_TENSORFLOW_SWIFT_APIS_SOURCE} _TENSORFLOW_SWIFT_APIS_SOURCE)
list(APPEND SOURCES ${_TENSORFLOW_SWIFT_APIS_SOURCE})
endforeach()

add_swift_target_library(swiftTensorFlow ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
"${SOURCES}"
Expand Down