Skip to content

Commit 1af7502

Browse files
committed
Add include guard to image_downloader.h
1 parent f4f5f1f commit 1af7502

File tree

2 files changed

+31
-41
lines changed

2 files changed

+31
-41
lines changed

CMakeLists.txt

+29-41
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,19 @@
1-
cmake_minimum_required(VERSION 3.0.2)
1+
cmake_minimum_required(VERSION 3.1)
22
project(rviz_aerial_map)
33

44
set(RVIZ_AERIAL_MAP_VERSION "1.0.0")
5+
set(CMAKE_CXX_STANDARD 11)
6+
set(CMAKE_AUTOMOC ON)
57

6-
# ROS dependencies
78
find_package(catkin REQUIRED COMPONENTS
89
roscpp
9-
roslint
1010
rviz
1111
sensor_msgs
1212
ogre_primitives
1313
tas_proj)
1414

1515
# System dependencies
1616
find_package(GDAL)
17-
find_package(Boost REQUIRED)
18-
find_package(Qt5 COMPONENTS Core Gui Network Concurrent REQUIRED)
19-
find_package(PkgConfig REQUIRED)
20-
pkg_check_modules(OGRE_OV OGRE OGRE-Overlay)
21-
# Old versions of OGRE (pre 1.9) included OGRE-Overlay in the main package
22-
# (i.e. there was no OGRE-Overlay component). So if the above
23-
# pkg_check_modules() failed, try looking for just OGRE.
24-
if (NOT OGRE_OV_FOUND)
25-
pkg_check_modules(OGRE_OV REQUIRED OGRE)
26-
endif ()
2717

2818
###################################
2919
## catkin specific configuration ##
@@ -33,7 +23,7 @@ catkin_package(
3323
INCLUDE_DIRS include
3424
LIBRARIES map_helper
3525
CATKIN_DEPENDS tas_proj
36-
DEPENDS Qt5Core GDAL Boost)
26+
DEPENDS GDAL)
3727

3828
###########
3929
## Build ##
@@ -42,16 +32,27 @@ catkin_package(
4232
include_directories(
4333
include
4434
${catkin_INCLUDE_DIRS}
45-
${Qt5Core_INCLUDE_DIRS}
46-
${Qt5Gui_INCLUDE_DIRS}
47-
${Qt5Network_INCLUDE_DIRS}
48-
${Qt5Concurrent_INCLUDE_DIRS}
4935
${GDAL_INCLUDE_DIRS}
50-
${BOOST_INCLUDE_DIRS}
51-
${OGRE_OV_INCLUDE_DIRS}
52-
${CMAKE_CURRENT_BINARY_DIR}
5336
)
5437

38+
## This plugin includes Qt widgets, so we must include Qt.
39+
## We'll use the version that rviz used so they are compatible.
40+
if (rviz_QT_VERSION VERSION_LESS "5")
41+
message(STATUS "Using Qt4 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
42+
find_package(Qt4 ${rviz_QT_VERSION} EXACT REQUIRED QtCore QtGui QtNetwork)
43+
## pull in all required include dirs, define QT_LIBRARIES, etc.
44+
include(${QT_USE_FILE})
45+
else ()
46+
message(STATUS "Using Qt5 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
47+
find_package(Qt5 COMPONENTS Core Widgets Network REQUIRED)
48+
## make target_link_libraries(${QT_LIBRARIES}) pull in all required dependencies
49+
set(QT_LIBRARIES Qt5::Widgets Qt5::Network)
50+
endif ()
51+
52+
## I prefer the Qt signals and slots to avoid defining "emit", "slots",
53+
## etc because they can conflict with boost signals, so define QT_NO_KEYWORDS here.
54+
add_definitions(-DQT_NO_KEYWORDS)
55+
5556
# Build map helper library
5657
add_library(map_helper
5758
src/map_helpers/tiff_tile_helper.cpp
@@ -65,38 +66,25 @@ target_link_libraries(map_helper
6566
)
6667

6768
# Build rviz plugin library
68-
add_definitions("-Wall -Wunused -std=c++11 -DRVIZ_AERIAL_MAP_VERSION=\"\\\"${RVIZ_AERIAL_MAP_VERSION}\\\"\"")
69-
set(${PROJECT_NAME}_HEADERS
70-
src/aerial_map_display.h
71-
src/vis_helpers/image_downloader.h
72-
)
73-
qt5_wrap_cpp(${PROJECT_NAME}_MOCSrcs ${${PROJECT_NAME}_HEADERS})
69+
add_definitions("-DRVIZ_AERIAL_MAP_VERSION=\"\\\"${RVIZ_AERIAL_MAP_VERSION}\\\"\"")
7470

7571
add_library(${PROJECT_NAME}
7672
src/aerial_map_display.cpp
7773
src/vis_helpers/image_downloader.cpp
7874
src/vis_helpers/texture_cache.cpp
79-
${${PROJECT_NAME}_MOCSrcs}
80-
)
81-
target_link_libraries(${PROJECT_NAME}
82-
${catkin_LIBRARIES}
83-
${Qt5Core_LIBRARIES}
84-
${Qt5Gui_LIBRARIES}
85-
${Qt5Network_LIBRARIES}
86-
${Qt5Concurrent_LIBRARIES}
87-
map_helper
8875
)
76+
target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES} ${catkin_LIBRARIES} map_helper)
8977

90-
roslint_cpp()
78+
add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
9179

9280
#############
9381
## Install ##
9482
#############
9583

9684
install(TARGETS ${PROJECT_NAME}
97-
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
98-
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
99-
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
100-
)
85+
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
86+
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
87+
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
88+
)
10189

10290
install(FILES plugin_description.xml DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})

src/vis_helpers/image_downloader.h

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
* POSSIBILITY OF SUCH DAMAGE.
3333
*********************************************************************/
3434

35+
#pragma once
36+
3537
#include <functional>
3638

3739
#include <QImageReader>

0 commit comments

Comments
 (0)