Skip to content

Commit

Permalink
Link static protobuf also to shared tensorflow
Browse files Browse the repository at this point in the history
Now it is needed again for some reason.
  • Loading branch information
FloopCZ committed Feb 5, 2018
1 parent ba7f78a commit 62c1fe2
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions tensorflow_cc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ project(
# If enabled, bazel has to be installed.
option(TENSORFLOW_SHARED "Build shared library (required for GPU support)." OFF)
option(TENSORFLOW_STATIC "Build static library." ON)
option(SYSTEM_PROTOBUF "Use system protobuf instead of static protobuf from contrib/makefile.\
This option is only supported with TENSORFLOW_STATIC." OFF)
option(SYSTEM_PROTOBUF "Use system protobuf instead of static protobuf from contrib/makefile." OFF)

# -------------
# CMake Options
Expand Down Expand Up @@ -80,6 +79,25 @@ if(TENSORFLOW_SHARED)
"${CMAKE_INSTALL_PREFIX}/lib/tensorflow_cc/libtensorflow_framework.so"
dl pthread
)
if(SYSTEM_PROTOBUF)
target_include_directories(
tensorflow_cc_shared INTERFACE
"${Protobuf_INCLUDE_DIRS}"
)
target_link_libraries(
tensorflow_cc_shared INTERFACE
"${Protobuf_LIBRARIES}"
)
else()
target_include_directories(
tensorflow_cc_shared INTERFACE
"${CMAKE_INSTALL_PREFIX}/include/tensorflow/tensorflow/contrib/makefile/gen/protobuf-host/include"
)
target_link_libraries(
tensorflow_cc_shared INTERFACE
"${CMAKE_INSTALL_PREFIX}/lib/tensorflow_cc/libprotobuf.a"
)
endif()
endif()

# ----------------------------------
Expand Down

0 comments on commit 62c1fe2

Please sign in to comment.