Statistics
| Branch: | Revision:

root / rgbdslam / CMakeLists.txt @ 9240aaa3

History | View | Annotate | Download (6.78 KB)

1
#########################################################
2
### CONFIG ##############################################
3
#########################################################
4
# 1, if SiftGPU should be used. For additional information
5
# see README
6
set(USE_SIFT_GPU        1)
7
set(ENV{SIFT_GPU_MODE}		2) #CUDA = 1, GLSL = 2
8
set(ENV{SIFT_GPU_CUDA_PATH}	/usr/local/cuda)	
9
	
10
set(USE_GICP_BIN		0)
11
set(USE_GICP_CODE		0)
12
#########################################################
13
#########################################################
14
#########################################################
15

    
16

    
17
cmake_minimum_required(VERSION 2.4.6)
18
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
19

    
20
# Set the build type.  Options are:
21
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
22
#  Debug          : w/ debug symbols, w/o optimization
23
#  Release        : w/o debug symbols, w/ optimization
24
#  RelWithDebInfo : w/ debug symbols, w/ optimization
25
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
26
set(ROS_BUILD_TYPE RelWithDebInfo)
27

    
28
#is used for compiling the libraries 
29
set(USE_GICP 0)
30
IF (${USE_GICP_BIN} OR ${USE_GICP_CODE})
31
	set(USE_GICP 1)
32
ENDIF (${USE_GICP_BIN} OR ${USE_GICP_CODE})
33

    
34
rosbuild_init()
35

    
36
#set the default path for built executables to the "bin" directory
37
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
38
#set the default path for built libraries to the "lib" directory
39
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
40

    
41
#uncomment if you have defined messages
42
#rosbuild_genmsg()
43
#uncomment if you have defined services
44
rosbuild_gensrv()
45
#common commands for building c++ executables and libraries
46
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
47
#target_link_libraries(${PROJECT_NAME} another_library) 
48
#rosbuild_add_boost_directories()
49
#rosbuild_link_boost(${PROJECT_NAME} thread)
50
#rosbuild_add_executable(example examples/example.cpp)
51

    
52

    
53
##############################################################################
54
# Required 3rd party
55
##############################################################################
56

    
57
#############################
58
# Qt ########################
59
#############################
60
# http://qtnode.net/wiki/Qt4_with_cmake
61
find_package(Qt4 REQUIRED)
62
SET(QT_USE_QTXML TRUE)
63
SET(QT_USE_QTOPENGL TRUE)
64
ADD_DEFINITIONS(-DQT_NO_KEYWORDS)
65
include(${QT_USE_FILE})
66

    
67
# This is necessary as all ui files etc will get dumped in the bottom of then binary directory. 
68
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${QT_QTOPENGL_INCLUDE_DIR} gicp/ann_1.1.1/include/)
69

    
70
#get_directory_property(clean ADDITIONAL_MAKE_CLEAN_FILES)
71
#SET(clean external/siftgpu/linux/bin/libsiftgpu.so)
72
#set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${clean}")
73
 	
74
LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH})
75
SET(${CMAKE_LIBRARY_PATH} ${LIBRARY_OUTPUT_PATH})
76
#SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE TRUE)
77

    
78

    
79

    
80
#############################
81
# SiftGPU ###################
82
#############################
83
IF (${USE_SIFT_GPU})
84
	SET(sift_gpu_build_path ${CMAKE_SOURCE_DIR}/external/siftgpu/linux)
85

    
86
	include_directories(${CMAKE_CURRENT_BINARY_DIR} external/siftgpu/src)
87
	
88
	MESSAGE("\n------------------------------------------------------------------\n")
89
	MESSAGE("Compiling SiftGPU...")
90
	EXECUTE_PROCESS(
91
		COMMAND make siftgpu
92
		WORKING_DIRECTORY ${sift_gpu_build_path}
93
		RESULT_VARIABLE sift_gpu_return
94
	)
95
	MESSAGE("\n------------------------------------------------------------------\n")
96
	
97
	#on error
98
	IF (NOT ${sift_gpu_return} EQUAL 0)
99
		MESSAGE(FATAL_ERROR "SiftGPU cannot be compiled. Returned: ${sift_gpu_return}")
100
	ENDIF (NOT ${sift_gpu_return} EQUAL 0)
101
	
102
	FILE(COPY external/siftgpu/linux/bin/libsiftgpu.so DESTINATION ../lib)
103
	
104
	add_definitions(-DUSE_SIFT_GPU)
105
	add_definitions(-DSIFT_GPU_MODE=$ENV{SIFT_GPU_MODE})
106
ENDIF (${USE_SIFT_GPU})
107

    
108

    
109

    
110
#############################
111
# GICP ######################
112
#############################
113
IF (${USE_GICP})
114
    MESSAGE("\n------------------------------------------------------------------\n")
115
	MESSAGE("Compiling GICP...")
116
	EXECUTE_PROCESS(
117
	    COMMAND make linux-g++
118
	    WORKING_DIRECTORY gicp/ann_1.1.1/ 
119
	    RESULT_VARIABLE gicp_return
120
    )
121
    MESSAGE("\n------------------------------------------------------------------\n")
122
	
123
	#on error
124
	IF (NOT ${gicp_return} EQUAL 0)
125
		MESSAGE(FATAL_ERROR "GICP cannot be compiled. Returned: ${gicp_return}")
126
	ENDIF (NOT ${gicp_return} EQUAL 0)
127
	
128
	FILE(COPY gicp/ann_1.1.1/lib/libANN.a DESTINATION ../lib)
129
ENDIF (${USE_GICP})
130

    
131
IF (${USE_GICP_BIN})
132
	add_definitions(-DUSE_ICP_BIN)
133
ENDIF (${USE_GICP_BIN})
134

    
135
IF (${USE_GICP_CODE})
136
	add_definitions(-DUSE_ICP_CODE) 
137
ENDIF (${USE_GICP_CODE})
138

    
139

    
140

    
141
#############################
142
# OpenCV ####################
143
#############################
144
find_package(OpenCV)
145
include_directories(${OpenCV_INCLUDE_DIRS})
146

    
147
##############################################################################
148
# Sections
149
##############################################################################
150

    
151
file(GLOB QT_FORMS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ui/*.ui)
152
file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/*.qrc)
153
file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/local/*.hpp src/qtros.h src/openni_listener.h src/qt_gui.h src/graph_manager.h src/glviewer.h src/ros_service_ui.h)
154

    
155
QT4_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES})
156
QT4_WRAP_UI(QT_FORMS_HPP ${QT_FORMS})
157
QT4_WRAP_CPP(QT_MOC_HPP ${QT_MOC})  
158

    
159
##############################################################################
160
# Sources
161
##############################################################################
162
SET(ADDITIONAL_SOURCES src/gicp-fallback.cpp src/main.cpp src/qtros.cpp  src/openni_listener.cpp src/qt_gui.cpp src/flow.cpp src/node.cpp src/graph_manager.cpp src/glviewer.cpp src/parameter_server.cpp src/ros_service_ui.cpp src/misc.cpp)
163

    
164
IF (${USE_SIFT_GPU})
165
 	SET(ADDITIONAL_SOURCES ${ADDITIONAL_SOURCES} src/sift_gpu_feature_detector.cpp)
166
ENDIF (${USE_SIFT_GPU})
167

    
168
file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS ${ADDITIONAL_SOURCES})
169

    
170
##############################################################################
171
# Binaries
172
##############################################################################
173
rosbuild_add_executable(rgbdslam ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP})
174

    
175
#set libs
176
SET(LIBS_LINK rgbdslam GL GLU g2o_types_slam3d g2o_solver_cholmod g2o_solver_pcg g2o_solver_csparse ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} ${GLUT_LIBRARY} ${OPENGL_LIBRARY} ${OpenCV_LIBS})
177

    
178
IF (${USE_SIFT_GPU})
179
 	SET(LIBS_LINK ${LIBS_LINK} siftgpu)
180
ENDIF (${USE_SIFT_GPU})
181

    
182
IF (${USE_GICP})
183
 	SET(LIBS_LINK ${LIBS_LINK} gicp ANN gsl gslcblas)
184
ENDIF (${USE_GICP})
185
 
186
IF (${USE_GICP})
187
  rosbuild_add_library(gicp gicp/bfgs_funcs.cpp gicp/gicp.cpp gicp/optimize.cpp gicp/scan.cpp gicp/transform.cpp)
188
ENDIF (${USE_GICP})
189

    
190
#link libraries
191
target_link_libraries(${LIBS_LINK})
192