summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Herrmann <fherrmann@de.adit-jv.com>2020-06-05 15:01:18 +0200
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2020-07-06 10:04:07 +0900
commitde0c990bbfebf0458db5ece18d0d7722cb65ca1d (patch)
tree6501e988291198f13d81d319bff24e817667e3d0
parentff7e65ac36fad5e39efba6fc26cb083a27d400a5 (diff)
downloadDLT-daemon-de0c990bbfebf0458db5ece18d0d7722cb65ca1d.tar.gz
set DLT_NETWORK_TRACE_ENABLE by cmakedefine
Signed-off-by: Felix Herrmann <fherrmann@de.adit-jv.com> Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
-rw-r--r--.gitignore1
-rw-r--r--Android.bp16
-rw-r--r--CMakeLists.txt3
-rw-r--r--doc/dlt_for_developers.md3
-rw-r--r--include/dlt/CMakeLists.txt7
-rw-r--r--include/dlt/dlt_user.h.in (renamed from include/dlt/dlt_user.h)4
-rwxr-xr-xutil/create_dlt_user_h.py34
7 files changed, 64 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 9268a3c..9ac9b41 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@ automotive-dlt.spec
automotive-dlt.pc
config.h
include/dlt/dlt_version.h
+include/dlt/dlt_user.h
.project
.cproject
.settings
diff --git a/Android.bp b/Android.bp
index 54ef69e..859515f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -47,6 +47,17 @@ genrule {
out: ["dlt_version.h"],
}
+// Generate dlt_user.h without Cmake
+genrule {
+ name: "dlt_user_header",
+ tool_files: ["util/create_dlt_user.py"],
+ srcs: [
+ "include/dlt/dlt_user.h.in",
+ ],
+ cmd: "$(location util/create_dlt_user.py) $(in) $(out)",
+ out: ["dlt_user.h"],
+}
+
cc_binary {
name: "dlt-daemon",
@@ -106,7 +117,10 @@ cc_library_shared {
"include/dlt",
],
- export_generated_headers: ["dlt_version_header"],
+ export_generated_headers: [
+ "dlt_version_header",
+ "dlt_user_header"
+ ],
srcs: [
"src/lib/dlt_client.c",
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 017d4a2..710cb15 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -96,8 +96,8 @@ endif()
include_directories(
${PROJECT_SOURCE_DIR}
- ${PROJECT_SOURCE_DIR}/include/dlt
${PROJECT_BINARY_DIR}/include/dlt
+ ${PROJECT_SOURCE_DIR}/include/dlt
${PROJECT_SOURCE_DIR}/src/shared
${PROJECT_SOURCE_DIR}/src/core_dump_handler
${PROJECT_SOURCE_DIR}/src/offlinelogstorage
@@ -181,6 +181,7 @@ add_subdirectory(cmake)
if(HAVE_MQUEUE_H AND HAVE_FUNC_MQOPEN AND HAVE_FUNC_MQCLOSE AND
HAVE_FUNC_MQUNLINK AND HAVE_FUNC_MQSEND AND HAVE_FUNC_MQRECEIVE)
add_definitions(-DDLT_NETWORK_TRACE_ENABLE)
+ set(DLT_NETWORK_TRACE_ENABLE 1)
else()
message(STATUS "Disable network trace interface since message queue is not supported")
endif()
diff --git a/doc/dlt_for_developers.md b/doc/dlt_for_developers.md
index ec0c874..e0123f8 100644
--- a/doc/dlt_for_developers.md
+++ b/doc/dlt_for_developers.md
@@ -674,6 +674,9 @@ be set to 0, and the corresponding pointer must be set to NULL.
DLT_TRACE_NETWORK(mycontext, DLT_NW_TRACE_CAN, headerlen, header, payloadlen, payload);
```
+Note that when DLT_NETWORK_TRACE_ENABLE is disabled, the mqueue.h will not be
+included.
+
### DLT C++ Extension
The DLT C++ extension was added to DLT in version 2.13. This approach solves
diff --git a/include/dlt/CMakeLists.txt b/include/dlt/CMakeLists.txt
index ddf4717..460a410 100644
--- a/include/dlt/CMakeLists.txt
+++ b/include/dlt/CMakeLists.txt
@@ -13,10 +13,13 @@
# For further information see http://www.genivi.org/.
#######
-install(FILES dlt.h dlt_user.h dlt_user_macros.h dlt_client.h dlt_protocol.h
+configure_file(dlt_user.h.in dlt_user.h)
+
+install(FILES dlt.h dlt_user_macros.h dlt_client.h dlt_protocol.h
dlt_common.h dlt_types.h dlt_shm.h dlt_offline_trace.h
dlt_filetransfer.h dlt_common_api.h
- ${PROJECT_BINARY_DIR}/include/dlt/dlt_version.h
+ ${CMAKE_CURRENT_BINARY_DIR}/dlt_version.h
+ ${CMAKE_CURRENT_BINARY_DIR}/dlt_user.h
DESTINATION include/dlt
COMPONENT devel)
diff --git a/include/dlt/dlt_user.h b/include/dlt/dlt_user.h.in
index a3741fa..e4b6569 100644
--- a/include/dlt/dlt_user.h
+++ b/include/dlt/dlt_user.h.in
@@ -74,6 +74,10 @@
\{
*/
+#ifndef DLT_NETWORK_TRACE_ENABLE
+#cmakedefine DLT_NETWORK_TRACE_ENABLE
+#endif
+
#ifdef DLT_NETWORK_TRACE_ENABLE
# include <mqueue.h>
#else
diff --git a/util/create_dlt_user_h.py b/util/create_dlt_user_h.py
new file mode 100755
index 0000000..b0d1eb1
--- /dev/null
+++ b/util/create_dlt_user_h.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python3
+# This software has been developed by Advanced Driver Information Technology.
+# Copyright(c) 2020 Advanced Driver Information Technology GmbH,
+# Advanced Driver Information Technology Corporation, Robert Bosch GmbH,
+# Robert Bosch Car Multimedia GmbH and DENSO Corporation.
+#
+# This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
+#
+# This Source Code Form is subject to the terms of the
+# Mozilla Public License (MPL), v. 2.0.
+# If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# For further information see http://www.genivi.org/.
+import pathlib
+import argparse
+
+
+def main(header_in_file, header_out_file):
+ header_in = pathlib.Path(header_in_file)
+ header_out = pathlib.Path(header_out_file)
+ with header_in.open() as hi, header_out.open('w') as ho:
+ for line in hi:
+ if line.startswith("#cmakedefine"):
+ continue
+ ho.write(line)
+
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument('header_in')
+ parser.add_argument('header_out')
+ args = parser.parse_args()
+ main(args.header_in, args.header_out)