set(TENSORFLOW_LITE_BASE ${TENSORFLOW_BASE}/tensorflow/contrib/lite)
#
-# TensorFlow Graph Definition Accessor
+# Protocol Buffer (>= 3.5.1)
#
-if(ENABLE_TENSORFLOW_GRAPHDEF)
- include(FindProtobuf)
+set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build tests" FORCE)
- find_package(Protobuf REQUIRED)
+add_subdirectory(protobuf/cmake)
+#
+# TensorFlow Graph Definition Accessor
+#
+# TODO Reduce indentation level
list(APPEND TF_GRAPH_PROTO_TAGS tensorflow/core/framework/versions)
list(APPEND TF_GRAPH_PROTO_TAGS tensorflow/core/framework/function)
list(APPEND TF_GRAPH_PROTO_TAGS tensorflow/core/framework/types)
foreach(TF_GRAPH_PROTO_TAG ${TF_GRAPH_PROTO_TAGS})
add_custom_command(OUTPUT "${TF_GRAPH_PROTO_GENERATED}/${TF_GRAPH_PROTO_TAG}.pb.cc"
COMMAND mkdir -p "${TF_GRAPH_PROTO_GENERATED}"
- COMMAND protoc --proto_path=${TENSORFLOW_BASE} --cpp_out=${TF_GRAPH_PROTO_GENERATED} "${TF_GRAPH_PROTO_TAG}.proto")
+ COMMAND $<TARGET_FILE:protoc> --proto_path=${TENSORFLOW_BASE} --cpp_out=${TF_GRAPH_PROTO_GENERATED} "${TF_GRAPH_PROTO_TAG}.proto")
list(APPEND TF_GRAPH_PROTO_SRCS "${TF_GRAPH_PROTO_GENERATED}/${TF_GRAPH_PROTO_TAG}.pb.cc")
endforeach()
add_library(tensorflow_graphdef ${TF_GRAPH_PROTO_SRCS})
- target_include_directories(tensorflow_graphdef PUBLIC ${TF_GRAPH_PROTO_GENERATED} ${PROTOBUF_INCLUDE_DIRS})
- target_link_libraries(tensorflow_graphdef PUBLIC ${PROTOBUF_LIBRARIES})
-endif(ENABLE_TENSORFLOW_GRAPHDEF)
+ target_include_directories(tensorflow_graphdef PUBLIC ${TF_GRAPH_PROTO_GENERATED})
+ target_link_libraries(tensorflow_graphdef PUBLIC libprotobuf)
#
# Tensorflow Lite library
# NOTE Graph dump uses libtensorflow_graphdef
-if(ENABLE_TENSORFLOW_GRAPHDEF)
+# TODO Reduce indentation level
list(APPEND SRCS "src/graphdump.cc")
add_executable(graphdump ${SRCS})
target_link_libraries(graphdump tensorflow_graphdef)
-endif(ENABLE_TENSORFLOW_GRAPHDEF)