-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
111 lines (96 loc) · 2.83 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
cmake_minimum_required(VERSION 2.8.3)
project(map_server)
find_package(catkin REQUIRED
COMPONENTS
roscpp
tf
nav_msgs
)
find_package(SDL REQUIRED)
find_package(SDL_image REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(YAMLCPP yaml-cpp REQUIRED)
if(YAMLCPP_VERSION VERSION_GREATER "0.5.0")
add_definitions(-DHAVE_YAMLCPP_GT_0_5_0)
endif()
catkin_package(
INCLUDE_DIRS
include
${SDL_INCLUDE_DIR}
${SDL_IMAGE_INCLUDE_DIRS}
LIBRARIES
map_server_image_loader
${SDL_LIBRARY}
${SDL_IMAGE_LIBRARIES}
CATKIN_DEPENDS
roscpp
tf
nav_msgs
)
include_directories(
include
${catkin_INCLUDE_DIRS}
${SDL_INCLUDE_DIR}
${SDL_IMAGE_INCLUDE_DIRS}
${YAMLCPP_INCLUDE_DIRS}
)
add_library(map_server_image_loader src/image_loader.cpp)
target_link_libraries(map_server_image_loader
${catkin_LIBRARIES}
${SDL_LIBRARY}
${SDL_IMAGE_LIBRARIES}
)
add_executable(map_server src/main.cpp)
target_link_libraries(map_server
map_server_image_loader
${YAMLCPP_LIBRARIES}
${catkin_LIBRARIES}
)
add_executable(map_server-map_saver src/map_saver.cpp)
set_target_properties(map_server-map_saver PROPERTIES OUTPUT_NAME map_saver)
target_link_libraries(map_server-map_saver
${catkin_LIBRARIES}
)
# copy test data to same place as tests are run
function(copy_test_data)
cmake_parse_arguments(PROJECT "" "" "FILES" ${ARGN})
foreach(datafile ${PROJECT_FILES})
file(COPY ${datafile} DESTINATION ${PROJECT_BINARY_DIR}/test)
endforeach()
endfunction()
## Tests
if(CATKIN_ENABLE_TESTING)
copy_test_data( FILES
test/testmap.bmp
test/testmap.png )
catkin_add_gtest(${PROJECT_NAME}_utest test/utest.cpp test/test_constants.cpp)
target_link_libraries(${PROJECT_NAME}_utest
map_server_image_loader
${SDL_LIBRARY}
${SDL_IMAGE_LIBRARIES}
)
add_executable(rtest test/rtest.cpp test/test_constants.cpp)
target_link_libraries( rtest
gtest
${catkin_LIBRARIES}
)
add_dependencies(rtest nav_msgs_generate_messages_cpp)
# This has to be done after we've already built targets, or catkin variables get borked
find_package(rostest)
add_rostest(test/rtest.xml)
endif()
## Install executables and/or libraries
install(TARGETS map_server-map_saver map_server map_server_image_loader
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
## Install project namespaced headers
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE)
## Install excutable python script
install(
PROGRAMS
scripts/crop_map
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})