This repository has been archived by the owner on Jul 17, 2023. It is now read-only.
forked from ethz-ait/duo3d_ros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
116 lines (97 loc) · 3.07 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
cmake_minimum_required(VERSION 2.8.3)
set(ProjectName duo3d_ros)
project(${ProjectName})
find_package(catkin REQUIRED COMPONENTS
geometry_msgs
roscpp
tf
camera_info_manager
image_transport
dynamic_reconfigure
pcl_ros
sensor_msgs
message_generation
ait_ros_messages
)
find_package(Boost REQUIRED)
find_package(PCL REQUIRED)
# Get DUO_SDK install path from environment variable if set
if(DEFINED ENV{DUO_SDK})
set(DUO_SDK $ENV{DUO_SDK} )
else()
set(DUO_SDK ${CMAKE_CURRENT_SOURCE_DIR}/../SDK)
endif()
# Add DUO include and lib
include_directories(${DUO_SDK}/include ${PCL_INCLUDE_DIRS})
# Detect Compiler / Arch and add libraries
if(MSVC)
if(CMAKE_CL_64)
set(DUOLib_ARCH x64)
else()
set(DUOLib_ARCH x86)
endif()
if(MSVC_VERSION EQUAL 1600)
set(DUOLib_RUNTIME msvc2010)
elseif(MSVC_VERSION EQUAL 1700)
set(DUOLib_RUNTIME msvc2012)
endif()
link_directories(${DUO_SDK}/windows/${DUOLib_RUNTIME}/${DUOLib_ARCH})
file(TO_NATIVE_PATH ${DUO_SDK}/windows/${DUOLib_RUNTIME}/${DUOLib_ARCH}/DUOLib.dll SRC)
file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin/. DST)
execute_process(COMMAND cmd /c copy /y ${SRC} ${DST})
# Set output directory for binaries
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin )
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin )
elseif(APPLE)
link_directories(${DUO_SDK}/osx/x64/)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
elseif(UNIX)
if( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l")
set(DUOLib_ARCH arm)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(DUOLib_ARCH x64)
else()
set(DUOLib_ARCH x86)
endif()
link_directories(${DUO_SDK}/linux/${DUOLib_ARCH}/)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
endif()
generate_dynamic_reconfigure_options(
cfg/Duo.cfg
)
#add_message_files(
# FILES
# Duo3d.msg
#)
#generate_messages(
# DEPENDENCIES
# std_msgs
# sensor_msgs
#)
catkin_package( CATKIN_DEPENDS geometry_msgs roscpp tf message_runtime)
include_directories(include ${catkin_INCLUDE_DIRS})
add_executable(duo_node src/driverDUOstereo.cpp src/node.cpp)
#add_executable(dense3d src/duo_dense3d.cpp)
add_dependencies(duo_node ${PROJECT_NAME}_gencfg ${PROJECT_NAME}_generate_messages_cpp)
# for linking duo_node to dynamic_reconfigure cfg files
target_link_libraries(duo_node ${catkin_LIBRARIES} )
set_target_properties(duo_node PROPERTIES COMPILE_FLAGS -g)
#target_link_libraries(dense3d ${catkin_LIBRARIES} ${PCL_LIBRARIES})
#set_target_properties(dense3d PROPERTIES COMPILE_FLAGS -g)
if(WIN32)
target_link_libraries(duo_node DUOlib)
# target_link_libraries(dense3d DUOlib)
elseif(UNIX OR APPLE)
target_link_libraries(duo_node DUO)
# target_link_libraries(dense3d duo)
endif()
#############
## Testing ##
#############
## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_duo3d_ros.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
## Add folders to be run by python nosetests
# catkin_add_nosetests(test)