# Copyright (c) 2020 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("mqtt.gni") config("mqtt_config_c") { include_dirs = [ "mqttpacket/src", "mqttclient_c/src", "mqttclient_c/src/linux", "//vendor/hisi/hi3861/hi3861/third_party/lwip_sack/include", "//third_party/paho_mqtt/mqttclient_c/src", "//base/hiviewdfx/hilog/interfaces/native/innerkits/include/hilog/", ] cflags = [ "-Wno-self-assign", "-Wno-unused-label", "-Wno-invalid-offsetof", "-Wno-unused-parameter", "-Wno-pessimizing-move", "-Wno-unused-function", "-Wno-unused-local-typedef", "-Wno-header-hygiene", "-Wno-ignored-qualifiers", "-Wno-sign-compare", "-Wno-unused-variable", "-Wno-missing-field-initializers", "-Wno-deprecated-copy", "-Wno-undefined-bool-conversion", "-Wno-unused-value", "-Wno-shadow", "-Wno-pedantic", "-Wno-inconsistent-missing-override", "-Wno-reorder-ctor", "-Wno-unused-private-field", "-Wno-sometimes-uninitialized", "-Wno-delete-non-abstract-non-virtual-dtor", "-Wno-unknown-pragmas", "-Wno-format", "-Wno-shift-op-parentheses", "-Wno-unused-function", ] defines = [ "LINUX_SO", "MQTT_SERVER", "MQTT_CLIENT", ] } config("mqtt_config_cxx") { include_dirs = [ "mqttpacket/src", "mqttclient/src/linux", "mqttclient/src/", "//vendor/hisi/hi3861/hi3861/third_party/lwip_sack/include", ] cflags_cc = [ "-Wno-self-assign", "-Wno-unused-label", "-Wno-invalid-offsetof", "-Wno-unused-parameter", "-Wno-pessimizing-move", "-Wno-unused-function", "-Wno-unused-local-typedef", "-Wno-header-hygiene", "-Wno-ignored-qualifiers", "-Wno-sign-compare", "-Wno-unused-variable", "-Wno-missing-field-initializers", "-Wno-deprecated-copy", "-Wno-undefined-bool-conversion", "-Wno-unused-value", "-Wno-shadow", "-Wno-pedantic", "-Wno-inconsistent-missing-override", "-Wno-reorder-ctor", "-Wno-unused-private-field", "-Wno-sometimes-uninitialized", "-Wno-delete-non-abstract-non-virtual-dtor", "-Wno-unknown-pragmas", "-Wno-format", "-Wno-shift-op-parentheses", "-Wno-unused-function", ] defines = [ "LINUX_SO", "MQTT_SERVER", "MQTT_CLIENT", "MQTT_TASK", ] } pahomqtt_sources = [ "mqttclient_c/src/MQTTClient.c", "mqttclient_c/src/linux/MQTTLinux.c", "mqttpacket/src/MQTTConnectClient.c", "mqttpacket/src/MQTTConnectServer.c", "mqttpacket/src/MQTTDeserializePublish.c", "mqttpacket/src/MQTTFormat.c", "mqttpacket/src/MQTTPacket.c", "mqttpacket/src/MQTTSerializePublish.c", "mqttpacket/src/MQTTSubscribeClient.c", "mqttpacket/src/MQTTSubscribeServer.c", "mqttpacket/src/MQTTUnsubscribeClient.c", "mqttpacket/src/MQTTUnsubscribeServer.c", ] ohos_shared_library("mqtt") { sources = pahomqtt_sources public_configs = [ ":mqtt_config_c" ] deps = [ "//base/hiviewdfx/hilog/frameworks/hilog_ndk:hilog_ndk" ] external_deps = [ "hilog:libhilog" ] subsystem_name = "${subsystem_name}" part_name = "${part_name}" } ohos_executable("${mqtt_exe_prefix}stdoutsub") { sources = [ "mqttclient/samples/linux/stdoutsub.cpp" ] configs = [ ":mqtt_config_cxx" ] deps = [ ":mqtt" ] subsystem_name = "${subsystem_name}" part_name = "${part_name}" } # ohos_executable("${mqtt_exe_prefix}hello") { # sources = [ # "mqttclient/samples/linux/hello.cpp", # ] # configs = [ # ":mqtt_config_cxx", # ] # deps = [ # ":mqtt", # ] # install_enable = true # subsystem_name = "${subsystem_name}" # part_name = "${part_name}" # } # ohos_executable("${mqtt_exe_prefix}main") { # sources = [ # "mqttclient/samples/linux/main.cpp", # ] # configs = [ # ":mqtt_config_cxx", # ] # deps = [ # ":mqtt", # ] # install_enable = true # subsystem_name = "${subsystem_name}" # part_name = "${part_name}" # } ohos_executable("${mqtt_exe_prefix}test1") { sources = [ "mqttpacket/test/test1.c" ] configs = [ ":mqtt_config_c" ] deps = [ ":mqtt" ] subsystem_name = "${subsystem_name}" part_name = "${part_name}" } ohos_executable("${mqtt_exe_prefix}ping_nb") { sources = [ "mqttpacket/samples/ping_nb.c", "mqttpacket/samples/transport.c", ] configs = [ ":mqtt_config_c" ] deps = [ ":mqtt" ] subsystem_name = "${subsystem_name}" part_name = "${part_name}" } ohos_executable("${mqtt_exe_prefix}pub0sub1_nb") { sources = [ "mqttpacket/samples/pub0sub1_nb.c", "mqttpacket/samples/transport.c", ] configs = [ ":mqtt_config_c" ] deps = [ ":mqtt" ] subsystem_name = "${subsystem_name}" part_name = "${part_name}" } ohos_executable("${mqtt_exe_prefix}pub0sub1") { sources = [ "mqttpacket/samples/pub0sub1.c", "mqttpacket/samples/transport.c", ] configs = [ ":mqtt_config_c" ] deps = [ ":mqtt" ] subsystem_name = "${subsystem_name}" part_name = "${part_name}" } ohos_executable("${mqtt_exe_prefix}ping") { sources = [ "mqttpacket/samples/ping.c", "mqttpacket/samples/transport.c", ] configs = [ ":mqtt_config_c" ] deps = [ ":mqtt" ] subsystem_name = "${subsystem_name}" part_name = "${part_name}" } ohos_executable("${mqtt_exe_prefix}qos0pub") { sources = [ "mqttpacket/samples/qos0pub.c", "mqttpacket/samples/transport.c", ] configs = [ ":mqtt_config_c" ] deps = [ ":mqtt" ] subsystem_name = "${subsystem_name}" part_name = "${part_name}" }