-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
70 lines (55 loc) · 2.17 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
cmake_minimum_required(VERSION 2.8)
project(test-paddle)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(CheckCXXCompilerFlag)
if(UNIX)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
add_definitions(-std=c++11)
elseif(COMPILER_SUPPORTS_CXX0X)
add_definitions(-std=c++0x)
endif()
endif()
message("PADDLEROOT: $ENV{PADDLEROOT}")
# ---[ Find include dir
find_path(PADDLE_INCLUDE_DIR NAMES "paddle/fluid/inference/paddle_inference_api.h" HINTS "$ENV{PADDLEROOT}" PATHS "$ENV{PADDLEROOT}" )
message("PADDLE_INCLUDE: ${PADDLE_INCLUDE_DIR}")
find_library(PADDLE_LIBRARY
NAMES paddle_fluid
PATHS $ENV{PADDLEROOT}/paddle/fluid/inference)
message("PADDLE_LIBRARY: ${PADDLE_LIBRARY}")
if(PADDLE_LIBRARY)
message(STATUS "Found Paddle-Fluid (include: ${PADDLE_INCLUDE_DIR}, lib: ${PADDLE_LIBRARY}")
include_directories(${PADDLE_INCLUDE_DIR})
include_directories($ENV{PADDLEROOT}/third_party/eigen3)
else()
message(FATAL " Intel PADDLE not located properly")
endif()
find_library(PADDLE_INFERENCE_LIBRARY
NAMES paddle_inference_api
PATHS $ENV{PADDLEROOT}/paddle/fluid/inference)
# protobuf version has to match among paddle that generates it and inference program that loads protobuf
include_directories($ENV{PADDLEROOT}/third_party/install/protobuf/include)
include_directories("$ENV{PADDLEROOT}/third_party/install/gflags/include")
# Threading
find_package(Threads REQUIRED)
#OpenCV
find_package( OpenCV REQUIRED )
#set(OpenCV_INCLUDE_DIRS "/usr/local/include/opencv2/")
#set(OpenCV_LIBS "/usr/local/lib/libopencv_core.so")
include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
message(STATUS "OpenCV found (${OpenCV_CONFIG_PATH})")
add_executable(test-paddle-fluid main.cpp)
set(CMAKE_EXE_LINKER_FLAGS -Wl,-rpath,/usr/local/lib64)
add_definitions(-Wall)
target_link_libraries(test-paddle-fluid
${PADDLE_INFERENCE_LIBRARY}
${PADDLE_LIBRARY}
${OpenCV_LIBS}
${CMAKE_THREAD_LIBS_INIT}
-lpthread
$ENV{PADDLEROOT}/third_party/install/mklml/lib/libmklml_intel.so
$ENV{PADDLEROOT}/third_party/install/protobuf/lib/libprotobuf.a
$ENV{PADDLEROOT}/third_party/install/gflags/lib/libgflags.a
)