~csiro-asl/csiro-asl-ros-drivers/trunk

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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
include(WriteConfigH.cmake)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
set(ROS_BUILD_TYPE Debug)

rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#uncomment if you have defined messages
rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()

set(GBX_DIR "build/gearbox_9.07")
set(GBXBASE_DIR "${GBX_DIR}/gearbox-9.07/src")
include_directories(${GBXBASE_DIR})
include_directories(src)

set( gbx_util_files 
	${GBXBASE_DIR}/gbxutilacfr/trivialtracer.h
	${GBXBASE_DIR}/gbxutilacfr/mathdefs.h
	${GBXBASE_DIR}/gbxutilacfr/trivialtracer.cpp
	${GBXBASE_DIR}/gbxutilacfr/status.h
	${GBXBASE_DIR}/gbxutilacfr/tokenise.cpp
	${GBXBASE_DIR}/gbxutilacfr/stoppable.h
	${GBXBASE_DIR}/gbxutilacfr/exceptions.h
    ${GBXBASE_DIR}/gbxutilacfr/exceptions.cpp
	${GBXBASE_DIR}/gbxutilacfr/status.cpp
	${GBXBASE_DIR}/gbxutilacfr/substatus.h
	${GBXBASE_DIR}/gbxutilacfr/gbxutilacfr.h
	${GBXBASE_DIR}/gbxutilacfr/tracer.cpp
	${GBXBASE_DIR}/gbxutilacfr/trivialstatus.cpp
	${GBXBASE_DIR}/gbxutilacfr/subhealth.h
	${GBXBASE_DIR}/gbxutilacfr/trivialstatus.h
	${GBXBASE_DIR}/gbxutilacfr/tokenise.h
	${GBXBASE_DIR}/gbxutilacfr/tracer.h
)

set( gbx_lockfile_files
	${GBXBASE_DIR}/gbxserialacfr/lockfile/lockfile.cpp
	${GBXBASE_DIR}/gbxserialacfr/lockfile/lockfile.h
)

set( gbx_serial_files
	${GBXBASE_DIR}/gbxserialacfr/serial.cpp
	${GBXBASE_DIR}/gbxserialacfr/uncopyable.h
	${GBXBASE_DIR}/gbxserialacfr/gbxserialacfr.h
	${GBXBASE_DIR}/gbxserialacfr/serial.h
)	

set( gbx_novatel_util_files
    ${GBXBASE_DIR}/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.h
    ${GBXBASE_DIR}/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.cpp
    ${GBXBASE_DIR}/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.h
    ${GBXBASE_DIR}/gbxnovatelacfr/gbxnovatelutilacfr/receiverstatusdecoder.h
    ${GBXBASE_DIR}/gbxnovatelacfr/gbxnovatelutilacfr/crc32.cpp
    ${GBXBASE_DIR}/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.cpp
    ${GBXBASE_DIR}/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h
    ${GBXBASE_DIR}/gbxnovatelacfr/gbxnovatelutilacfr/crc32.h
)

set( gbx_novatel_files
    ${GBXBASE_DIR}/gbxnovatelacfr/driver.h
    ${GBXBASE_DIR}/gbxnovatelacfr/driver.cpp
)


#common commands for building c++ executables and libraries
rosbuild_add_library(GbxUtilAcfr ${gbx_util_files})
rosbuild_add_library(GbxLockFileAcfr ${gbx_lockfile_files})
rosbuild_add_library(GbxSerialAcfr ${gbx_serial_files})
rosbuild_add_library(GbxNovatelUtilAcfr ${gbx_novatel_util_files})
rosbuild_add_library(GbxNovatelAcfr ${gbx_novatel_files})
rosbuild_add_library(gps_convert src/gps_convert.cpp include/novatelINS/gps_convert.h)

target_link_libraries(GbxNovatelAcfr GbxUtilAcfr GbxSerialAcfr GbxNovatelUtilAcfr)
target_link_libraries(GbxNovatelUtilAcfr GbxUtilAcfr GbxSerialAcfr)
target_link_libraries(GbxSerialAcfr GbxLockFileAcfr)

#rosbuild_add_boost_directories()
#rosbuild_link_boost(${PROJECT_NAME} thread)

set_source_files_properties(${gbx_util_files} PROPERTIES GENERATED 1)
set_source_files_properties(${gbx_lockfile_files} PROPERTIES GENERATED 1)
set_source_files_properties(${gbx_serial_files} PROPERTIES GENERATED 1)
set_source_files_properties(${gbx_novatel_util_files} PROPERTIES GENERATED 1)
set_source_files_properties(${gbx_novatel_files} PROPERTIES GENERATED 1)

# Download the required gearbox libraries
IF(APPLIED_GBX_PATCH)
	message(STATUS "Gearbox patch already applied.")
	set(GBX_PATCH_CMD echo "Patch already applied")	# dummy line
ELSE(APPLIED_GBX_PATCH)
	message(STATUS "Gearbox patch not applied. Will download Gearbox and patch.")
	set(GBX_MD5 "7495fc9e40b30d254cf4b9bef190b9e0")
	rosbuild_download_data(http://sourceforge.net/projects/gearbox/files/gearbox/9.07/gearbox-9.07.tar.gz ${GBX_DIR}/gearbox-9.07.tar.gz ${GBX_MD5})
	rosbuild_untar_file(${GBX_DIR}/gearbox-9.07.tar.gz ${GBX_DIR}/geabox-9.07 GbxUtilAcfr)#ALL)#rosbuild_precompile
	# Patch it all
	set(GBX_PATCH_CMD cp -r ${PROJECT_SOURCE_DIR}/src/changedOrcaFiles/* ${PROJECT_SOURCE_DIR}/${GBXBASE_DIR}/) #TODO maybe use rsync so it doesn't try to copy the .svn dirs.
	set(APPLIED_GBX_PATCH TRUE CACHE INTERNAL "Gearbox patch setup." )
ENDIF(APPLIED_GBX_PATCH)

# make the actual ROS interface
rosbuild_add_executable(novatelINSdriver src/NovatelInterface.cpp include/novatelINS/NovatelInterface.h)
target_link_libraries(novatelINSdriver gps_convert GbxNovatelAcfr)

# Setup dependency tree
add_custom_command(OUTPUT gbx_patch COMMAND ${GBX_PATCH_CMD})
add_custom_target(gbx_patch_target DEPENDS gbx_patch)
add_dependencies(gbx_patch_target GbxUtilAcfr)
add_dependencies(GbxLockFileAcfr gbx_patch_target)
add_dependencies(GbxSerialAcfr GbxLockFileAcfr)
add_dependencies(GbxNovatelUtilAcfr GbxSerialAcfr)
add_dependencies(GbxNovatelAcfr GbxNovatelUtilAcfr)