1 Star 0 Fork 47

张婷/third_party_libxml2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
BUILD.gn 5.98 KB
一键复制 编辑 原始数据 按行查看 历史
# Copyright (c) 2021 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")
# This is the configuration needed to use libxml2.
config("libxml2_config") {
include_dirs = [ "include" ]
}
# This is the configuration used to build libxml2 itself. It should not be needed outside of this
# library.
#
# This has to be a config instead of flags directly specified on the libxml2 target so the -Wno-*
# flags are ordered after the -Werror flags from the default configs.
config("libxml2_private_config") {
visibility = [ ":*" ]
cflags = [
"-Wno-empty-body",
"-Wno-incompatible-pointer-types",
"-Wno-missing-field-initializers",
"-Wno-self-assign",
"-Wno-sign-compare",
"-Wno-tautological-pointer-compare",
"-Wno-unused-function",
"-Wno-enum-compare",
]
defines = [
"HAVE_CONFIG_H",
"_REENTRANT",
]
if (is_linux) {
defines += [ "_GNU_SOURCE" ]
}
}
group("libxml2") {
public_deps = [ ":xml2" ]
}
manager_sources = [
"DOCBparser.c",
"HTMLparser.c",
"HTMLtree.c",
"SAX.c",
"SAX2.c",
"buf.c",
"c14n.c",
"catalog.c",
"chvalid.c",
"debugXML.c",
"dict.c",
"encoding.c",
"entities.c",
"error.c",
"globals.c",
"hash.c",
"include/libxml/DOCBparser.h",
"include/libxml/HTMLparser.h",
"include/libxml/HTMLtree.h",
"include/libxml/SAX.h",
"include/libxml/SAX2.h",
"include/libxml/c14n.h",
"include/libxml/catalog.h",
"include/libxml/chvalid.h",
"include/libxml/debugXML.h",
"include/libxml/dict.h",
"include/libxml/encoding.h",
"include/libxml/entities.h",
"include/libxml/globals.h",
"include/libxml/hash.h",
"include/libxml/list.h",
"include/libxml/nanoftp.h",
"include/libxml/nanohttp.h",
"include/libxml/parser.h",
"include/libxml/parserInternals.h",
"include/libxml/pattern.h",
"include/libxml/relaxng.h",
"include/libxml/schemasInternals.h",
"include/libxml/schematron.h",
"include/libxml/threads.h",
"include/libxml/tree.h",
"include/libxml/uri.h",
"include/libxml/valid.h",
"include/libxml/xinclude.h",
"include/libxml/xlink.h",
"include/libxml/xmlIO.h",
"include/libxml/xmlautomata.h",
"include/libxml/xmlerror.h",
"include/libxml/xmlexports.h",
"include/libxml/xmlmemory.h",
"include/libxml/xmlmodule.h",
"include/libxml/xmlreader.h",
"include/libxml/xmlregexp.h",
"include/libxml/xmlsave.h",
"include/libxml/xmlschemas.h",
"include/libxml/xmlschemastypes.h",
"include/libxml/xmlstring.h",
"include/libxml/xmlunicode.h",
"include/libxml/xmlversion.h",
"include/libxml/xmlwriter.h",
"include/libxml/xpath.h",
"include/libxml/xpathInternals.h",
"include/libxml/xpointer.h",
"legacy.c",
"list.c",
"nanoftp.c",
"nanohttp.c",
"parser.c",
"parserInternals.c",
"pattern.c",
"relaxng.c",
"schematron.c",
"threads.c",
"tree.c",
"uri.c",
"valid.c",
"xinclude.c",
"xlink.c",
"xmlIO.c",
"xmlmemory.c",
"xmlmodule.c",
"xmlreader.c",
"xmlregexp.c",
"xmlsave.c",
"xmlschemas.c",
"xmlschemastypes.c",
"xmlstring.c",
"xmlunicode.c",
"xmlwriter.c",
"xpath.c",
"xpointer.c",
"xzlib.c",
]
ohos_shared_library("xml2") {
sources = manager_sources
public_configs = [ ":libxml2_config" ]
configs = [ ":libxml2_private_config" ]
if (is_linux) {
libs = [ "dl" ]
}
deps = [ "//third_party/zlib:libz" ]
part_name = "libxml2"
subsystem_name = "thirdparty"
}
config("libxml2_static_config") {
cflags = [
"-Wno-implicit-fallthrough",
"-Wno-implicit-function-declaration",
"-Wno-int-conversion",
"-Wno-uninitialized",
"-Wno-sometimes-uninitialized",
]
include_dirs = []
if (is_mingw) {
defines = [ "LIBXML_STATIC" ]
include_dirs += [ get_label_info(":libxml2_generate_header",
"target_out_dir") + "/include" ]
} else if (is_mac) {
defines = [ "LIBXML_THREAD_ENABLED" ]
} else if (is_linux) {
include_dirs += [ get_label_info(":libxml2_generate_header",
"target_out_dir") + "/include" ]
} else {
defines = [
"HAVE_CONFIG_H",
"_REENTRANT",
]
}
include_dirs += [ "include" ]
cflags_cc = [ "-std=c++17" ]
}
ohos_static_library("static_libxml2") {
sources = manager_sources
public_configs = [ ":libxml2_static_config" ]
deps = [ ":libxml2_generate_header" ]
subsystem_name = "thirdparty"
part_name = "libxml2"
}
action("libxml2_generate_header") {
script = "generate_header.py"
inputs = [
"config.h.cmake.in",
"include/libxml/xmlversion.h.in",
]
config_json_path = "config_linux.json"
xml_version_json_path = "xml_version.json"
if (is_mingw) {
config_json_path = "config_win.json"
}
inputs += [ config_json_path ]
inputs += [ xml_version_json_path ]
config_path = get_label_info(":libxml2_generate_header", "target_out_dir") +
"/include/config.h"
xmlversion_path =
get_label_info(":libxml2_generate_header", "target_out_dir") +
"/include/libxml/xmlversion.h"
outputs = [
config_path,
xmlversion_path,
]
args = [
"--config-input-path",
rebase_path("config.h.cmake.in", root_build_dir),
"--config-path",
rebase_path(config_path, root_build_dir),
"--xmlversion-input-path",
rebase_path("include/libxml/xmlversion.h.in", root_build_dir),
"--xmlversion-path",
rebase_path(xmlversion_path, root_build_dir),
"--config-json",
rebase_path(config_json_path, root_build_dir),
"--xmlversion-json",
rebase_path(xml_version_json_path, root_build_dir),
]
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zt147369/third_party_libxml2.git
git@gitee.com:zt147369/third_party_libxml2.git
zt147369
third_party_libxml2
third_party_libxml2
master

搜索帮助