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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
#######
# Dlt - Diagnostic Log and Trace
# @licence make begin@
#
# Copyright (C) 2011, BMW AG - Alexander Wenzel <alexander.wenzel@bmw.de>
#
# This program is free software; you can redistribute it and/or modify it under the terms of the
# GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
# Public License, version 2.1, for more details.
#
# You should have received a copy of the GNU Lesser General Public License, version 2.1, along
# with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
#
# Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may
# also be applicable to programs even in cases in which the program is not a library in the technical sense.
#
# Linking DLT statically or dynamically with other modules is making a combined work based on DLT. You may
# license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to
# license your linked modules under the GNU Lesser General Public License, version 2.1, you
# may use the program under the following exception.
#
# As a special exception, the copyright holders of DLT give you permission to combine DLT
# with software programs or libraries that are released under any license unless such a combination is not
# permitted by the license of such a software program or library. You may copy and distribute such a
# system following the terms of the GNU Lesser General Public License, version 2.1, including this
# special exception, for DLT and the licenses of the other code concerned.
#
# Note that people who make modified versions of DLT are not obligated to grant this special exception
# for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License,
# version 2.1, gives permission to release a modified version without this exception; this exception
# also makes it possible to release a modified version which carries forward this exception.
#
# @licence end@
########
CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )
MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)
SET( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
PROJECT( automotive-dlt )
# Set version parameters
SET( ${PROJECT_NAME}_MAJOR_VERSION 2 )
SET( ${PROJECT_NAME}_MINOR_VERSION 3 )
SET( ${PROJECT_NAME}_PATCH_LEVEL 0 )
SET( ${PROJECT_NAME}_VERSION_STATE )
SET( GENIVI_PROJECT_VERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_LEVEL})
SET( PRINT_MAJOR_VERSION ${${PROJECT_NAME}_MAJOR_VERSION})
SET( PRINT_MINOR_VERSION ${${PROJECT_NAME}_MINOR_VERSION})
SET( PRINT_PATCH_LEVEL ${${PROJECT_NAME}_PATCH_LEVEL})
SET( PRINT_VERSION ${GENIVI_PROJECT_VERSION})
SET( PRINT_VERSION_STATE ${${PROJECT_NAME}_VERSION_STATE})
IF(NOT DEFINED DLT_REVISION)
execute_process(COMMAND git describe --tags WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE DLT_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REPLACE "-" "_" DLT_REVISION ${DLT_REVISION})
ENDIF(NOT DEFINED DLT_REVISION)
##################### RPM SPEC CONFIG ########################
SET( GENIVI_RPM_RELEASE "1${DLT_REVISION}")
SET( LICENSE "LGPL v2.1 with special exception" )
#########################################################
SET(GENIVI_BUILDSYSTEM_AVAILABLE $ENV{GENIVI_BUILDSYSTEM})
IF(GENIVI_BUILDSYSTEM_AVAILABLE)
INCLUDE($ENV{GENIVI_BUILDSYSTEM}/cmake_extensions/GeniviCMakeExtensions.cmake)
ENDIF(GENIVI_BUILDSYSTEM_AVAILABLE)
###################### GPROF Settings ###################
# Adds compile flag for gprof to target
# Run the binary
# Output: gmon.out in build directory
# Run: gprof <path/to/binary> > profile.output
SET( GPROF_DLT_DAEMON OFF )
SET( GPROF_DLT_LIB OFF )
SET( GPROF_DLT_EXAMPLES OFF)
SET( GPROF_DLT_TESTS OFF)
SET( GPROF_DLT_CONSOLE OFF)
SET( GPROF_DLT_ADAPTOR OFF)
###################### systemd Settings #################
SET( DLT_SYSLOG_APPID "SYS" )
SET( DLT_SYSLOG_CTID "LOG" )
SET( DLT_SYSLOG_PORT 4712 )
SET( prefix ${CMAKE_INSTALL_PREFIX})
SET( libdir "\${exec_prefix}/lib" )
SET( includedir "\${exec_prefix}/include" )
SET( DLTBINDIR ${CMAKE_INSTALL_PREFIX}/bin )
SET( DLTLIBDIR ${CMAKE_INSTALL_PREFIX}/lib )
SET( DLTLIBSTATIC ${CMAKE_INSTALL_PREFIX}/lib )
SET( DLTINCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include )
SET( DLTDOCDIR ${CMAKE_INSTALL_PREFIX}/doc )
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo)
ENDIF(NOT CMAKE_BUILD_TYPE)
FIND_PACKAGE(Doxygen)
FIND_PACKAGE(Threads REQUIRED)
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/
${CMAKE_SOURCE_DIR}/include/dlt
${CMAKE_SOURCE_DIR}/src/shared/
${CMAKE_SOURCE_DIR}/src/lib/
${CMAKE_SOURCE_DIR}/src/daemon/ )
ADD_DEFINITIONS( "-Wall" )
INCLUDE(TestBigEndian)
TEST_BIG_ENDIAN( DLT_BIGENDIAN )
IF ( DLT_BIGENDIAN )
ADD_DEFINITIONS( -DBYTE_ORDER=BIG_ENDIAN )
ELSE ( DLT_BIGENDIAN )
ADD_DEFINITIONS( -DBYTE_ORDER=LITTLE_ENDIAN )
ENDIF ( DLT_BIGENDIAN )
INCLUDE(CheckIncludeFiles)
CHECK_INCLUDE_FILES( arpa/inet.h HAVE_ARPAINET_H)
CHECK_INCLUDE_FILES( fcntl.h HAVE_FCNTL_H)
CHECK_INCLUDE_FILES( float.h HAVE_FLOAT_H)
CHECK_INCLUDE_FILES( limits.h HAVE_LIMITS_H)
CHECK_INCLUDE_FILES( netdb.h HAVE_NETDB_H)
CHECK_INCLUDE_FILES( netinet/in.h HAVE_NETINETIN_H)
CHECK_INCLUDE_FILES( stddef.h HAVE_STDDEF_H)
CHECK_INCLUDE_FILES( stdint.h HAVE_STDINT_H)
CHECK_INCLUDE_FILES( stdlib.h HAVE_STDLIB_H)
CHECK_INCLUDE_FILES( string.h HAVE_STRING_H)
CHECK_INCLUDE_FILES( strings.h HAVE_STRINGS_H)
CHECK_INCLUDE_FILES( sys/ioctl.h HAVE_SYSIOCTL_H)
CHECK_INCLUDE_FILES( sys/socket.h HAVE_SYSSOCKET_H)
CHECK_INCLUDE_FILES( sys/time.h HAVE_SYSTIME_H)
CHECK_INCLUDE_FILES( unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILES( sys/ipc.h HAVE_SYSIPC_H)
CHECK_INCLUDE_FILES( netdb.h HAVE_NETDB_H)
CHECK_INCLUDE_FILES( ctype.h HAVE_CTYPE_H)
CHECK_INCLUDE_FILES( signal.h HAVE_SIGNAL_H)
CHECK_INCLUDE_FILES( syslog.h HAVE_SYSLOG_H)
CHECK_INCLUDE_FILES( sys/stat.h HAVE_SYSSTAT_H)
CHECK_INCLUDE_FILES( linux/stat.h HAVE_LINUXSTAT_H)
CHECK_INCLUDE_FILES( sys/uio.h HAVE_SYSUIO_H)
CHECK_INCLUDE_FILES( termios.h HAVE_TERMIOS_H)
CHECK_INCLUDE_FILES( unistd.h HAVE_UNISTD_H)
INCLUDE(CheckFunctionExists)
CHECK_FUNCTION_EXISTS( bzero HAVE_FUNC_BZERO)
CHECK_FUNCTION_EXISTS( clock_gettime HAVE_FUNC_CLOCKGETTIME)
CHECK_FUNCTION_EXISTS( floor HAVE_FUNC_FLOOR)
CHECK_FUNCTION_EXISTS( fork HAVE_FUNC_FORK)
CHECK_FUNCTION_EXISTS( gethostbyname HAVE_FUNC_GETHOSTBYNAME)
CHECK_FUNCTION_EXISTS( gettimeofday HAVE_FUNC_GETTIMEBYDAY)
CHECK_FUNCTION_EXISTS( inet_ntoa HAVE_FUNC_INETNTOA)
CHECK_FUNCTION_EXISTS( malloc HAVE_FUNC_MALLOC)
CHECK_FUNCTION_EXISTS( memmove HAVE_FUNC_MEMMOVE)
CHECK_FUNCTION_EXISTS( memset HAVE_FUNC_MEMSET)
CHECK_FUNCTION_EXISTS( mkfifo HAVE_FUNC_MKFIFO)
CHECK_FUNCTION_EXISTS( select HAVE_FUNC_SELECT)
CHECK_FUNCTION_EXISTS( socket HAVE_FUNC_SOCKET)
CHECK_FUNCTION_EXISTS( strchr HAVE_FUNC_STRCHR)
CHECK_FUNCTION_EXISTS( strerror HAVE_FUNC_STRERROR)
CHECK_FUNCTION_EXISTS( strstr HAVE_FUNC_STRSTR)
CHECK_FUNCTION_EXISTS( strtol HAVE_FUNC_STRTOL)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_SOURCE_DIR}/config.h @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/dlt/dlt_version.h.cmake ${CMAKE_SOURCE_DIR}/include/dlt/dlt_version.h @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/doxygen.cfg.cmake ${CMAKE_SOURCE_DIR}/doxygen.cfg @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/automotive-dlt.pc.cmake ${CMAKE_SOURCE_DIR}/automotive-dlt.pc @ONLY)
#CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/systemd/dlt.service.cmake ${CMAKE_SOURCE_DIR}/systemd/dlt.service @ONLY)
#CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/systemd/dlt-syslog.service.cmake ${CMAKE_SOURCE_DIR}/systemd/dlt-syslog.service @ONLY)
#CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/testscripts/Meego/dlt-daemon.cmake ${CMAKE_SOURCE_DIR}/testscripts/Meego/dlt-daemon @ONLY)
#CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/testscripts/Ubuntu/dlt-daemon.cmake ${CMAKE_SOURCE_DIR}/testscripts/Ubuntu/dlt-daemon @ONLY)
OPTION(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON )
OPTION(ENABLE_BUILD_DOC "Set to ON to build Documentation" OFF)
MESSAGE( STATUS )
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
MESSAGE( STATUS "Build for Version ${PRINT_VERSION} build ${DLT_REVISION}")
MESSAGE( STATUS "VERSION_STATE ${PRINT_VERSION_STATE}")
MESSAGE( STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" )
MESSAGE( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" )
MESSAGE( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" )
MESSAGE( STATUS "ENABLE_BUILD_DOC = ${ENABLE_BUILD_DOC}" )
MESSAGE( STATUS "Change a value with: cmake -D<Variable>=<Value>" )
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
MESSAGE( STATUS )
SET( BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS}" CACHE BOOL "Set to OFF to build static libraries" FORCE )
SET( CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Where to install ${PROJECT_NAME}" FORCE )
SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE )
#SET( ENABLE_BUILD_DOC "${ENABLE_BUILD_DOC}" CACHE BOOL "Set to ON to build Documentation" FORCE )
ADD_SUBDIRECTORY( src )
ADD_SUBDIRECTORY( include )
ADD_SUBDIRECTORY( testscripts )
IF (ENABLE_BUILD_DOC)
ADD_SUBDIRECTORY( doc )
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_SOURCE_DIR}/doxygen-execute
DEPENDS ${CMAKE_SOURCE_DIR}/doxygen.cfg
COMMAND doxygen
ARGS ${CMAKE_SOURCE_DIR}/doxygen.cfg
)
ADD_CUSTOM_TARGET(doxygen-doc ALL DEPENDS ${CMAKE_SOURCE_DIR}/doxygen-execute)
SET( DOC_COMPONENT doc)
ENDIF(ENABLE_BUILD_DOC)
INSTALL(FILES automotive-dlt.pc
DESTINATION lib/pkgconfig
COMPONENT devel)
INSTALL(FILES LICENSE.txt
DESTINATION doc/dlt2
COMPONENT base)
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
#ADD_CUSTOM_TARGET(uninstall
# "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
EXPORT_LIBRARY_DEPENDENCIES( "${PROJECT_NAME}LibDeps.cmake" )
|