-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathCMakeLists.txt
91 lines (77 loc) · 2.45 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
cmake_minimum_required(VERSION 2.8.3)
project(map_server)
find_package(catkin REQUIRED
COMPONENTS
roscpp
tf
nav_msgs
)
find_package(Boost REQUIRED COMPONENTS system)
find_package(PkgConfig)
pkg_check_modules(NEW_YAMLCPP yaml-cpp>=0.5)
if(NEW_YAMLCPP_FOUND)
add_definitions(-DHAVE_NEW_YAMLCPP)
endif(NEW_YAMLCPP_FOUND)
catkin_package(
INCLUDE_DIRS
include
LIBRARIES
image_loader
CATKIN_DEPENDS
roscpp
tf
nav_msgs
)
include_directories( include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} )
add_library(image_loader src/image_loader.cpp)
target_link_libraries(image_loader SDL SDL_image ${Boost_LIBRARIES})
add_executable(map_server src/main.cpp)
target_link_libraries(map_server
image_loader
yaml-cpp
${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 image_loader SDL SDL_image)
add_executable(rtest test/rtest.cpp test/test_constants.cpp)
target_link_libraries( rtest
gtest
${catkin_LIBRARIES}
)
add_dependencies(rtest nav_msgs_gencpp)
# 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 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})