Skip to content

Commit 10e5780

Browse files
authored
Merge pull request #214 from amcadmus/devel
handel the case that headers are installed to different dirs
2 parents 3dc069b + 25b5ada commit 10e5780

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

source/cmake/Findtensorflow.cmake

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010
# TensorFlowFramework_LIBRARY
1111
# TensorFlowFramework_LIBRARY_PATH
1212

13+
string(REPLACE "lib64" "lib" TENSORFLOW_ROOT_NO64 ${TENSORFLOW_ROOT})
14+
1315
# define the search path
1416
list(APPEND TensorFlow_search_PATHS ${TENSORFLOW_ROOT})
1517
list(APPEND TensorFlow_search_PATHS "${TENSORFLOW_ROOT}/../tensorflow_core")
18+
list(APPEND TensorFlow_search_PATHS ${TENSORFLOW_ROOT_NO64})
19+
list(APPEND TensorFlow_search_PATHS "${TENSORFLOW_ROOT_NO64}/../tensorflow_core")
1620
list(APPEND TensorFlow_search_PATHS "/usr/")
1721
list(APPEND TensorFlow_search_PATHS "/usr/local/")
1822

@@ -28,9 +32,18 @@ find_path(TensorFlow_INCLUDE_DIRS
2832
PATH_SUFFIXES "/include"
2933
NO_DEFAULT_PATH
3034
)
35+
find_path(TensorFlow_INCLUDE_DIRS_GOOGLE
36+
NAMES
37+
google/protobuf/type.pb.h
38+
PATHS ${TensorFlow_search_PATHS}
39+
PATH_SUFFIXES "/include"
40+
NO_DEFAULT_PATH
41+
)
42+
list(APPEND TensorFlow_INCLUDE_DIRS ${TensorFlow_INCLUDE_DIRS_GOOGLE})
43+
3144
if (NOT TensorFlow_INCLUDE_DIRS AND tensorflow_FIND_REQUIRED)
3245
message(FATAL_ERROR
33-
"Not found 'include/tensorflow/core/public/session.h' directory in path '${TensorFlow_search_PATHS}' "
46+
"Not found 'tensorflow/core/public/session.h' directory in path '${TensorFlow_search_PATHS}' "
3447
"You can manually set the tensorflow install path by -DTENSORFLOW_ROOT ")
3548
endif ()
3649

0 commit comments

Comments
 (0)