-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
167 lines (109 loc) · 5.08 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Top level cmake file
# Suman Raj Bista
cmake_minimum_required( VERSION 3.0.0)
project(LineNavigation)
## Libary Paths
#set(CMAKE_PREFIX_PATH
# /home/suman/soft/third_party/naoqi/install/share/naoqi_libqi/cmake
# /home/suman/soft/third_party/naoqi/install/share/naoqi_libqicore/cmake
# )
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set (CMAKE_BUILD_TYPE RelWithDebInfo )
option(USE_BIAS_LIBRARY "Use BIAS library for line matching if not OpenCV version is used" ON)
option(USE_SYSTEM_ARPAK_SUPERLU "Use system Arpac, lapack, blas and superlu" OFF)
# Custom BIAS library
if(USE_BIAS_LIBRARY)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/BIAS_CMakeLists.txt)
endif()
set (CMAKE_CXX_STANDARD 11)
include_directories ( ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
include_directories(".")
find_package(OpenCV 4 REQUIRED)
include_directories( SYSTEM
${OpenCV_INCLUDE_DIRS}
)
## Look for Arpack and SuperlU library required for line mataching
## use system arpack, blas,superlu and lapack libaries
if(USE_SYSTEM_ARPAK_SUPERLU)
FIND_LIBRARY(ARPACK_LIBRARIES NAMES arpack)
if(NOT ARPACK_LIBRARIES)
message(FATAL_ERROR "ARPACK library not found")
endif()
FIND_LIBRARY(SUPERLU_LIBRARIES NAMES superlu)
if(NOT SUPERLU_LIBRARIES)
message(FATAL_ERROR "SUPERLU library not found")
endif()
FIND_LIBRARY(BLAS_LIBRARIES NAMES blas)
if(NOT BLAS_LIBRARIES)
message(FATAL_ERROR "BLAS library not found")
endif()
FIND_LIBRARY(LAPACK_LIBRARIES NAMES lapack)
if(NOT LAPACK_LIBRARIES)
message(FATAL_ERROR "LAPACK library not found")
endif()
set(ARLPSLU_LIBRARIES ${ARPACK_LIBRARIES}
${SUPERLU_LIBRARIES}
${BLAS_LIBRARIES}
${LAPACK_LIBRARIES} )
else()
## use custom built from sources => Required if built to run inside the Pepper Robot
if(EXISTS ${CMAKE_SOURCE_DIR}/linenav/arpack++/lib/libaplpsl_lin64.a)
set(ARLPSLU_LIBRARIES ${CMAKE_SOURCE_DIR}/linenav/arpack++/lib/libaplpsl_lin64.a)
else()
message("building custom arpack_superlu")
add_custom_target(ARLPSLU_LIBRARIES ALL)
add_custom_command(TARGET ARLPSLU_LIBRARIES COMMAND make all WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/linenav/arpack++ COMMENT "Building" USES_TERMINAL PRE_BUILD)
set(ARLPSLU_LIBRARIES ${CMAKE_SOURCE_DIR}/linenav/arpack++/lib/libaplpsl_lin64.a)
endif()
endif()
#find fortan libary (dependencies of ARPACK library)
FIND_LIBRARY(FORTRAN_LIBRARIES NAMES gfortran HINTS /usr/lib/gcc/x86_64-linux-gnu/9)
include_directories(linenav/arpack++/include)
# Line Matching sources and headers
if(USE_BIAS_LIBRARY)
set(BIAS_linematching_SRCS linenav/edlbd/EDLineDetector.cpp
linenav/edlbd/LineDescriptor.cpp
linenav/edlbd/PairwiseLineMatching.cpp )
set(BIAS_linematching_HDRS linenav/edlbd/EDLineDetector.hh
linenav/edlbd/LineDescriptor.hh
linenav/edlbd/LineStructure.hh
linenav/edlbd/PairwiseLineMatching.hh )
set(LineMatching_HDRS ${BIAS_HEADERS}
${BIAS_linematching_HDRS} )
set(LineMatching_SRCS ${BIAS_SOURCES}
${BIAS_linematching_SRCS} )
else()
set(LineMatching_HDRS linenav/EDLineDetector.cpp
linenav/LineDescriptor.cpp
linenav/PairwiseLineMatching.cpp )
set(LineMatching_SRCS linenav/EDLineDetector.hh
linenav/LineDescriptor.hh
linenav/LineStructure.hh
linenav/PairwiseLineMatching.hh )
endif()
set(HEADERS ${LineMatching_HDRS}
navmain/navigation.h
navmain/RobotInterface.h
navmain/ImagesOffline.h
linenav/linenavigation.h
linenav/linematch.h
linenav/dispnav.h
linenav/kimread.h
)
set(SOURCES ${LineMatching_SRCS}
navmain/navigation.cpp
navmain/RobotInterface.cpp
navmain/ImagesOffline.cpp
linenav/linenavigation.cpp
linenav/linematch.cpp
linenav/dispnav.cpp
linenav/kimread.cpp
)
set(SRCS navmain/nav_lineoffline.cpp )
include_directories(navmain)
set(extraLIBS ${ARLPSLU_LIBRARIES} ${FORTRAN_LIBRARIES})
message("${extraLIBS}")
add_executable (navigation_offline ${SRCS} ${SOURCES} ${HEADERS} )
target_link_libraries (navigation_offline ${extraLIBS} ${OpenCV_LIBS})