From 708370bac4bcdc0c6afedd1b19eaa98884d58035 Mon Sep 17 00:00:00 2001 From: Han Wang Date: Fri, 10 Apr 2020 15:21:39 +0800 Subject: [PATCH 1/2] cmake find tensorflow: handel the case that headers are installed to different dirs lib and lib64 --- source/cmake/Findtensorflow.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/cmake/Findtensorflow.cmake b/source/cmake/Findtensorflow.cmake index b9cf247e22..61c4b6ebcc 100644 --- a/source/cmake/Findtensorflow.cmake +++ b/source/cmake/Findtensorflow.cmake @@ -10,9 +10,13 @@ # TensorFlowFramework_LIBRARY # TensorFlowFramework_LIBRARY_PATH +string(REPLACE "lib64" "lib" TENSORFLOW_ROOT_NO64 ${TENSORFLOW_ROOT}) + # define the search path list(APPEND TensorFlow_search_PATHS ${TENSORFLOW_ROOT}) list(APPEND TensorFlow_search_PATHS "${TENSORFLOW_ROOT}/../tensorflow_core") +list(APPEND TensorFlow_search_PATHS ${TENSORFLOW_ROOT_NO64}) +list(APPEND TensorFlow_search_PATHS "${TENSORFLOW_ROOT_NO64}/../tensorflow_core") list(APPEND TensorFlow_search_PATHS "/usr/") list(APPEND TensorFlow_search_PATHS "/usr/local/") @@ -28,6 +32,15 @@ find_path(TensorFlow_INCLUDE_DIRS PATH_SUFFIXES "/include" NO_DEFAULT_PATH ) +find_path(TensorFlow_INCLUDE_DIRS_GOOGLE + NAMES + google/protobuf/port.h + PATHS ${TensorFlow_search_PATHS} + PATH_SUFFIXES "/include" + NO_DEFAULT_PATH + ) +list(APPEND TensorFlow_INCLUDE_DIRS ${TensorFlow_INCLUDE_DIRS_GOOGLE}) + if (NOT TensorFlow_INCLUDE_DIRS AND tensorflow_FIND_REQUIRED) message(FATAL_ERROR "Not found 'include/tensorflow/core/public/session.h' directory in path '${TensorFlow_search_PATHS}' " From 25b5ada015f0fddb1a6294fe93023aa347924020 Mon Sep 17 00:00:00 2001 From: Han Wang Date: Sat, 11 Apr 2020 10:36:32 +0800 Subject: [PATCH 2/2] fix bug in finding protobuf --- source/cmake/Findtensorflow.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/cmake/Findtensorflow.cmake b/source/cmake/Findtensorflow.cmake index 61c4b6ebcc..708b8e86d5 100644 --- a/source/cmake/Findtensorflow.cmake +++ b/source/cmake/Findtensorflow.cmake @@ -34,7 +34,7 @@ find_path(TensorFlow_INCLUDE_DIRS ) find_path(TensorFlow_INCLUDE_DIRS_GOOGLE NAMES - google/protobuf/port.h + google/protobuf/type.pb.h PATHS ${TensorFlow_search_PATHS} PATH_SUFFIXES "/include" NO_DEFAULT_PATH @@ -43,7 +43,7 @@ list(APPEND TensorFlow_INCLUDE_DIRS ${TensorFlow_INCLUDE_DIRS_GOOGLE}) if (NOT TensorFlow_INCLUDE_DIRS AND tensorflow_FIND_REQUIRED) message(FATAL_ERROR - "Not found 'include/tensorflow/core/public/session.h' directory in path '${TensorFlow_search_PATHS}' " + "Not found 'tensorflow/core/public/session.h' directory in path '${TensorFlow_search_PATHS}' " "You can manually set the tensorflow install path by -DTENSORFLOW_ROOT ") endif ()