Skip to content

Commit 708370b

Browse files
author
Han Wang
committed
cmake find tensorflow: handel the case that headers are installed to different dirs lib and lib64
1 parent 3dc069b commit 708370b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

source/cmake/Findtensorflow.cmake

Lines changed: 13 additions & 0 deletions
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,6 +32,15 @@ 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/port.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
3346
"Not found 'include/tensorflow/core/public/session.h' directory in path '${TensorFlow_search_PATHS}' "

0 commit comments

Comments
 (0)