这是dsoftbus/core/discovery/coap
目录的结构
.
├── common
│ ├── include
│ │ └── disc_coap_parser.h
│ └── src
│ └── disc_coap_parser.c
├── disc_coap.gni
├── interface
│ ├── disc_coap.h
│ └── disc_coap_virtual.c
└── nstackx_coap
├── include
│ ├── disc_coap_capability.h
│ └── disc_nstackx_adapter.h
└── src
├── disc_coap.c
├── disc_coap_capability.c
└── disc_nstackx_adapter.c
说说disc_coap.gni
# 导入相关模块
import("../../../dsoftbus.gni")
import("../../common/dfx/dsoftbus_dfx.gni")
# 根据dsoftbus_feature_disc_coap的值判断是否需要加载disc_coap_src列表
if (dsoftbus_feature_disc_coap == true) {
# 如果dsoftbus_feature_disc_coap为true,则加载disc_coap_src列表
disc_coap_src = [
"$dsoftbus_root_path/core/discovery/coap/common/src/disc_coap_parser.c",
"$dsoftbus_root_path/core/discovery/coap/nstackx_coap/src/disc_coap.c",
"$dsoftbus_root_path/core/discovery/coap/nstackx_coap/src/disc_nstackx_adapter.c",
]
} else {
# 如果dsoftbus_feature_disc_coap为false,则加载disc_coap_src列表
disc_coap_src = [
"$dsoftbus_root_path/core/discovery/coap/interface/disc_coap_virtual.c",
]
}
# 定义disc_coap_inc列表,包含需要引入的头文件路径
# 我们可以发现头文件不受dsoftbus_feature_disc_coap的影响,只有实现受到影响
disc_coap_inc = [
"$dsoftbus_root_path/core/discovery/coap/interface",
"$dsoftbus_root_path/core/discovery/coap/common/include",
"$dsoftbus_root_path/core/discovery/coap/nstackx_coap/include",
"$dsoftbus_root_path/interfaces/kits/bus_center",
"$dsoftbus_root_path/interfaces/kits/common",
"$dsoftbus_root_path/interfaces/kits/discovery",
"$dsoftbus_root_path/core/common/include",
"$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include",
"//third_party/cJSON",
]
# 根据dsoftbus_feature_ex_kits的值判断是否需要加载coap_enhance_src和coap_enhance_inc
if (dsoftbus_feature_ex_kits) {
# 如果dsoftbus_feature_ex_kits为true,则导入coap_enhance.gni文件
import("$dsoftbus_root_path/dsoftbus_enhance/core/discovery/coap/coap_enhance.gni")
# 将coap_enhance_src添加到disc_coap_src列表中
disc_coap_src += coap_enhance_src
# 将coap_enhance_inc添加到disc_coap_inc列表中
disc_coap_inc += coap_enhance_inc
} else {
# 如果dsoftbus_feature_ex_kits为false,则将disc_coap_src列表添加一个文件路径
# 显然,上面的coap_enhance_src和coap_enhance_inc是coap_enhance.gni中定义的
disc_coap_src += [ "$dsoftbus_root_path/core/discovery/coap/nstackx_coap/src/disc_coap_capability.c" ]
}
# 定义disc_coap_deps列表,包含需要依赖的模块
disc_coap_deps = [
"$dsoftbus_dfx_path/anonymize:softbus_dfx_anonymizer",
"$dsoftbus_dfx_path/log:softbus_dfx_log",
"$dsoftbus_root_path/components/nstackx/nstackx_ctrl:nstackx_ctrl",
]
标签:OpenHarmony,4.1,dsoftbus,src,走读,coap,disc,path,root
From: https://www.cnblogs.com/Hubugui/p/18006363