-
Notifications
You must be signed in to change notification settings - Fork 42
/
CMakeLists.txt
76 lines (62 loc) · 2.12 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
cmake_minimum_required(VERSION 3.5)
project(tensorflow_cpp)
set(CMAKE_CXX_STANDARD 11)
option(USE_TENSORFLOW_CPP "USE Tensorflow C++ API" OFF)
option(USE_TENSORFLOW_C "USE Tensorflow C API" ON)
find_package(OpenCV 3.0 QUIET)
if(NOT OpenCV_FOUND)
find_package(OpenCV 2.4.3 QUIET)
if(NOT OpenCV_FOUND)
message(FATAL_ERROR "OpenCV > 2.4.3 not found.")
endif()
endif()
if(USE_TENSORFLOW_CPP)
# Setup Tensorflow C++
set(TENSORFLOW_INCLUDES
/usr/local/include/tf/
/usr/local/include/tf/bazel-genfiles
/usr/local/include/tf/tensorflow/
/usr/local/include/tf/tensorflow/third-party)
set(TENSORFLOW_LIBS
/usr/local/lib/libtensorflow_cc.so
/usr/local/lib/libtensorflow_framework.so)
include_directories(
${TENSORFLOW_INCLUDES}
${PROJECT_SOURCE_DIR}/third_party/eigen3
)
# Simple Net C++
add_executable(load_simple_net simple/load_simple_net.cpp)
target_link_libraries(load_simple_net
${TENSORFLOW_LIBS}
${OpenCV_LIBS}
)
# CNN Net C++
add_executable(load_predict_cnn fashion_mnist/load_predict_cnn.cpp)
target_link_libraries(load_predict_cnn
${TENSORFLOW_LIBS}
${OpenCV_LIBS}
)
endif()
if(USE_TENSORFLOW_C)
# Setup Tensorflow C
set(TENSORFLOW_INCLUDES
${PROJECT_SOURCE_DIR}/third_party/libtensorflow_cpu/include)
set(TENSORFLOW_LIBS
${PROJECT_SOURCE_DIR}/third_party/libtensorflow_cpu/lib/libtensorflow.so)
include_directories(
${TENSORFLOW_INCLUDES}
${PROJECT_SOURCE_DIR}/third_party/eigen3
)
# Simple Net C
add_executable(load_simple_net_c_api simple/load_simple_net_c_api.cc utils/TFUtils.cpp)
target_link_libraries(load_simple_net_c_api
${TENSORFLOW_LIBS}
${OpenCV_LIBS}
)
# CNN Net C
add_executable(load_predict_cnn_c_api fashion_mnist/load_predict_cnn_c_api.cc utils/TFUtils.cpp)
target_link_libraries(load_predict_cnn_c_api
${TENSORFLOW_LIBS}
${OpenCV_LIBS}
)
endif()