source: source/ariba/CMakeLists.txt@ 12747

Last change on this file since 12747 was 12060, checked in by hock@…, 11 years ago

Reintegrate branch: 20130111-hock-message_classes

improvements:

  • new message classes (reboost, zero-copy)
  • "fast path" for direct links (skip overlay layer)
  • link-properties accessible from the application
  • SystemQueue can call boost::bind functions
  • protlib compatibility removed (32bit overhead saved in every message)
  • addressing2
  • AddressDiscovery discoveres only addresses on which we're actually listening
  • ariba serialization usage reduced (sill used in OverlayMsg)
  • Node::connect, easier and cleaner interface to start-up ariba from the application
  • ariba configs via JSON, XML, etc (boost::property_tree)
  • keep-alive overhead greatly reduced
  • (relayed) overlay links can actually be closed now
  • lost messages are detected in most cases
  • notification to the application when link is transformed into direct-link
  • overlay routing: send message to second best hop if it would be dropped otherwise
  • SequenceNumbers (only mechanisms, so for: upward compatibility)
  • various small fixes


regressions:

  • bluetooth is not yet working again
  • bootstrap modules deactivated
  • liblog4xx is not working (use cout-logging)

This patch brings great performance and stability improvements at cost of backward compatibility.
Also bluetooth and the bootstrap modules have not been ported to the new interfaces, yet.

File size: 8.6 KB
Line 
1# [License]
2# The Ariba-Underlay Copyright
3#
4# Copyright (c) 2008-2012, Institute of Telematics, UniversitÀt Karlsruhe (TH)
5#
6# Institute of Telematics
7# UniversitÀt Karlsruhe (TH)
8# Zirkel 2, 76128 Karlsruhe
9# Germany
10#
11# Redistribution and use in source and binary forms, with or without
12# modification, are permitted provided that the following conditions are
13# met:
14#
15# 1. Redistributions of source code must retain the above copyright
16# notice, this list of conditions and the following disclaimer.
17# 2. Redistributions in binary form must reproduce the above copyright
18# notice, this list of conditions and the following disclaimer in the
19# documentation and/or other materials provided with the distribution.
20#
21# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
22# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
25# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32#
33# The views and conclusions contained in the software and documentation
34# are those of the authors and should not be interpreted as representing
35# official policies, either expressed or implied, of the Institute of
36# Telematics.
37# [License]
38
39cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
40project(libariba)
41
42list(APPEND CMAKE_MODULE_PATH "${libariba_SOURCE_DIR}/../../CMakeModules")
43
44
45######################################################
46### Increment this whenever the interface changes! ###
47######################################################
48set(ariba_SOVERSION 2)
49######################################################
50
51
52# Find Boost
53find_package(BoostAdditionalVersions QUIET)
54if(NOT DEFINED BoostAdditionalVersions_FOUND)
55 message(WARNING "Could not find FindBoostAdditionalVersions.cmake. "
56 "This might cause the Boost detection to fail")
57endif()
58find_package(Boost 1.42.0 REQUIRED COMPONENTS system thread)
59if(NOT Boost_FOUND)
60 message(FATAL_ERROR "Could not find Boost. "
61 "Please have a look at the Boost_* cache variables.")
62endif(NOT Boost_FOUND)
63
64mark_as_advanced(Boost_DIR)
65include(BoostPthreadWorkaround)
66
67include_directories(${Boost_INCLUDE_DIRS})
68list(APPEND ariba_LINK_LIBRARIES ${Boost_LIBRARIES})
69
70
71# Find gmp
72find_package(GMP REQUIRED)
73if(NOT GMP_FOUND)
74 message(FATAL_ERROR "Could not find GMP. "
75 "Please have a look at the GMP_* cache variables.")
76endif(NOT GMP_FOUND)
77include_directories(${GMP_INCLUDE_DIRS})
78list(APPEND ariba_LINK_LIBRARIES ${GMP_LIBRARIES})
79
80
81# Bluetooth support?
82find_package(LibBluetooth)
83if(NOT LIBBLUETOOTH_FOUND)
84 message(STATUS "Couldn't find libbluetooth. "
85 "Will build ariba withouth bluetooth support")
86endif()
87include(CMakeDependentOption)
88cmake_dependent_option(ENABLE_BLUETOOTH
89 "Enable bluetooth support" #doc
90 ON # default value
91 "LIBBLUETOOTH_FOUND" # only show if this evaluates to true
92 OFF # value if the condition is not met
93 )
94if(ENABLE_BLUETOOTH)
95 set(HAVE_LIBBLUETOOTH TRUE)
96 include_directories("${LIBBLUETOOTH_INCLUDE_DIR}")
97 list(APPEND ariba_LINK_LIBRARIES ${LIBBLUETOOTH_LIBRARIES})
98endif(ENABLE_BLUETOOTH)
99
100
101# Avahi support?
102find_package(Avahi COMPONENTS client common)
103if(NOT AVAHI_FOUND)
104 message(STATUS "Couldn't find Avahi. "
105 "Will build ariba withouth multicast DNS support")
106endif()
107cmake_dependent_option(ENABLE_AVAHI
108 "Enable Avahi (multicast DNS) support" #doc
109 ON # default value
110 "AVAHI_FOUND" # only show if this evaluates to true
111 OFF # value if the condition is not met
112 )
113if(ENABLE_AVAHI)
114 set(HAVE_AVAHI TRUE)
115 include_directories(${AVAHI_INCLUDE_DIRS})
116 list(APPEND ariba_LINK_LIBRARIES ${AVAHI_LIBRARIES})
117endif(ENABLE_AVAHI)
118
119
120# Log4Cxx support?
121find_package(Log4Cxx)
122if(NOT LOG4CXX_FOUND)
123 message(STATUS "Couldn't find Log4Cxx. "
124 "Will build ariba withouth extended logging support")
125endif()
126cmake_dependent_option(ENABLE_LOG4CXX
127 "Enable Log4Cxx (extended logging) support" #doc
128 ON # default value
129 "LOG4CXX_FOUND" # only show if this evaluates to true
130 OFF # value if the condition is not met
131 )
132if(ENABLE_LOG4CXX)
133 set(HAVE_LOG4CXX TRUE)
134 include_directories(${LOG4CXX_INCLUDE_DIRS})
135 list(APPEND ariba_LINK_LIBRARIES ${LOG4CXX_LIBRARIES})
136endif(ENABLE_LOG4CXX)
137
138
139
140set(add_headers_INSTALL_DIR include/ariba/)
141set(add_headers_INSTALL_COMPONENT Development)
142set(add_headers_VAR libariba_HEADERS)
143set(add_sources_VAR libariba_SOURCES)
144
145# Voodoo to collect the source files from the subdirectories
146function(add_subdir_sources_helper subdir)
147 set(CURRENT_SOURCE_DIR "${CURRENT_SOURCE_DIR}${subdir}/")
148 set(add_headers_INSTALL_DIR "${add_headers_INSTALL_DIR}${subdir}/")
149 add_subdirectory(${subdir})
150 set(${add_headers_VAR} ${${add_headers_VAR}} PARENT_SCOPE)
151 set(${add_sources_VAR} ${${add_sources_VAR}} PARENT_SCOPE)
152endfunction(add_subdir_sources_helper subdir)
153
154macro(add_subdir_sources subdirs)
155 foreach(subdir ${subdirs} ${ARGN})
156 add_subdir_sources_helper(${subdir})
157 endforeach(subdir ${subdirs} ${ARGN})
158 set(${add_headers_VAR} ${${add_headers_VAR}} PARENT_SCOPE)
159 set(${add_sources_VAR} ${${add_sources_VAR}} PARENT_SCOPE)
160endmacro(add_subdir_sources subdirs)
161
162macro(add_headers sources)
163 foreach(source ${sources} ${ARGN})
164 list(APPEND ${add_headers_VAR} "${CURRENT_SOURCE_DIR}${source}")
165 endforeach(source ${sources} ${ARGN})
166
167 install(FILES ${sources} ${ARGN}
168 DESTINATION "${add_headers_INSTALL_DIR}"
169 COMPONENT "${add_headers_INSTALL_COMPONENT}"
170 )
171
172 set(${add_headers_VAR} ${${add_headers_VAR}} PARENT_SCOPE)
173endmacro(add_headers sources)
174
175macro(add_sources sources)
176 foreach(source ${sources} ${ARGN})
177 list(APPEND ${add_sources_VAR} "${CURRENT_SOURCE_DIR}${source}")
178 endforeach(source ${sources} ${ARGN})
179 set(${add_sources_VAR} ${${add_sources_VAR}} PARENT_SCOPE)
180endmacro(add_sources sources)
181
182
183# Headers to be exported
184add_headers(
185 ariba.h
186# AribaModule.h
187 CommunicationListener.h
188 DataMessage.h
189 Identifiers.h
190 LinkProperties.h
191 Message.h
192 Module.h
193 Name.h
194 Node.h
195 NodeListener.h
196 SideportListener.h
197 SpoVNetProperties.h
198 )
199
200add_sources(
201# AribaModule.cpp
202 CommunicationListener.cpp
203 DataMessage.cpp
204 Identifiers.cpp
205 LinkProperties.cpp
206 Module.cpp
207 Name.cpp
208 Node.cpp
209 NodeListener.cpp
210 SideportListener.cpp
211 SpoVNetProperties.cpp
212 )
213
214# Can't use add_subdir_sources() here because we want it in this scope not
215# in our parent's scope
216add_subdir_sources_helper(communication)
217add_subdir_sources_helper(overlay)
218add_subdir_sources_helper(utility)
219
220
221if(CMAKE_BUILD_TYPE)
222 if(${CMAKE_BUILD_TYPE} STREQUAL Debug)
223 set(DEBUG ON)
224 endif()
225endif()
226
227option(HAVE_MAEMO
228 "Whether we compile for the maemo platform" #TODO: maybe detect automatically
229 OFF
230 )
231
232set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall")
233set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
234
235# Configure the template file
236configure_file(
237 config.h.in
238 config.h
239 )
240include_directories("${CMAKE_CURRENT_BINARY_DIR}/..")
241list(APPEND libariba_HEADERS "${CMAKE_CURRENT_BINARY_DIR}/config.h")
242install(FILES "${CMAKE_CURRENT_BINARY_DIR}/config.h"
243 DESTINATION "${add_headers_INSTALL_DIR}"
244 COMPONENT "${add_headers_INSTALL_COMPONENT}"
245 )
246
247# Add the parent directory to the includes because we reference headers with
248# "ariba/path/to/file" all the time
249include_directories("${CMAKE_CURRENT_SOURCE_DIR}/..")
250
251
252# Compile the actual library
253
254include(BuildSharedAndStaticLib)
255
256set(ariba_SOURCES ${libariba_SOURCES} ${libariba_HEADERS})
257# ariba_LINK_LIBRARIES, ariba_VERSION and ariba_SOVERSION already defined
258
259build_shared_and_static_libs(ariba)
260
261
262# Install binaries
263install(TARGETS ariba ${ariba_STATIC_TARGET} EXPORT ariba-targets
264 LIBRARY DESTINATION lib COMPONENT Runtime
265 ARCHIVE DESTINATION lib COMPONENT Development
266 RUNTIME DESTINATION bin COMPONENT Runtime
267 )
268
269
270# Make libariba usable from build tree
271export(TARGETS ariba ${ariba_STATIC_TARGET} FILE ariba-exports.cmake)
272
273if(ariba_BINARY_DIR)
274 export(TARGETS ariba ${ariba_STATIC_TARGET}
275 FILE "${ariba_BINARY_DIR}/ariba-exports.cmake")
276endif(ariba_BINARY_DIR)
Note: See TracBrowser for help on using the repository browser.