14 Star 8 Fork 83

OpenHarmony/third_party_libuv

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
BUILD.gn 9.63 KB
一键复制 编辑 原始数据 按行查看 历史
liaoxingxing 提交于 2024-10-29 22:32 . 修改打印req位置
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
if (defined(ohos_lite)) {
import("//build/lite/config/component/lite_component.gni")
import("//build/lite/ndk/ndk.gni")
import("//third_party/libuv/libuv.gni")
# This is the configuration needed to use libuv.
config("libuv_config") {
include_dirs = [
"include",
"src",
"src/unix",
]
cflags = [
"-Wno-unused-parameter",
"-Wno-incompatible-pointer-types",
"-D_GNU_SOURCE",
"-D_POSIX_C_SOURCE=200112",
]
}
# This is the configuration used to build libuv itself.
# It should not be needed outside of this library.
config("libuv_private_config") {
visibility = [ ":*" ]
include_dirs = [
"include",
"src",
"src/unix",
]
}
source_set("libuv_source") {
include_dirs = [
"include",
"src",
"src/unix",
]
cflags = [
"-Wno-unused-parameter",
"-Wno-incompatible-pointer-types",
"-D_GNU_SOURCE",
"-D_POSIX_C_SOURCE=200112",
"-U__linux__",
"-D__GNU__",
"-fPIC",
]
sources = [
# common_source
"src/fs-poll.c",
"src/idna.c",
"src/inet.c",
"src/random.c",
"src/strscpy.c",
"src/strtok.c",
"src/thread-common.c",
"src/threadpool.c",
"src/timer.c",
"src/uv-common.c",
"src/uv-data-getter-setters.c",
"src/version.c",
# nonwin_srcs
"src/unix/async.c",
"src/unix/core.c",
"src/unix/dl.c",
"src/unix/fs.c",
"src/unix/getaddrinfo.c",
"src/unix/getnameinfo.c",
"src/unix/linux.c",
"src/unix/loop-watcher.c",
"src/unix/loop.c",
"src/unix/no-fsevents.c",
"src/unix/pipe.c",
"src/unix/poll.c",
"src/unix/posix-hrtime.c",
"src/unix/posix-poll.c",
"src/unix/process.c",
"src/unix/random-devurandom.c",
"src/unix/signal.c",
"src/unix/stream.c",
"src/unix/tcp.c",
"src/unix/thread.c",
"src/unix/tty.c",
"src/unix/udp.c",
]
}
static_library("uv_static") {
deps = [ ":libuv_source" ]
public_configs = [ ":libuv_config" ]
}
shared_library("uv") {
deps = [ ":libuv_source" ]
public_configs = [ ":libuv_config" ]
libs = [
"pthread",
"dl",
]
}
} else {
import("//build/ohos.gni")
import("//third_party/libuv/libuv.gni")
common_source = [
"src/fs-poll.c",
"src/idna.c",
"src/inet.c",
"src/random.c",
"src/strscpy.c",
"src/threadpool.c",
"src/thread-common.c",
"src/timer.c",
"src/uv-common.c",
"src/uv-data-getter-setters.c",
"src/version.c",
"src/strtok.c",
]
if (!is_mingw && !is_win) {
nonwin_srcs = [
"src/unix/async.c",
"src/unix/core.c",
"src/unix/dl.c",
"src/unix/fs.c",
"src/unix/getaddrinfo.c",
"src/unix/getnameinfo.c",
"src/unix/loop.c",
"src/unix/loop-watcher.c",
"src/unix/pipe.c",
"src/unix/poll.c",
"src/unix/process.c",
"src/unix/random-devurandom.c",
"src/unix/signal.c",
"src/unix/stream.c",
"src/unix/tcp.c",
"src/unix/thread.c",
"src/unix/tty.c",
"src/unix/udp.c",
]
}
# This is the configuration needed to use libuv.
config("libuv_config") {
include_dirs = [
"include",
"src",
"src/unix",
]
cflags = [ "-Wno-unused-parameter" ]
if (is_linux || is_ohos) {
cflags += [
"-Wno-incompatible-pointer-types",
"-D_GNU_SOURCE",
"-D_POSIX_C_SOURCE=200112",
]
defines = []
if (libuv_use_ffrt && is_ohos) {
defines += [ "USE_FFRT" ]
}
if (enable_async_stack && is_ohos) {
defines += [ "ASYNC_STACKTRACE" ]
}
if (enable_uv_statisic && is_ohos) {
defines += [ "UV_STATISTIC" ]
cflags +=
[ "-Wno-frame-address" ] # for use of __builtin_return_address
}
if (use_ohos_dfx && is_ohos && !is_emulator) {
defines += [ "USE_OHOS_DFX" ]
}
} else if (is_mingw || is_win) {
cflags += [
"-Wno-missing-braces",
"-Wno-implicit-function-declaration",
"-Wno-error=return-type",
"-Wno-error=sign-compare",
"-Wno-error=unused-variable",
"-Wno-error=unknown-pragmas",
"-Wno-unused-variable",
]
defines = [
"WIN32_LEAN_AND_MEAN",
"_WIN32_WINNT=0x0600",
"_CRT_DECLARE_NONSTDC_NAMES=0",
]
libs = [
"psapi",
"user32",
"advapi32",
"iphlpapi",
"userenv",
"ws2_32",
"dbghelp",
"ole32",
"shell32",
]
}
}
# This is the configuration used to build libuv itself.
# It should not be needed outside of this library.
config("libuv_private_config") {
visibility = [ ":*" ]
include_dirs = [
"include",
"src",
"src/unix",
]
}
ohos_source_set("libuv_source") {
branch_protector_ret = "pac_ret"
configs = [ ":libuv_config" ]
cflags = [ "-fvisibility=hidden" ]
sources = common_source
external_deps = []
if (is_mac || (defined(is_ios) && is_ios)) {
sources += nonwin_srcs + [
"src/unix/bsd-ifaddrs.c",
"src/unix/darwin-proctitle.c",
"src/unix/darwin.c",
"src/unix/fsevents.c",
"src/unix/kqueue.c",
"src/unix/log_unix.c",
"src/unix/os390-proctitle.c",
"src/unix/random-getentropy.c",
"src/unix/trace_unix.c",
]
} else if (is_mingw || is_win) {
sources += [
"src/win/async.c",
"src/win/core.c",
"src/win/detect-wakeup.c",
"src/win/dl.c",
"src/win/error.c",
"src/win/fs-event.c",
"src/win/fs.c",
"src/win/getaddrinfo.c",
"src/win/getnameinfo.c",
"src/win/handle.c",
"src/win/log_win.c",
"src/win/loop-watcher.c",
"src/win/pipe.c",
"src/win/poll.c",
"src/win/process-stdio.c",
"src/win/process.c",
"src/win/signal.c",
"src/win/snprintf.c",
"src/win/stream.c",
"src/win/tcp.c",
"src/win/thread.c",
"src/win/trace_win.c",
"src/win/tty.c",
"src/win/udp.c",
"src/win/util.c",
"src/win/winapi.c",
"src/win/winsock.c",
]
} else if (is_ohos || (defined(is_android) && is_android)) {
sources += nonwin_srcs + [
"src/unix/linux.c",
"src/unix/procfs-exepath.c",
"src/unix/proctitle.c",
"src/unix/random-getentropy.c",
"src/unix/random-getrandom.c",
"src/unix/random-sysctl-linux.c",
]
if (libuv_use_ffrt) {
external_deps += [ "ffrt:libffrt" ]
}
if (is_ohos) {
sources += [ "src/unix/ohos/trace_ohos.c" ]
if (is_emulator) {
sources += [ "src/unix/ohos/log_ohos.c" ]
}
external_deps += [
"hilog:libhilog",
"hitrace:hitrace_meter",
]
}
if (is_ohos && enable_async_stack) {
sources += [ "src/dfx/async_stack/libuv_async_stack.c" ]
}
if (is_android) {
sources += [
"src/win/log_win.c",
"src/win/trace_win.c",
]
}
} else if (is_linux) {
sources += nonwin_srcs + [
"src/unix/linux.c",
"src/unix/log_unix.c",
"src/unix/procfs-exepath.c",
"src/unix/proctitle.c",
"src/unix/random-getrandom.c",
"src/unix/random-sysctl-linux.c",
"src/unix/trace_unix.c",
]
} else {
sources += nonwin_srcs + [
"src/unix/linux.c",
"src/unix/procfs-exepath.c",
"src/unix/proctitle.c",
"src/unix/random-getrandom.c",
"src/unix/random-sysctl-linux.c",
]
}
subsystem_name = "thirdparty"
part_name = "libuv"
}
ohos_static_library("uv_static") {
deps = [ ":libuv_source" ]
public_configs = [ ":libuv_config" ]
subsystem_name = "thirdparty"
part_name = "libuv"
}
ohos_shared_library("uv") {
deps = [ ":libuv_source" ]
public_configs = [ ":libuv_config" ]
subsystem_name = "thirdparty"
innerapi_tags = [ "platformsdk" ]
part_name = "libuv"
if (is_ohos) {
output_extension = "so"
external_deps = [ "hilog:libhilog" ]
}
install_images = [
"system",
"updater",
]
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/third_party_libuv.git
git@gitee.com:openharmony/third_party_libuv.git
openharmony
third_party_libuv
third_party_libuv
master

搜索帮助