2022-02-23 06:57:46 +00:00
|
|
|
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
2021-09-27 13:44:21 +00:00
|
|
|
# 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")
|
2022-04-26 12:00:52 +00:00
|
|
|
import("//foundation/arkui/ace_engine/ace_config.gni")
|
|
|
|
import("//foundation/arkui/ace_engine/build/ace_lib.gni")
|
2021-09-27 13:44:21 +00:00
|
|
|
|
|
|
|
# generate libace_engine and libace_debug targets
|
|
|
|
foreach(item, ace_platforms) {
|
|
|
|
platform = item.name
|
|
|
|
engine_config = {
|
|
|
|
}
|
|
|
|
engine_config = item.config
|
|
|
|
support_engines = []
|
|
|
|
support_engines = engine_config.js_engines
|
|
|
|
|
|
|
|
# generate libace_static lib
|
|
|
|
libace_static("libace_static_" + item.name) {
|
|
|
|
platform = item.name
|
|
|
|
config = {
|
|
|
|
}
|
|
|
|
|
|
|
|
if (defined(item.config)) {
|
|
|
|
config = item.config
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# generate separated libace_engine lib
|
2023-08-08 12:59:40 +00:00
|
|
|
if (current_os == "ohos") {
|
2023-02-15 08:05:45 +00:00
|
|
|
build_in_engine = defined(engine_config.use_build_in_js_engine) &&
|
|
|
|
engine_config.use_build_in_js_engine
|
2021-09-27 13:44:21 +00:00
|
|
|
foreach(engine, support_engines) {
|
2023-01-10 11:13:42 +00:00
|
|
|
if (!build_in_engine) {
|
|
|
|
# generate libace_engine
|
2023-08-08 12:59:40 +00:00
|
|
|
ace_bridge_engine("libace_engine_${engine.engine_name}_${platform}") {
|
2021-09-27 13:44:21 +00:00
|
|
|
platform = item.name
|
|
|
|
engine_name = engine.engine_name
|
|
|
|
build_type = "engine"
|
2023-01-10 11:13:42 +00:00
|
|
|
use_js_debug = false
|
|
|
|
}
|
|
|
|
|
|
|
|
# generate libace_engine_debug
|
|
|
|
if (defined(engine.have_debug) && engine.have_debug) {
|
2023-08-08 12:59:40 +00:00
|
|
|
ace_bridge_engine(
|
|
|
|
"libace_engine_${engine.engine_name}_debug_${platform}") {
|
2023-01-10 11:13:42 +00:00
|
|
|
platform = item.name
|
|
|
|
engine_name = engine.engine_name
|
|
|
|
build_type = "engine"
|
|
|
|
use_js_debug = true
|
|
|
|
}
|
2021-09-27 13:44:21 +00:00
|
|
|
}
|
|
|
|
|
2023-01-10 11:13:42 +00:00
|
|
|
# generate libace_engine_declarative
|
2023-08-08 12:59:40 +00:00
|
|
|
ace_bridge_engine(
|
|
|
|
"libace_engine_declarative_${engine.engine_name}_${platform}") {
|
2023-01-10 11:13:42 +00:00
|
|
|
platform = item.name
|
|
|
|
engine_name = engine.engine_name
|
|
|
|
build_type = "engine_declarative"
|
|
|
|
}
|
2021-09-27 13:44:21 +00:00
|
|
|
}
|
|
|
|
|
2021-11-25 09:22:08 +00:00
|
|
|
# generate libace_engine_pa
|
2023-08-26 03:30:54 +00:00
|
|
|
if (defined(engine_config.js_pa_support) && engine_config.js_pa_support &&
|
|
|
|
platform != "ohos_ng") {
|
|
|
|
ace_bridge_engine("libace_engine_pa_${engine.engine_name}") {
|
2021-09-27 13:44:21 +00:00
|
|
|
platform = item.name
|
|
|
|
engine_name = engine.engine_name
|
|
|
|
build_type = "engine_pa"
|
|
|
|
pa_engine_path = engine_config.pa_engine_path
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-29 05:28:56 +00:00
|
|
|
# Config for reduceing eh_frame section on aosp platform to save rom size.
|
2021-09-27 13:44:21 +00:00
|
|
|
config("reduce_eh_frame_config") {
|
2022-09-01 02:07:35 +00:00
|
|
|
if (!use_mingw_win && !use_mac && !use_linux) {
|
2021-09-27 13:44:21 +00:00
|
|
|
cflags = [
|
|
|
|
"-fno-unwind-tables",
|
|
|
|
"-fomit-frame-pointer",
|
|
|
|
]
|
|
|
|
cflags_cc = cflags
|
|
|
|
}
|
|
|
|
}
|
2023-07-04 03:47:02 +00:00
|
|
|
|
2024-04-06 06:33:43 +00:00
|
|
|
config("ace_engine_public_config") {
|
|
|
|
if (use_hilog) {
|
|
|
|
defines = [ "USE_HILOG" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-19 04:12:35 +00:00
|
|
|
config("lto_link_config") {
|
2024-04-22 03:21:57 +00:00
|
|
|
ldflags = [ "-Wl,--lto-O2" ]
|
2024-04-19 04:12:35 +00:00
|
|
|
}
|
|
|
|
|
2023-08-08 12:59:40 +00:00
|
|
|
ohos_shared_library("libace_compatible") {
|
2024-04-06 06:33:43 +00:00
|
|
|
public_configs = [ ":ace_engine_public_config" ]
|
2024-03-19 13:11:53 +00:00
|
|
|
if (use_hilog) {
|
2024-03-14 09:22:23 +00:00
|
|
|
external_deps = [ "hilog:libhilog" ]
|
|
|
|
}
|
2023-07-04 03:47:02 +00:00
|
|
|
if (is_ohos) {
|
|
|
|
sanitize = {
|
|
|
|
integer_overflow = true
|
|
|
|
boundary_sanitize = true
|
|
|
|
debug = ace_sanitize_debug
|
|
|
|
}
|
|
|
|
deps = [ "$ace_root/build:libace_static_ohos" ]
|
|
|
|
version_script = "libace.map"
|
|
|
|
innerapi_tags = [ "platformsdk" ]
|
|
|
|
configs = [ "$ace_root:ace_coverage_config" ]
|
2024-04-19 04:12:35 +00:00
|
|
|
if (is_clang && (target_cpu == "arm" || target_cpu == "arm64") &&
|
|
|
|
enhanced_opt) {
|
|
|
|
configs += [ ":lto_link_config" ]
|
|
|
|
}
|
2023-07-04 03:47:02 +00:00
|
|
|
} else if (use_mingw_win) {
|
|
|
|
deps = [ "$ace_root/build:libace_static_windows" ]
|
|
|
|
} else if (use_mac) {
|
|
|
|
deps = [ "$ace_root/build:libace_static_mac" ]
|
|
|
|
} else if (use_linux) {
|
|
|
|
deps = [ "$ace_root/build:libace_static_linux" ]
|
|
|
|
}
|
2024-04-06 06:33:43 +00:00
|
|
|
public_external_deps = external_deps
|
2023-07-04 03:47:02 +00:00
|
|
|
part_name = ace_engine_part
|
|
|
|
subsystem_name = ace_engine_subsystem
|
|
|
|
}
|
2023-08-08 12:59:40 +00:00
|
|
|
|
2023-08-29 13:13:31 +00:00
|
|
|
if (!is_asan) {
|
|
|
|
ohos_shared_library("libace") {
|
2024-03-19 13:11:53 +00:00
|
|
|
if (use_hilog) {
|
2024-03-14 09:22:23 +00:00
|
|
|
external_deps = [ "hilog:libhilog" ]
|
|
|
|
}
|
2023-08-29 13:13:31 +00:00
|
|
|
if (is_ohos) {
|
|
|
|
sanitize = {
|
|
|
|
integer_overflow = true
|
|
|
|
boundary_sanitize = true
|
|
|
|
debug = ace_sanitize_debug
|
|
|
|
}
|
|
|
|
deps = [ "$ace_root/build:libace_static_ohos_ng" ]
|
|
|
|
version_script = "libace.map"
|
|
|
|
innerapi_tags = [ "platformsdk" ]
|
|
|
|
configs = [ "$ace_root:ace_coverage_config" ]
|
|
|
|
} else if (use_mingw_win) {
|
|
|
|
deps = [ "$ace_root/build:libace_static_windows" ]
|
|
|
|
} else if (use_mac) {
|
|
|
|
deps = [ "$ace_root/build:libace_static_mac" ]
|
|
|
|
} else if (use_linux) {
|
|
|
|
deps = [ "$ace_root/build:libace_static_linux" ]
|
2023-08-08 12:59:40 +00:00
|
|
|
}
|
2024-04-06 06:33:43 +00:00
|
|
|
public_external_deps = external_deps
|
2023-08-29 13:13:31 +00:00
|
|
|
part_name = ace_engine_part
|
|
|
|
subsystem_name = ace_engine_subsystem
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
group("libace") {
|
|
|
|
# fake target for asan
|
|
|
|
}
|
2023-08-08 12:59:40 +00:00
|
|
|
}
|