当前仓库属于关闭状态,部分功能使用受限,详情请查阅 仓库状态说明
1 Star 0 Fork 5

sig-ci-test/ace_napi
关闭

forked from OpenHarmony/ace_napi
关闭
 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
BUILD.gn 10.88 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("//foundation/arkui/napi/napi.gni")
config("ace_napi_config") {
include_dirs = [
"//foundation/arkui/napi",
"//foundation/arkui/napi/interfaces/inner_api",
"//foundation/arkui/napi/interfaces/kits",
"//third_party/libuv/include",
"//third_party/node/src",
]
}
if (defined(ohos_lite)) {
import("//build/lite/config/component/lite_component.gni")
import("//build/lite/config/subsystem/aafwk/config.gni")
config("ace_napi_jerryscript_config") {
include_dirs = [
"//foundation/arkui/napi",
"//foundation/arkui/napi/native_engine",
"//foundation/arkui/napi/native_engine/impl/jerryscript",
"//third_party/jerryscript/jerry-ext/include",
"//third_party/jerryscript/jerry-core/include",
"//third_party/jerryscript/jerry-port/default/include",
"//third_party/libuv/include",
]
}
shared_library("ace_napi") {
public_configs = [ ":ace_napi_config" ]
include_dirs = [
"//foundation/arkui/napi",
"//foundation/arkui/napi/interfaces/inner_api",
"//foundation/arkui/napi/interfaces/kits",
"//third_party/libuv/include",
"//third_party/node/src",
"//third_party/bounds_checking_function/include",
]
sources = napi_sources
if (current_cpu == "arm64") {
defines = [ "_ARM64_" ]
}
deps = [
"//base//hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//third_party/bounds_checking_function:libsec_shared",
"//third_party/libuv:uv",
]
cflags = [ "-fPIC" ]
}
shared_library("ace_napi_jerryscript") {
configs -= [ "//build/lite/config:language_cpp" ]
public_configs = [ ":ace_napi_jerryscript_config" ]
include_dirs = [
"//foundation/arkui/napi",
"//foundation/arkui/napi/native_engine",
"//foundation/arkui/napi/native_engine/impl/jerryscript",
"//third_party/jerryscript/jerry-ext/include",
"//third_party/jerryscript/jerry-core/include",
"//third_party/jerryscript/jerry-port/default/include",
"//third_party/libuv/include",
"//third_party/bounds_checking_function/include",
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits",
]
cflags = [ "-fPIC" ]
cflags_cc = cflags
cflags_cc += [ "-std=c++14" ]
ldflags = [
"-lstdc++",
"-lpthread",
]
sources = [
"native_engine/impl/jerryscript/jerryscript_ext.cpp",
"native_engine/impl/jerryscript/jerryscript_native_deferred.cpp",
"native_engine/impl/jerryscript/jerryscript_native_engine.cpp",
"native_engine/impl/jerryscript/jerryscript_native_reference.cpp",
"native_engine/impl/jerryscript/native_value/jerryscript_native_array.cpp",
"native_engine/impl/jerryscript/native_value/jerryscript_native_array_buffer.cpp",
"native_engine/impl/jerryscript/native_value/jerryscript_native_big_int.cpp",
"native_engine/impl/jerryscript/native_value/jerryscript_native_boolean.cpp",
"native_engine/impl/jerryscript/native_value/jerryscript_native_buffer.cpp",
"native_engine/impl/jerryscript/native_value/jerryscript_native_data_view.cpp",
"native_engine/impl/jerryscript/native_value/jerryscript_native_date.cpp",
"native_engine/impl/jerryscript/native_value/jerryscript_native_external.cpp",
"native_engine/impl/jerryscript/native_value/jerryscript_native_function.cpp",
"native_engine/impl/jerryscript/native_value/jerryscript_native_number.cpp",
"native_engine/impl/jerryscript/native_value/jerryscript_native_object.cpp",
"native_engine/impl/jerryscript/native_value/jerryscript_native_string.cpp",
"native_engine/impl/jerryscript/native_value/jerryscript_native_typed_array.cpp",
"native_engine/impl/jerryscript/native_value/jerryscript_native_value.cpp",
]
deps = [
":ace_napi",
"//base//hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//third_party/bounds_checking_function:libsec_shared",
"//third_party/jerryscript/jerry-core:jerry-core_shared",
"//third_party/jerryscript/jerry-ext:jerry-ext_shared",
"//third_party/jerryscript/jerry-port/default:jerry-port-default_shared",
]
}
} else {
import("//build/ohos.gni")
import("//foundation/arkui/ace_engine/ace_config.gni")
if (target_os == "ios") {
ohos_source_set("ace_napi") {
defines = []
public_configs = [ ":ace_napi_config" ]
public_deps = [ "//third_party/libuv:uv" ]
deps = []
include_dirs = [
"//foundation/arkui/napi",
"//foundation/arkui/napi/interfaces/inner_api",
"//foundation/arkui/napi/interfaces/kits",
"//third_party/libuv/include",
"//third_party/node/src",
"//utils/native/base/include",
]
sources = napi_sources
if (current_cpu == "arm64") {
defines += [ "_ARM64_" ]
}
defines += [ "IOS_PLATFORM" ]
deps += [
"//third_party/libuv:uv",
"//utils/native/base:utilsecurec",
]
# Use static libuv for cross build
if (is_cross_platform_build) {
public_deps -= [ "//third_party/libuv:uv" ]
deps -= [ "//third_party/libuv:uv" ]
deps += [ "//third_party/libuv:uv_static" ]
}
cflags_cc = [ "-Wno-missing-braces" ]
subsystem_name = "arkui"
part_name = "napi"
}
} else {
ohos_shared_library("ace_napi") {
defines = []
public_configs = [ ":ace_napi_config" ]
public_deps = [ "//third_party/libuv:uv" ]
deps = []
include_dirs = [
"//foundation/arkui/napi",
"//foundation/arkui/napi/interfaces/inner_api",
"//foundation/arkui/napi/interfaces/kits",
"//third_party/libuv/include",
"//third_party/node/src",
"//utils/native/base/include",
]
sources = napi_sources
if (current_cpu == "arm64") {
defines += [ "_ARM64_" ]
}
if (use_mingw_win) {
defines += [ "WINDOWS_PLATFORM" ]
} else if (use_mac) {
defines += [ "MAC_PLATFORM" ]
} else if (target_os == "ios") {
defines += [ "IOS_PLATFORM" ]
} else if (is_cross_platform_build && defined(is_android) && is_android) {
defines += [ "ANDROID_PLATFORM" ]
aosp_deps = [ "shared_library:liblog" ]
} else {
if (is_standard_system) {
external_deps = [
"hitrace_native:libhitrace",
"hiviewdfx_hilog_native:libhilog",
]
defines += [ "ENABLE_HITRACE" ]
if (product_name != "ohos-sdk") {
if (napi_enable_container_scope) {
deps += [ ":ace_container_scope" ]
defines += [ "ENABLE_CONTAINER_SCOPE" ]
}
}
} else {
external_deps = [ "hilog:libhilog" ]
}
}
deps += [
"//third_party/libuv:uv",
"//utils/native/base:utilsecurec",
]
# Use static libuv for cross build
if (is_cross_platform_build) {
public_deps -= [ "//third_party/libuv:uv" ]
deps -= [ "//third_party/libuv:uv" ]
deps += [ "//third_party/libuv:uv_static" ]
}
cflags_cc = [ "-Wno-missing-braces" ]
subsystem_name = "arkui"
part_name = "napi"
}
}
config("container_scope_config") {
visibility = [ ":*" ]
include_dirs = [ "$ace_root/frameworks" ]
}
ohos_shared_library("ace_container_scope") {
public_configs = [ ":container_scope_config" ]
configs = [ "$ace_root:ace_config" ]
sources = [ "$ace_root/frameworks/core/common/container_scope.cpp" ]
subsystem_name = "arkui"
part_name = "napi"
}
template("ace_napi_lib") {
forward_variables_from(invoker, "*")
if (defined(use_js_debug) && use_js_debug) {
deps_ = [
"native_engine/impl/${engine_path}:ace_napi_impl_${engine_path}_debug",
]
} else {
deps_ =
[ "native_engine/impl/${engine_path}:ace_napi_impl_${engine_path}" ]
}
if (target_os == "ios") {
ohos_source_set(target_name) {
public_configs = [
"native_engine/impl/${engine_path}:ace_napi_${engine_path}_config",
]
deps = deps_
subsystem_name = "arkui"
part_name = "napi"
}
} else {
ohos_shared_library(target_name) {
public_configs = [
"native_engine/impl/${engine_path}:ace_napi_${engine_path}_config",
]
deps = deps_
subsystem_name = "arkui"
part_name = "napi"
}
}
}
napi_libs = []
foreach(item, ace_platforms) {
if (item.name == "ohos" || item.name == "android") {
engine_config = {
}
support_engines = {
}
engine_config = item.config
support_engines = engine_config.js_engines
foreach(engine, support_engines) {
if (engine.engine_name != "ark") {
ace_napi_lib("ace_napi_${engine.engine_path}") {
engine_path = engine.engine_path
}
napi_libs += [ ":ace_napi_${engine.engine_path}" ]
if (defined(engine.have_debug) && engine.have_debug) {
ace_napi_lib("ace_napi_${engine.engine_path}_debug") {
engine_path = engine.engine_path
use_js_debug = true
}
napi_libs += [ ":ace_napi_${engine.engine_path}_debug" ]
}
} else if (engine.engine_name == "ark") {
ace_napi_lib("ace_napi_${engine.engine_name}") {
engine_path = engine.engine_name
}
napi_libs += [ ":ace_napi_${engine.engine_name}" ]
}
}
}
}
group("napi_packages") {
deps = [ ":ace_napi" ]
deps += napi_libs
}
ohos_ndk_library("libnapi_ndk") {
ndk_description_file = "./libnapi.ndk.json"
min_compact_version = "1"
output_name = "ace_napi"
}
ohos_ndk_headers("napi_header") {
dest_dir = "$ndk_headers_out_dir/napi"
sources = [ "//foundation/arkui/napi/interfaces/kits/napi/native_api.h" ]
}
group("napi_packages_ndk") {
deps = [ ":libnapi_ndk" ]
}
if (!build_ohos_ndk && !is_cross_platform_build) {
group("napi_packages_test") {
testonly = true
deps = [
"sample/native_module_calc:calc",
"sample/native_module_calc:number",
"sample/native_module_callback:callback",
"sample/native_module_demo:demo",
"sample/native_module_netserver:netserver",
"sample/native_module_storage:storage",
"test/unittest:unittest",
]
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sig-ci-test/ace_napi.git
git@gitee.com:sig-ci-test/ace_napi.git
sig-ci-test
ace_napi
ace_napi
master

搜索帮助