Add threadnames to libdlt threads.
[profile/ivi/dlt-daemon.git] / CMakeLists.txt
old mode 100755 (executable)
new mode 100644 (file)
index ae0bab6..054da7f
@@ -1,38 +1,17 @@
 #######\r
 # Dlt - Diagnostic Log and Trace\r
 # @licence make begin@\r
- #\r
- # Copyright (C) 2011, BMW AG - Alexander Wenzel <alexander.wenzel@bmw.de>\r
- # \r
- # This program is free software; you can redistribute it and/or modify it under the terms of the \r
- # GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.\r
- # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even \r
- # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General \r
- # Public License, version 2.1, for more details.\r
- # \r
- # You should have received a copy of the GNU Lesser General Public License, version 2.1, along \r
- # with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.\r
- # \r
- # Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may \r
- # also be applicable to programs even in cases in which the program is not a library in the technical sense.\r
- # \r
- # Linking DLT statically or dynamically with other modules is making a combined work based on DLT. You may \r
- # license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to \r
- # license your linked modules under the GNU Lesser General Public License, version 2.1, you \r
- # may use the program under the following exception.\r
- # \r
- # As a special exception, the copyright holders of DLT give you permission to combine DLT \r
- # with software programs or libraries that are released under any license unless such a combination is not\r
- # permitted by the license of such a software program or library. You may copy and distribute such a \r
- # system following the terms of the GNU Lesser General Public License, version 2.1, including this\r
- # special exception, for DLT and the licenses of the other code concerned.\r
- # \r
- # Note that people who make modified versions of DLT are not obligated to grant this special exception \r
- # for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, \r
- # version 2.1, gives permission to release a modified version without this exception; this exception \r
- # also makes it possible to release a modified version which carries forward this exception.\r
- #\r
- # @licence end@\r
+#\r
+# Copyright (C) 2011-2012, BMW AG - Alexander Wenzel <alexander.aw.wenzel@bmw.de>\r
+# \r
+# Contributions are licensed to the GENIVI Alliance under one or more\r
+# Contribution License Agreements.\r
+# \r
+# This Source Code Form is subject to the terms of the\r
+# Mozilla Public License, v. 2.0. If a  copy of the MPL was not distributed with\r
+# this file, You can obtain one at http://mozilla.org/MPL/2.0/.\r
+#\r
+# @licence end@\r
 ########\r
 \r
 cmake_minimum_required( VERSION 2.6 )\r
@@ -40,13 +19,14 @@ project( automotive-dlt )
 \r
 mark_as_advanced( CMAKE_BACKWARDS_COMPATIBILITY)\r
 set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )\r
+set( CMAKE_INSTALL_PREFIX "/usr" )\r
 \r
 # Set version parameters\r
 set( DLT_MAJOR_VERSION 2)\r
-set( DLT_MINOR_VERSION 5)\r
-set( DLT_PATCH_LEVEL 0)\r
+set( DLT_MINOR_VERSION 9)\r
+set( DLT_PATCH_LEVEL 2)\r
 set( DLT_VERSION ${DLT_MAJOR_VERSION}.${DLT_MINOR_VERSION}.${DLT_PATCH_LEVEL})\r
-set( DLT_VERSION_STATE RELEASE )\r
+set( DLT_VERSION_STATE ALPHA )\r
 set( DLT_REVISION "")\r
 \r
 execute_process(COMMAND git describe --tags WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} \r
@@ -70,18 +50,25 @@ if(NOT CMAKE_BUILD_TYPE)
 endif(NOT CMAKE_BUILD_TYPE)\r
 \r
 # Set of indiviual options\r
-option(BUILD_SHARED_LIBS      "Set to OFF to build static libraries"                 ON  )\r
-option(WITH_DLT_SHM_ENABLE    "Set to OFF to use FIFO as IPC from user to daemon"    OFF )\r
-option(WITH_DOC               "Set to ON to build documentation target"              OFF )\r
-option(WITH_MAN               "Set to OFF to skip building of man pages"             ON )\r
+option(BUILD_SHARED_LIBS      "Set to OFF to build static libraries"                                             ON  )\r
+option(WITH_SYSTEMD           "Set to ON to create unit files and systemd check on dlt-daemon startup"           OFF )\r
+option(WITH_SYSTEMD_WATCHDOG  "Set to ON to use the systemd watchdog in dlt-daemon"                              OFF)\r
+option(WITH_SYSTEMD_JOURNAL   "Set to ON to use the systemd journal in dlt-system"                               OFF)\r
+option(WITH_DOC               "Set to ON to build documentation target"                                          OFF )\r
+option(WITH_MAN               "Set to ON to build man pages"                                                     ON )\r
 option(WITH_CHECK_CONFIG_FILE "Set to ON to create a configure file of CheckIncludeFiles and CheckFunctionExists " OFF )\r
-option(WITH_TESTSCRIPTS       "Set to on to run CMakeLists.txt in testscripts"       OFF )\r
-option(WITH_SYSTEMD           "Set to on to run CMakeLists.txt in systemd"           OFF )\r
-option(WITH_GPROF             "Set -pg to compile flags"                             OFF )\r
-\r
+option(WITH_TESTSCRIPTS       "Set to ON to run CMakeLists.txt in testscripts"                                   OFF )\r
+option(WITH_GPROF             "Set -pg to compile flags"                                                         OFF )\r
+option(WITH_DLTTEST                      "Set to ON to build with modifications to test User-Daemon communication with corrupt messages" OFF)\r
+option(WITH_DLT_SHM_ENABLE    "EXPERIMENTAL! Set to ON to use shared memory as IPC. EXPERIMENTAL!"               OFF )\r
+option(WTIH_DLT_ADAPTOR       "Set ton ON to build src/adaptor binaries"                                         ON)\r
+option(WITH_DLT_CONSOLE       "Set ton ON to build src/console binaries"                                         ON)\r
+option(WITH_DLT_EXAMPLES      "Set ton ON to build src/examples binaries"                                        ON)\r
+option(WITH_DLT_SYSTEM        "Set ton ON to build src/system binaries"                                          ON)\r
+option(WITH_DLT_TESTS         "Set ton ON to build src/test binaries"                                            ON)\r
 # RPM settings\r
 set( GENIVI_RPM_RELEASE "1")#${DLT_REVISION}")\r
-set( LICENSE "LGPL v2.1 with special exception" )\r
+set( LICENSE "Mozilla Public License Version 2.0" )\r
 \r
 # Build, project and include settings\r
 find_package(Threads REQUIRED)\r
@@ -92,43 +79,83 @@ include_directories(
     ${CMAKE_SOURCE_DIR}/src/shared/ \r
     ${CMAKE_SOURCE_DIR}/src/lib/\r
     ${CMAKE_SOURCE_DIR}/src/daemon/\r
+    ${CMAKE_SOURCE_DIR}/systemd/3rdparty/\r
 )\r
 \r
+add_definitions( -D_GNU_SOURCE )\r
+\r
+if(WITH_DLTTEST)\r
+       add_definitions( -DDLT_TEST_ENABLE)\r
+endif(WITH_DLTTEST)\r
+\r
 if(WITH_DLT_SHM_ENABLE)\r
     add_definitions( -DDLT_SHM_ENABLE)\r
 endif(WITH_DLT_SHM_ENABLE)\r
-   \r
-if(WITH_GPROF)
-  SET(CMAKE_C_FLAGS "-pg")
-endif(WITH_GPROF)   \r
\r
+if(WITH_GPROF)\r
+  SET(CMAKE_C_FLAGS "-pg")\r
+endif(WITH_GPROF)    \r
    \r
 add_definitions( "-Wall" )\r
+add_definitions( "-Wextra" )\r
+\r
+IF(${WITH_DOC} STREQUAL "OFF")\r
+       SET(PACKAGE_DOC "#")\r
+ELSE (${WITH_DOC} STREQUAL "OFF")\r
+       SET(PACKAGE_DOC "")\r
+ENDIF(${WITH_DOC} STREQUAL "OFF")\r
+\r
+configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.spec.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.spec)\r
+configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.pc.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)\r
+install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig COMPONENT devel)\r
 \r
 add_subdirectory( cmake )\r
 \r
+if(WITH_SYSTEMD OR WITH_SYSTEMD_WATCHDOG OR WITH_SYSTEMD_JOURNAL)\r
+    if(WITH_SYSTEMD)\r
+        add_definitions( -DDLT_SYSTEMD_ENABLE)\r
+    endif(WITH_SYSTEMD)\r
+    \r
+    if(WITH_SYSTEMD_WATCHDOG)\r
+        add_definitions( -DDLT_SYSTEMD_WATCHDOG_ENABLE)\r
+    endif(WITH_SYSTEMD_WATCHDOG)\r
+\r
+    if(WITH_SYSTEMD_JOURNAL)\r
+        add_definitions( -DDLT_SYSTEMD_JOURNAL_ENABLE)\r
+    endif(WITH_SYSTEMD_JOURNAL)\r
+    \r
+    set( systemd_SRCS ${CMAKE_SOURCE_DIR}/systemd/3rdparty/sd-daemon.c)\r
+    \r
+    add_subdirectory( systemd )\r
+endif(WITH_SYSTEMD OR WITH_SYSTEMD_WATCHDOG OR WITH_SYSTEMD_JOURNAL)\r
+\r
+add_subdirectory( doc )\r
+add_subdirectory( src )\r
+add_subdirectory( include )\r
+add_subdirectory( testscripts )\r
+\r
 message( STATUS )\r
 message( STATUS "-------------------------------------------------------------------------------" )\r
 message( STATUS "Build for Version ${DLT_VERSION} build ${DLT_REVISION} version state ${DLT_VERSION_STATE}")\r
+message( STATUS "WITH_SYSTEMD = ${WITH_SYSTEMD}" )\r
+message( STATUS "WITH_SYSTEMD_WATCHDOG = ${WITH_SYSTEMD_WATCHDOG}" )\r
+message( STATUS "WITH_SYSTEMD_JOURNAL = ${WITH_SYSTEMD_JOURNAL}" )\r
+message( STATUS "WITH_DOC = ${WITH_DOC}" )\r
+\r
+message( STATUS "WITH_MAN = ${WITH_MAN}" )\r
+message( STATUS "WTIH_DLT_ADAPTOR = ${WTIH_DLT_ADAPTOR}")\r
+message( STATUS "WITH_DLT_CONSOLE = ${WITH_DLT_CONSOLE}")\r
+message( STATUS "WITH_DLT_EXAMPLES = ${WITH_DLT_EXAMPLES}")\r
+message( STATUS "WITH_DLT_SYSTEM = ${WITH_DLT_SYSTEM}")\r
+message( STATUS "WITH_DLT_TESTS = ${WITH_DLT_TESTS}")\r
 message( STATUS "WITH_DLT_SHM_ENABLE = ${WITH_DLT_SHM_ENABLE}" )\r
+message( STATUS "WITH_DLTTEST = ${WITH_DLTTEST}" )\r
 message( STATUS "WITH_CHECK_CONFIG_FILE = ${WITH_CHECK_CONFIG_FILE}" )\r
-message( STATUS "WITH_DOC = ${WITH_DOC}" )\r
 message( STATUS "WITH_TESTSCRIPTS = ${WITH_TESTSCRIPTS}" )\r
-message( STATUS "WITH_SYSTEMD = ${WITH_SYSTEMD}" )\r
 message( STATUS "WITH_GPROF = ${WITH_GPROF}" )\r
-message( STATUS "WITH_MAN = ${WITH_MAN}" )\r
 message( STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" )\r
 message( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" )\r
 message( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" )\r
 message( STATUS "Change a value with: cmake -D<Variable>=<Value>" )\r
 message( STATUS "-------------------------------------------------------------------------------" )\r
 message( STATUS )\r
-\r
-configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.spec.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.spec)\r
-configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.pc.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)\r
-install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig COMPONENT devel)\r
-\r
-add_subdirectory( doc )\r
-add_subdirectory( src )\r
-add_subdirectory( include )\r
-add_subdirectory( testscripts )\r
-add_subdirectory( systemd )\r