12498b56bSopenharmony_ci# Copyright (c) 2021 Huawei Device Co., Ltd. 22498b56bSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 32498b56bSopenharmony_ci# you may not use this file except in compliance with the License. 42498b56bSopenharmony_ci# You may obtain a copy of the License at 52498b56bSopenharmony_ci# 62498b56bSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 72498b56bSopenharmony_ci# 82498b56bSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 92498b56bSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 102498b56bSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 112498b56bSopenharmony_ci# See the License for the specific language governing permissions and 122498b56bSopenharmony_ci# limitations under the License. 132498b56bSopenharmony_ci 142498b56bSopenharmony_ciimport("//base/hiviewdfx/hilog/hilog.gni") 152498b56bSopenharmony_ciimport("//build/ohos.gni") 162498b56bSopenharmony_ci 172498b56bSopenharmony_ciframework_root = "//base/hiviewdfx/hilog/frameworks" 182498b56bSopenharmony_cilibhilog_root = "$framework_root/libhilog" 192498b56bSopenharmony_ciioctl_root = "$libhilog_root/ioctl" 202498b56bSopenharmony_ciparam_root = "$libhilog_root/param" 212498b56bSopenharmony_cisocket_root = "$libhilog_root/socket" 222498b56bSopenharmony_ciutils_root = "$libhilog_root/utils" 232498b56bSopenharmony_civsnprintf_root = "$libhilog_root/vsnprintf" 242498b56bSopenharmony_ci 252498b56bSopenharmony_ciconfig("libhilog_config") { 262498b56bSopenharmony_ci visibility = [ "*:*" ] 272498b56bSopenharmony_ci 282498b56bSopenharmony_ci include_dirs = [ 292498b56bSopenharmony_ci "include", 302498b56bSopenharmony_ci "$framework_root/include", 312498b56bSopenharmony_ci "$libhilog_root/include", 322498b56bSopenharmony_ci "$ioctl_root/include", 332498b56bSopenharmony_ci "$param_root/include", 342498b56bSopenharmony_ci "$socket_root/include", 352498b56bSopenharmony_ci "$utils_root/include", 362498b56bSopenharmony_ci "$vsnprintf_root/include", 372498b56bSopenharmony_ci "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", 382498b56bSopenharmony_ci ] 392498b56bSopenharmony_ci} 402498b56bSopenharmony_ci 412498b56bSopenharmony_citemplate("libhilog_source") { 422498b56bSopenharmony_ci forward_variables_from(invoker, "*") 432498b56bSopenharmony_ci ohos_source_set(target_name) { 442498b56bSopenharmony_ci if (platform != "windows" && platform != "mac" && platform != "linux") { 452498b56bSopenharmony_ci param_sources = [ "$param_root/properties.cpp" ] 462498b56bSopenharmony_ci ioctl_sources = [ "$ioctl_root/log_ioctl.cpp" ] 472498b56bSopenharmony_ci 482498b56bSopenharmony_ci socket_sources = [ 492498b56bSopenharmony_ci "$socket_root/dgram_socket_client.cpp", 502498b56bSopenharmony_ci "$socket_root/dgram_socket_server.cpp", 512498b56bSopenharmony_ci "$socket_root/hilog_input_socket_client.cpp", 522498b56bSopenharmony_ci "$socket_root/hilog_input_socket_server.cpp", 532498b56bSopenharmony_ci "$socket_root/seq_packet_socket_client.cpp", 542498b56bSopenharmony_ci "$socket_root/seq_packet_socket_server.cpp", 552498b56bSopenharmony_ci "$socket_root/socket.cpp", 562498b56bSopenharmony_ci "$socket_root/socket_client.cpp", 572498b56bSopenharmony_ci "$socket_root/socket_server.cpp", 582498b56bSopenharmony_ci ] 592498b56bSopenharmony_ci } 602498b56bSopenharmony_ci 612498b56bSopenharmony_ci utils_sources = [ 622498b56bSopenharmony_ci "$utils_root/log_print.cpp", 632498b56bSopenharmony_ci "$utils_root/log_utils.cpp", 642498b56bSopenharmony_ci ] 652498b56bSopenharmony_ci 662498b56bSopenharmony_ci vsnprintf_sources = [ 672498b56bSopenharmony_ci "$vsnprintf_root/vsnprintf_s_p.c", 682498b56bSopenharmony_ci "$vsnprintf_root/vsprintf_p.c", 692498b56bSopenharmony_ci ] 702498b56bSopenharmony_ci 712498b56bSopenharmony_ci sources = [ 722498b56bSopenharmony_ci "hilog.cpp", 732498b56bSopenharmony_ci "hilog_printf.cpp", 742498b56bSopenharmony_ci ] 752498b56bSopenharmony_ci if (platform != "windows" && platform != "mac" && platform != "linux") { 762498b56bSopenharmony_ci sources += param_sources 772498b56bSopenharmony_ci sources += ioctl_sources 782498b56bSopenharmony_ci sources += socket_sources 792498b56bSopenharmony_ci } 802498b56bSopenharmony_ci sources += utils_sources 812498b56bSopenharmony_ci sources += vsnprintf_sources 822498b56bSopenharmony_ci 832498b56bSopenharmony_ci defines = [] 842498b56bSopenharmony_ci if (platform == "windows") { 852498b56bSopenharmony_ci cflags_cc = [ "-std=c++17" ] 862498b56bSopenharmony_ci defines += [ "__WINDOWS__" ] 872498b56bSopenharmony_ci } else if (platform == "mac") { 882498b56bSopenharmony_ci cflags_cc = [ 892498b56bSopenharmony_ci "-std=c++17", 902498b56bSopenharmony_ci "-Wno-deprecated-declarations", 912498b56bSopenharmony_ci ] 922498b56bSopenharmony_ci defines += [ "__MAC__" ] 932498b56bSopenharmony_ci } else if (platform == "linux") { 942498b56bSopenharmony_ci cflags_cc = [ "-std=c++17" ] 952498b56bSopenharmony_ci defines += [ "__LINUX__" ] 962498b56bSopenharmony_ci } else { 972498b56bSopenharmony_ci defines = [ "__RECV_MSG_WITH_UCRED_" ] 982498b56bSopenharmony_ci if (use_musl) { 992498b56bSopenharmony_ci defines += [ "HILOG_USE_MUSL" ] 1002498b56bSopenharmony_ci } 1012498b56bSopenharmony_ci if (platform == "ohos") { 1022498b56bSopenharmony_ci defines += [ "__OHOS__" ] 1032498b56bSopenharmony_ci } 1042498b56bSopenharmony_ci } 1052498b56bSopenharmony_ci cflags = [ "-Wno-deprecated-declarations" ] 1062498b56bSopenharmony_ci public_configs = [ ":libhilog_config" ] 1072498b56bSopenharmony_ci configs = [ ":libhilog_config" ] 1082498b56bSopenharmony_ci 1092498b56bSopenharmony_ci external_deps = [ "bounds_checking_function:libsec_shared" ] 1102498b56bSopenharmony_ci 1112498b56bSopenharmony_ci if (platform != "windows" && platform != "mac" && platform != "linux") { 1122498b56bSopenharmony_ci external_deps += [ "init:libbegetutil" ] 1132498b56bSopenharmony_ci } 1142498b56bSopenharmony_ci 1152498b56bSopenharmony_ci part_name = "hilog" 1162498b56bSopenharmony_ci subsystem_name = "hiviewdfx" 1172498b56bSopenharmony_ci } 1182498b56bSopenharmony_ci} 1192498b56bSopenharmony_ci 1202498b56bSopenharmony_ciforeach(item, platforms) { 1212498b56bSopenharmony_ci libhilog_source("libhilog_source_" + item) { 1222498b56bSopenharmony_ci platform = item 1232498b56bSopenharmony_ci } 1242498b56bSopenharmony_ci} 125