• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2020 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("mqtt.gni")
16
17config("mqtt_config_c") {
18  include_dirs = [
19    "mqttpacket/src",
20    "mqttclient_c/src",
21    "mqttclient_c/src/linux",
22    "//vendor/hisi/hi3861/hi3861/third_party/lwip_sack/include",
23    "//third_party/paho_mqtt/mqttclient_c/src",
24    "//base/hiviewdfx/hilog/interfaces/native/innerkits/include/hilog/",
25  ]
26  cflags = [
27    "-Wno-self-assign",
28    "-Wno-unused-label",
29    "-Wno-invalid-offsetof",
30    "-Wno-unused-parameter",
31    "-Wno-pessimizing-move",
32    "-Wno-unused-function",
33    "-Wno-unused-local-typedef",
34    "-Wno-header-hygiene",
35    "-Wno-ignored-qualifiers",
36    "-Wno-sign-compare",
37    "-Wno-unused-variable",
38    "-Wno-missing-field-initializers",
39    "-Wno-deprecated-copy",
40    "-Wno-undefined-bool-conversion",
41    "-Wno-unused-value",
42    "-Wno-shadow",
43    "-Wno-pedantic",
44    "-Wno-inconsistent-missing-override",
45    "-Wno-reorder-ctor",
46    "-Wno-unused-private-field",
47    "-Wno-sometimes-uninitialized",
48    "-Wno-delete-non-abstract-non-virtual-dtor",
49    "-Wno-unknown-pragmas",
50    "-Wno-format",
51    "-Wno-shift-op-parentheses",
52    "-Wno-unused-function",
53  ]
54  defines = [
55    "LINUX_SO",
56    "MQTT_SERVER",
57    "MQTT_CLIENT",
58  ]
59}
60
61config("mqtt_config_cxx") {
62  include_dirs = [
63    "mqttpacket/src",
64    "mqttclient/src/linux",
65    "mqttclient/src/",
66    "//vendor/hisi/hi3861/hi3861/third_party/lwip_sack/include",
67  ]
68  cflags_cc = [
69    "-Wno-self-assign",
70    "-Wno-unused-label",
71    "-Wno-invalid-offsetof",
72    "-Wno-unused-parameter",
73    "-Wno-pessimizing-move",
74    "-Wno-unused-function",
75    "-Wno-unused-local-typedef",
76    "-Wno-header-hygiene",
77    "-Wno-ignored-qualifiers",
78    "-Wno-sign-compare",
79    "-Wno-unused-variable",
80    "-Wno-missing-field-initializers",
81    "-Wno-deprecated-copy",
82    "-Wno-undefined-bool-conversion",
83    "-Wno-unused-value",
84    "-Wno-shadow",
85    "-Wno-pedantic",
86    "-Wno-inconsistent-missing-override",
87    "-Wno-reorder-ctor",
88    "-Wno-unused-private-field",
89    "-Wno-sometimes-uninitialized",
90    "-Wno-delete-non-abstract-non-virtual-dtor",
91    "-Wno-unknown-pragmas",
92    "-Wno-format",
93    "-Wno-shift-op-parentheses",
94    "-Wno-unused-function",
95  ]
96  defines = [
97    "LINUX_SO",
98    "MQTT_SERVER",
99    "MQTT_CLIENT",
100    "MQTT_TASK",
101  ]
102}
103
104pahomqtt_sources = [
105  "mqttclient_c/src/MQTTClient.c",
106  "mqttclient_c/src/linux/MQTTLinux.c",
107  "mqttpacket/src/MQTTConnectClient.c",
108  "mqttpacket/src/MQTTConnectServer.c",
109  "mqttpacket/src/MQTTDeserializePublish.c",
110  "mqttpacket/src/MQTTFormat.c",
111  "mqttpacket/src/MQTTPacket.c",
112  "mqttpacket/src/MQTTSerializePublish.c",
113  "mqttpacket/src/MQTTSubscribeClient.c",
114  "mqttpacket/src/MQTTSubscribeServer.c",
115  "mqttpacket/src/MQTTUnsubscribeClient.c",
116  "mqttpacket/src/MQTTUnsubscribeServer.c",
117]
118
119ohos_shared_library("mqtt") {
120  sources = pahomqtt_sources
121  public_configs = [ ":mqtt_config_c" ]
122  deps = [ "//base/hiviewdfx/hilog/frameworks/hilog_ndk:hilog_ndk" ]
123  external_deps = [ "hilog:libhilog" ]
124  subsystem_name = "${subsystem_name}"
125  part_name = "${part_name}"
126}
127ohos_executable("${mqtt_exe_prefix}stdoutsub") {
128  sources = [ "mqttclient/samples/linux/stdoutsub.cpp" ]
129  configs = [ ":mqtt_config_cxx" ]
130  deps = [ ":mqtt" ]
131  subsystem_name = "${subsystem_name}"
132  part_name = "${part_name}"
133}
134
135# ohos_executable("${mqtt_exe_prefix}hello") {
136#   sources = [
137#     "mqttclient/samples/linux/hello.cpp",
138#     ]
139#   configs = [
140#     ":mqtt_config_cxx",
141#     ]
142#   deps = [
143#     ":mqtt",
144#    ]
145#   install_enable = true
146#   subsystem_name = "${subsystem_name}"
147#   part_name = "${part_name}"
148# }
149# ohos_executable("${mqtt_exe_prefix}main") {
150#   sources = [
151#     "mqttclient/samples/linux/main.cpp",
152#     ]
153#   configs = [
154#     ":mqtt_config_cxx",
155#     ]
156#   deps = [
157#     ":mqtt",
158#    ]
159#   install_enable = true
160#   subsystem_name = "${subsystem_name}"
161#   part_name = "${part_name}"
162# }
163
164ohos_executable("${mqtt_exe_prefix}test1") {
165  sources = [ "mqttpacket/test/test1.c" ]
166  configs = [ ":mqtt_config_c" ]
167  deps = [ ":mqtt" ]
168  subsystem_name = "${subsystem_name}"
169  part_name = "${part_name}"
170}
171
172ohos_executable("${mqtt_exe_prefix}ping_nb") {
173  sources = [
174    "mqttpacket/samples/ping_nb.c",
175    "mqttpacket/samples/transport.c",
176  ]
177  configs = [ ":mqtt_config_c" ]
178  deps = [ ":mqtt" ]
179  subsystem_name = "${subsystem_name}"
180  part_name = "${part_name}"
181}
182
183ohos_executable("${mqtt_exe_prefix}pub0sub1_nb") {
184  sources = [
185    "mqttpacket/samples/pub0sub1_nb.c",
186    "mqttpacket/samples/transport.c",
187  ]
188  configs = [ ":mqtt_config_c" ]
189  deps = [ ":mqtt" ]
190  subsystem_name = "${subsystem_name}"
191  part_name = "${part_name}"
192}
193
194ohos_executable("${mqtt_exe_prefix}pub0sub1") {
195  sources = [
196    "mqttpacket/samples/pub0sub1.c",
197    "mqttpacket/samples/transport.c",
198  ]
199  configs = [ ":mqtt_config_c" ]
200  deps = [ ":mqtt" ]
201  subsystem_name = "${subsystem_name}"
202  part_name = "${part_name}"
203}
204
205ohos_executable("${mqtt_exe_prefix}ping") {
206  sources = [
207    "mqttpacket/samples/ping.c",
208    "mqttpacket/samples/transport.c",
209  ]
210  configs = [ ":mqtt_config_c" ]
211  deps = [ ":mqtt" ]
212  subsystem_name = "${subsystem_name}"
213  part_name = "${part_name}"
214}
215
216ohos_executable("${mqtt_exe_prefix}qos0pub") {
217  sources = [
218    "mqttpacket/samples/qos0pub.c",
219    "mqttpacket/samples/transport.c",
220  ]
221  configs = [ ":mqtt_config_c" ]
222  deps = [ ":mqtt" ]
223  subsystem_name = "${subsystem_name}"
224  part_name = "${part_name}"
225}
226