From 9031df975a24bfddf7163748f50c9142ddd0705b Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Thu, 8 Mar 2018 10:59:55 +0900 Subject: [PATCH] Build tensorflow_graphdef by default This commit enables tensorflow_graphdef (and graphdump) build by default (using protobuf in external). Signed-off-by: Jonghyun Park --- externals/CMakeLists.txt | 18 ++++++++++-------- tools/graphdump/CMakeLists.txt | 3 +-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 08d366f..63d6bb9 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -16,13 +16,16 @@ set(TENSORFLOW_BASE ${CMAKE_CURRENT_SOURCE_DIR}/tensorflow) 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) @@ -39,15 +42,14 @@ if(ENABLE_TENSORFLOW_GRAPHDEF) 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 $ --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 diff --git a/tools/graphdump/CMakeLists.txt b/tools/graphdump/CMakeLists.txt index ebb6a4f..7d6a462 100644 --- a/tools/graphdump/CMakeLists.txt +++ b/tools/graphdump/CMakeLists.txt @@ -1,7 +1,6 @@ # 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) -- 2.7.4