forked from giacomodabisias/libfreenect2pclgrabber
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
88 lines (75 loc) · 3.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Copyright 2015, Giacomo Dabisias"
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# @Author
# Giacomo Dabisias, PhD Student
# PERCRO, (Laboratory of Perceptual Robotics)
# Scuola Superiore Sant'Anna
# via Luigi Alamanni 13D, San Giuliano Terme 56010 (PI), Italy
cmake_minimum_required(VERSION 2.8)
Project(kinect2grabber CXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
set(INCLUDE "${CMAKE_SOURCE_DIR}/include")
option(WITH_OPENCL "adds opencl support for freenect2" OFF)
if(${WITH_OPENCL})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_OPENCL")
endif()
option(WITH_CUDA "adds cuda support for freenect2" OFF)
if(${WITH_CUDA})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_CUDA")
endif()
option(WITH_SERIALIZATION "adds support for boost serialization" OFF)
if(${WITH_SERIALIZATION})
find_package(Boost REQUIRED)
include_directories(${INCLUDE})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_SERIALIZATION")
set(BOOST_LIBS "boost_serialization")
endif()
option(WITH_ROS "adds support for ROS" OFF)
if(${WITH_ROS})
find_package(catkin REQUIRED COMPONENTS roscpp std_msgs pcl_conversions pcl_ros
sensor_msgs cv_bridge image_transport tf
message_generation )
catkin_package( CATKIN_DEPENDS roscpp rospy std_msgs pcl_conversions pcl_ros
sensor_msgs cv_bridge image_transport tf
cmake_modules
)
include_directories(${catkin_INCLUDE_DIRS} include)
endif()
option(WITH_PCL "adds pcl cloud support" ON)
if(${WITH_PCL})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_PCL")
find_package(PCL REQUIRED)
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
include_directories(${PCL_INCLUDE_DIRS})
endif()
set(OpenCV_DIR "/usr/local/opencv320/share/OpenCV/")
find_package(OpenCV REQUIRED)
find_package(Freenect2 REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${FREENECT2_INCLUDE_DIRS})
include_directories(${INCLUDE})
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
add_executable(Kinect2Grabber test.cpp)
add_executable(MultiKinect2Grabber multi_test.cpp)
target_link_libraries(Kinect2Grabber ${OpenCV_LIBS} ${FREENECT2_LIBRARY} ${PCL_LIBRARIES} ${BOOST_LIBS})
target_link_libraries(MultiKinect2Grabber ${OpenCV_LIBS} ${FREENECT2_LIBRARY} ${PCL_LIBRARIES} ${BOOST_LIBS})
if(${WITH_ROS})
add_executable(RosKinect2Grabber test_ros.cpp)
target_link_libraries(RosKinect2Grabber ${catkin_LIBRARIES} ${OpenCV_LIBS} ${FREENECT2_LIBRARY} ${PCL_LIBRARIES} ${BOOST_LIBS})
endif()