Skip to content

Commit 133b5c6

Browse files
author
Stephen Barrett
committed
Import of source (stable2)
Source: https://gerrit.teamccp.com/rdk/components/opensource/rtmessage SHA1: a78e7bb9333f18e4a7f982c268f617f80f3bdd83 Change-Id: I845bbeb53e397a86b798ecec8b9b86b59e7c21d9
0 parents  commit 133b5c6

File tree

96 files changed

+9090
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+9090
-0
lines changed

CMakeLists.txt

+232
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
##########################################################################
2+
# If not stated otherwise in this file or this component's LICENSE
3+
# file the following copyright and licenses apply:
4+
#
5+
# Copyright 2019 RDK Management
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
##########################################################################
19+
cmake_minimum_required (VERSION 2.8.7)
20+
project(rtmessage)
21+
include(ExternalProject)
22+
cmake_policy(SET CMP0015 NEW)
23+
24+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
25+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
26+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
27+
set(RDKLOGGER_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../rdklogger/)
28+
set(BREAKPAD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../breakpadwrap/)
29+
30+
set(CMAKE_C_FLAGS_DEBUG "-Werror -Wall -Wextra -g -O0 -fno-inline")
31+
set(CMAKE_C_FLAGS_RELEASE "-Werror -Wall -Wextra")
32+
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -g -O0 -fno-inline")
33+
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -Wextra") # -Werror")
34+
35+
if (CMAKE_VERSION VERSION_LESS "3.1")
36+
message("CMAKE ${CMAKE_CXX_COMPILER_ID}")
37+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
38+
set (CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}")
39+
endif ()
40+
else ()
41+
set (CMAKE_CXX_STANDARD 11)
42+
endif ()
43+
44+
option(BUILD_FOR_DESKTOP "BUILD_FOR_DESKTOP" OFF)
45+
option(BUILD_RTMESSAGE_LIB "BUILD_RTMESSAGE_LIB" ON)
46+
option(ENABLE_RTMESSAGE_PROFILE "ENABLE_RTMESSAGE_PROFILE" OFF)
47+
option(BUILD_RTMESSAGE_SAMPLE_APP "BUILD_RTMESSAGE_SAMPLE_APP" OFF)
48+
option(BUILD_RTMESSAGE_ROUTED "BUILD_RTMESSAGE_ROUTED" ON)
49+
option(BUILD_DATAPROVIDER_LIB "BUILD_DATAPROVIDER_LIB" ON)
50+
option(BUILD_DMCLI "BUILD_DMCLI" ON)
51+
option(BUILD_DMCLI_SAMPLE_APP "BUILD_DMCLI_SAMPLE_APP" ON)
52+
option(ENABLE_RDKLOGGER "ENABLE_RDKLOGGER" OFF)
53+
option(INCLUDE_BREAKPAD "INCLUDE_BREAKPAD" OFF)
54+
55+
set(CMAKE_C_FLAGS "")
56+
57+
if (BUILD_FOR_DESKTOP)
58+
message("Building for desktop")
59+
ExternalProject_Add(
60+
cJSON
61+
GIT_REPOSITORY https://github.com/DaveGamble/cJSON.git
62+
GIT_TAG v1.6.0
63+
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}
64+
INSTALL_COMMAND ""
65+
CONFIGURE_COMMAND ""
66+
BUILD_IN_SOURCE 1
67+
PREFIX deps
68+
BUILD_COMMAND make)
69+
70+
include_directories(
71+
${CMAKE_CURRENT_SOURCE_DIR}
72+
${CMAKE_CURRENT_BINARY_DIR}/deps/src/cJSON)
73+
link_directories(
74+
${CMAKE_CURRENT_SOURCE_DIR}
75+
${CMAKE_CURRENT_BINARY_DIR}/deps/src/cJSON
76+
${CMAKE_BINARY_DIR}
77+
${LIBRARY_DIR})
78+
else()
79+
set(INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include )
80+
set(LIBRARY_DIR ${CMAKE_INSTALL_PREFIX}/lib)
81+
if (ENABLE_RDKLOGGER)
82+
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIR} ${INCLUDE_DIR}/cjson ${RDKLOGGER_PATH} ${RDKLOGGER_PATH}/include)
83+
link_directories(${CMAKE_CURRENT_SOURCE_DIR} ${LIBRARY_DIR} ${RDKLOGGER_PATH}/src/.libs/)
84+
add_definitions(-DENABLE_RDKLOGGER)
85+
else ()
86+
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIR} ${INCLUDE_DIR}/cjson)
87+
link_directories(${CMAKE_CURRENT_SOURCE_DIR} ${LIBRARY_DIR})
88+
endif (ENABLE_RDKLOGGER)
89+
if (INCLUDE_BREAKPAD)
90+
include_directories(${BREAKPAD_PATH})
91+
link_directories(${BREAKPAD_PATH})
92+
add_definitions(-DINCLUDE_BREAKPAD)
93+
endif (INCLUDE_BREAKPAD)
94+
endif (BUILD_FOR_DESKTOP)
95+
96+
set(RTMESSAGE_LINK_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} ${LIBRARY_DIR} ${RDKLOGGER_PATH}/src/.libs/ ${BREAKPAD_PATH})
97+
98+
if (ENABLE_RTMESSAGE_PROFILE)
99+
message("Enabling rtMessage profile")
100+
set(CMAKE_CFLAGS "${CMAKE_C_FLAGS} -pg")
101+
endif (ENABLE_RTMESSAGE_PROFILE)
102+
103+
if (BUILD_RTMESSAGE_LIB)
104+
message("Building rtMessage lib")
105+
add_library(
106+
rtMessage
107+
SHARED
108+
rtConnection.c
109+
rtLog.c
110+
rtError.c
111+
rtMessageHeader.c
112+
rtEncoder.c
113+
rtMessage.c
114+
rtSocket.c
115+
rtVector.c)
116+
if (ENABLE_RDKLOGGER)
117+
add_dependencies(rtMessage cJSON rdklogger)
118+
target_link_libraries(rtMessage ${LIBRARY_LINKER_OPTIONS} -pthread -lcjson -llog4c -lrdkloggers)
119+
else ()
120+
add_dependencies(rtMessage cJSON)
121+
target_link_libraries(rtMessage ${LIBRARY_LINKER_OPTIONS} -pthread -lcjson)
122+
endif (ENABLE_RDKLOGGER)
123+
endif (BUILD_RTMESSAGE_LIB)
124+
125+
if (BUILD_DATAPROVIDER_LIB)
126+
add_library(
127+
dataProvider
128+
SHARED
129+
dataProvider/dmProviderDatabase.cpp
130+
dataProvider/dmProviderHost.cpp
131+
dataProvider/dmPropertyInfo.cpp
132+
dataProvider/dmProviderInfo.cpp
133+
dataProvider/dmQueryResult.cpp
134+
dataProvider/dmProvider.cpp
135+
dataProvider/dmError.cpp
136+
dataProvider/dmValue.cpp
137+
dataProvider/dmClient.cpp)
138+
add_dependencies(
139+
dataProvider
140+
rtMessage)
141+
target_link_libraries(
142+
dataProvider
143+
rtMessage)
144+
endif (BUILD_DATAPROVIDER_LIB)
145+
146+
if (BUILD_RTMESSAGE_ROUTED)
147+
message ("Building rtrouted")
148+
set(CMAKE_CFLAGS " ${CMAKE_C_FLAGS}")
149+
add_executable(rtrouted rtrouted.c)
150+
if (BUILD_FOR_DESKTOP)
151+
add_dependencies(rtrouted cJSON)
152+
endif(BUILD_FOR_DESKTOP)
153+
if (INCLUDE_BREAKPAD)
154+
add_dependencies(rtrouted ${BREAKPAD_PATH})
155+
target_link_libraries(rtrouted ${LIBRARY_LINKER_OPTIONS} -lbreakpadwrap rtMessage)
156+
else ()
157+
target_link_libraries(rtrouted ${LIBRARY_LINKER_OPTIONS} rtMessage)
158+
endif (INCLUDE_BREAKPAD)
159+
endif (BUILD_RTMESSAGE_ROUTED)
160+
161+
if (BUILD_DMCLI)
162+
add_executable(dmcli dataProvider/dmcli.cpp)
163+
if (BUILD_FOR_DESKTOP)
164+
add_dependencies(dmcli cJSON rtMessage dataProvider)
165+
add_definitions("-DDEFAULT_DATAMODELDIR=\"${CMAKE_CURRENT_SOURCE_DIR}/dataProvider/data\"")
166+
else()
167+
add_definitions("-DDEFAULT_DATAMODELDIR=\"${RDK_FSROOT_PATH}/etc/model\"")
168+
endif (BUILD_FOR_DESKTOP)
169+
target_link_libraries(dmcli dataProvider rtMessage)
170+
endif (BUILD_DMCLI)
171+
172+
if (BUILD_DMCLI_SAMPLE_APP)
173+
# sample provider for general
174+
add_executable(sample_provider_gen dataProvider/sample_provider_gen.cpp)
175+
if (BUILD_FOR_DESKTOP)
176+
add_dependencies(sample_provider_gen dataProvider)
177+
endif (BUILD_FOR_DESKTOP)
178+
target_link_libraries(sample_provider_gen ${LIBRARY_LINKER_OPTIONS} rtMessage dataProvider)
179+
# sample provider for wifi
180+
add_executable(sample_provider_wifi dataProvider/sample_provider_wifi.cpp)
181+
if (BUILD_FOR_DESKTOP)
182+
add_dependencies(sample_provider_wifi dataProvider)
183+
endif (BUILD_FOR_DESKTOP)
184+
target_link_libraries(sample_provider_wifi ${LIBRARY_LINKER_OPTIONS} rtMessage dataProvider)
185+
endif (BUILD_DMCLI_SAMPLE_APP)
186+
187+
if (BUILD_RTMESSAGE_SAMPLE_APP)
188+
# sample_send
189+
add_executable(sample_send sample_send.c)
190+
if (BUILD_FOR_DESKTOP)
191+
add_dependencies(sample_send cJSON)
192+
endif (BUILD_FOR_DESKTOP)
193+
add_dependencies(sample_send rtMessage)
194+
target_link_libraries(sample_send ${LIBRARY_LINKER_OPTIONS} rtMessage)
195+
196+
# sample_recv
197+
add_executable(sample_recv sample_recv.c)
198+
if (BUILD_FOR_DESKTOP)
199+
add_dependencies(sample_recv cJSON)
200+
endif (BUILD_FOR_DESKTOP)
201+
add_dependencies(sample_send rtMessage)
202+
target_link_libraries(sample_recv ${LIBRARY_LINKER_OPTIONS} rtMessage)
203+
204+
# sample_req
205+
add_executable(sample_req sample_req.c)
206+
if (BUILD_FOR_DESKTOP)
207+
add_dependencies(sample_req cJSON)
208+
endif (BUILD_FOR_DESKTOP)
209+
add_dependencies(sample_send rtMessage)
210+
target_link_libraries(sample_req ${LIBRARY_LINKER_OPTIONS} rtMessage)
211+
212+
# sample_res
213+
add_executable(sample_res sample_res.c)
214+
if (BUILD_FOR_DESKTOP)
215+
add_dependencies(sample_res cJSON)
216+
endif (BUILD_FOR_DESKTOP)
217+
add_dependencies(sample_send rtMessage)
218+
target_link_libraries(sample_res ${LIBRARY_LINKER_OPTIONS} rtMessage)
219+
220+
# rtsend
221+
add_executable(rtsend rtsend.c)
222+
if (BUILD_FOR_DESKTOP)
223+
add_dependencies(rtsend cJSON)
224+
endif (BUILD_FOR_DESKTOP)
225+
add_dependencies(rtsend rtMessage)
226+
target_link_libraries(rtsend ${LIBRARY_LINKER_OPTIONS} rtMessage)
227+
endif (BUILD_RTMESSAGE_SAMPLE_APP)
228+
229+
ADD_CUSTOM_TARGET(distclean COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/*.so dmcli sample_provider_* sample_req sample_res sample_send sample_recv rtrouted rtsend CMakeCache.txt)
230+
231+
install (TARGETS LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
232+
install (TARGETS ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

CONTRIBUTING.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Contributing
2+
============
3+
4+
If you wish to make code contributions to this project, the master source is hosted at [code.rdkcentral.com](https://code.rdkcentral.com/r/#/admin/projects/rdkb/components/opensource/rtmessage).
5+
You can submit your changes for review via that site.
6+
7+
Please follow the [workflow](https://wiki.rdkcentral.com/display/CMF/Gerrit+Development+Workflow) when making a contribution.
8+
9+
In order to contribute code, first-time users are requested to agree to the [license](https://wiki.rdkcentral.com/signup.action).
10+
11+
There is a GitHub [mirror](https://github.com/rdkcmf/rdkc-rtmessage) of this project. Pull requests to the mirror will be ignored.

COPYING

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LICENSE

0 commit comments

Comments
 (0)