123b3eb3cSopenharmony_ci# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
223b3eb3cSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
323b3eb3cSopenharmony_ci# you may not use this file except in compliance with the License.
423b3eb3cSopenharmony_ci# You may obtain a copy of the License at
523b3eb3cSopenharmony_ci#
623b3eb3cSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
723b3eb3cSopenharmony_ci#
823b3eb3cSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
923b3eb3cSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1023b3eb3cSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1123b3eb3cSopenharmony_ci# See the License for the specific language governing permissions and
1223b3eb3cSopenharmony_ci# limitations under the License.
1323b3eb3cSopenharmony_ci
1423b3eb3cSopenharmony_ciimport("//build/ohos.gni")
1523b3eb3cSopenharmony_ciimport("//foundation/arkui/ace_engine/ace_config.gni")
1623b3eb3cSopenharmony_ci
1723b3eb3cSopenharmony_citemplate("ace_base_source_set") {
1823b3eb3cSopenharmony_ci  forward_variables_from(invoker, "*")
1923b3eb3cSopenharmony_ci
2023b3eb3cSopenharmony_ci  ohos_source_set(target_name) {
2123b3eb3cSopenharmony_ci    if (current_os == "ohos") {
2223b3eb3cSopenharmony_ci      sanitize = {
2323b3eb3cSopenharmony_ci        integer_overflow = true
2423b3eb3cSopenharmony_ci        boundary_sanitize = true
2523b3eb3cSopenharmony_ci        debug = ace_sanitize_debug
2623b3eb3cSopenharmony_ci      }
2723b3eb3cSopenharmony_ci    }
2823b3eb3cSopenharmony_ci    subsystem_name = ace_engine_subsystem
2923b3eb3cSopenharmony_ci    part_name = ace_engine_part
3023b3eb3cSopenharmony_ci    defines += invoker.defines
3123b3eb3cSopenharmony_ci    deps = [
3223b3eb3cSopenharmony_ci      "base64:ace_base_base64_$platform",
3323b3eb3cSopenharmony_ci      "i18n:ace_base_i18n_$platform",
3423b3eb3cSopenharmony_ci      "resource:ace_resource",
3523b3eb3cSopenharmony_ci    ]
3623b3eb3cSopenharmony_ci    external_deps = []
3723b3eb3cSopenharmony_ci    include_dirs = []
3823b3eb3cSopenharmony_ci    if (use_hilog) {
3923b3eb3cSopenharmony_ci      external_deps += [ "hilog:libhilog" ]
4023b3eb3cSopenharmony_ci    }
4123b3eb3cSopenharmony_ci    configs = [ "$ace_root:ace_config" ]
4223b3eb3cSopenharmony_ci
4323b3eb3cSopenharmony_ci    # add base source file here
4423b3eb3cSopenharmony_ci    sources = [
4523b3eb3cSopenharmony_ci      "geometry/animatable_dimension.cpp",
4623b3eb3cSopenharmony_ci      "geometry/animatable_matrix4.cpp",
4723b3eb3cSopenharmony_ci      "geometry/dimension.cpp",
4823b3eb3cSopenharmony_ci      "geometry/least_square_impl.cpp",
4923b3eb3cSopenharmony_ci      "geometry/matrix3.cpp",
5023b3eb3cSopenharmony_ci      "geometry/matrix4.cpp",
5123b3eb3cSopenharmony_ci      "geometry/quaternion.cpp",
5223b3eb3cSopenharmony_ci      "geometry/transform_util.cpp",
5323b3eb3cSopenharmony_ci      "image/pixel_map.cpp",
5423b3eb3cSopenharmony_ci      "json/json_util.cpp",
5523b3eb3cSopenharmony_ci      "json/node_object.cpp",
5623b3eb3cSopenharmony_ci      "json/uobject.cpp",
5723b3eb3cSopenharmony_ci      "log/ace_performance_check.cpp",
5823b3eb3cSopenharmony_ci      "log/ace_performance_monitor.cpp",
5923b3eb3cSopenharmony_ci      "log/ace_scoring_log.cpp",
6023b3eb3cSopenharmony_ci      "log/ace_trace.cpp",
6123b3eb3cSopenharmony_ci      "log/ace_tracker.cpp",
6223b3eb3cSopenharmony_ci      "log/dump_log.cpp",
6323b3eb3cSopenharmony_ci      "log/jank_frame_report.cpp",
6423b3eb3cSopenharmony_ci      "memory/memory_monitor.cpp",
6523b3eb3cSopenharmony_ci      "perfmonitor/perf_monitor.cpp",
6623b3eb3cSopenharmony_ci      "ressched/ressched_report.cpp",
6723b3eb3cSopenharmony_ci      "subwindow/subwindow_manager.cpp",
6823b3eb3cSopenharmony_ci      "thread/background_task_executor.cpp",
6923b3eb3cSopenharmony_ci      "utils/base_id.cpp",
7023b3eb3cSopenharmony_ci      "utils/date_util.cpp",
7123b3eb3cSopenharmony_ci      "utils/measure_util.cpp",
7223b3eb3cSopenharmony_ci      "utils/resource_configuration.cpp",
7323b3eb3cSopenharmony_ci      "utils/string_expression.cpp",
7423b3eb3cSopenharmony_ci      "utils/string_utils.cpp",
7523b3eb3cSopenharmony_ci      "utils/time_util.cpp",
7623b3eb3cSopenharmony_ci      "utils/utf.cpp",
7723b3eb3cSopenharmony_ci      "utils/utils.cpp",
7823b3eb3cSopenharmony_ci    ]
7923b3eb3cSopenharmony_ci
8023b3eb3cSopenharmony_ci    if (platform != "windows") {
8123b3eb3cSopenharmony_ci      # add secure c API
8223b3eb3cSopenharmony_ci      if (is_arkui_x) {
8323b3eb3cSopenharmony_ci        deps += [ "//third_party/bounds_checking_function:libsec_static" ]
8423b3eb3cSopenharmony_ci      }
8523b3eb3cSopenharmony_ci    } else {
8623b3eb3cSopenharmony_ci      defines -= [ "UNICODE" ]
8723b3eb3cSopenharmony_ci      libs = [ "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/x86_64-w64-mingw32/lib/libshlwapi.a" ]
8823b3eb3cSopenharmony_ci    }
8923b3eb3cSopenharmony_ci
9023b3eb3cSopenharmony_ci    if (is_arkui_x) {
9123b3eb3cSopenharmony_ci      deps += [
9223b3eb3cSopenharmony_ci        "${ace_graphic}/rosen/modules/render_service_client:librender_service_client_static",
9323b3eb3cSopenharmony_ci        "${ace_root}/interfaces/inner_api/drawable_descriptor:native_drawabledescriptor_static",
9423b3eb3cSopenharmony_ci      ]
9523b3eb3cSopenharmony_ci    } else {
9623b3eb3cSopenharmony_ci      external_deps += [ "graphic_2d:librender_service_client" ]
9723b3eb3cSopenharmony_ci    }
9823b3eb3cSopenharmony_ci
9923b3eb3cSopenharmony_ci    if (is_arkui_x) {
10023b3eb3cSopenharmony_ci      deps += [ "//third_party/cJSON:cjson_static" ]
10123b3eb3cSopenharmony_ci    } else {
10223b3eb3cSopenharmony_ci      external_deps += [ "cJSON:cjson" ]
10323b3eb3cSopenharmony_ci    }
10423b3eb3cSopenharmony_ci
10523b3eb3cSopenharmony_ci    cflags_cc = []
10623b3eb3cSopenharmony_ci    cflags_cc += invoker.cflags_cc
10723b3eb3cSopenharmony_ci  }
10823b3eb3cSopenharmony_ci}
10923b3eb3cSopenharmony_ci
11023b3eb3cSopenharmony_ciforeach(item, ace_platforms) {
11123b3eb3cSopenharmony_ci  ace_base_source_set("ace_base_" + item.name) {
11223b3eb3cSopenharmony_ci    platform = item.name
11323b3eb3cSopenharmony_ci    defines = []
11423b3eb3cSopenharmony_ci    cflags_cc = []
11523b3eb3cSopenharmony_ci    config = {
11623b3eb3cSopenharmony_ci    }
11723b3eb3cSopenharmony_ci
11823b3eb3cSopenharmony_ci    if (defined(item.config)) {
11923b3eb3cSopenharmony_ci      config = item.config
12023b3eb3cSopenharmony_ci    }
12123b3eb3cSopenharmony_ci
12223b3eb3cSopenharmony_ci    if (defined(config.defines)) {
12323b3eb3cSopenharmony_ci      defines = config.defines
12423b3eb3cSopenharmony_ci    }
12523b3eb3cSopenharmony_ci
12623b3eb3cSopenharmony_ci    if (defined(config.cflags_cc)) {
12723b3eb3cSopenharmony_ci      cflags_cc = config.cflags_cc
12823b3eb3cSopenharmony_ci    }
12923b3eb3cSopenharmony_ci  }
13023b3eb3cSopenharmony_ci
13123b3eb3cSopenharmony_ci  ohos_source_set("ace_memory_monitor_" + item.name) {
13223b3eb3cSopenharmony_ci    platform = item.name
13323b3eb3cSopenharmony_ci    subsystem_name = ace_engine_subsystem
13423b3eb3cSopenharmony_ci    part_name = ace_engine_part
13523b3eb3cSopenharmony_ci    defines = []
13623b3eb3cSopenharmony_ci    cflags_cc = []
13723b3eb3cSopenharmony_ci    config = {
13823b3eb3cSopenharmony_ci    }
13923b3eb3cSopenharmony_ci
14023b3eb3cSopenharmony_ci    if (defined(item.config)) {
14123b3eb3cSopenharmony_ci      config = item.config
14223b3eb3cSopenharmony_ci    }
14323b3eb3cSopenharmony_ci
14423b3eb3cSopenharmony_ci    if (defined(config.defines)) {
14523b3eb3cSopenharmony_ci      defines = config.defines
14623b3eb3cSopenharmony_ci    }
14723b3eb3cSopenharmony_ci
14823b3eb3cSopenharmony_ci    if (defined(config.cflags_cc)) {
14923b3eb3cSopenharmony_ci      cflags_cc = config.cflags_cc
15023b3eb3cSopenharmony_ci    }
15123b3eb3cSopenharmony_ci
15223b3eb3cSopenharmony_ci    configs = [ "$ace_root:ace_config" ]
15323b3eb3cSopenharmony_ci
15423b3eb3cSopenharmony_ci    sources = [
15523b3eb3cSopenharmony_ci      "$ace_root/frameworks/base/log/dump_log.cpp",
15623b3eb3cSopenharmony_ci      "$ace_root/frameworks/base/memory/memory_monitor.cpp",
15723b3eb3cSopenharmony_ci    ]
15823b3eb3cSopenharmony_ci
15923b3eb3cSopenharmony_ci    if (platform == "windows" || platform == "mac" || platform == "linux") {
16023b3eb3cSopenharmony_ci      sources += [
16123b3eb3cSopenharmony_ci        "$ace_root/adapter/preview/osal/event_report.cpp",
16223b3eb3cSopenharmony_ci        "$ace_root/adapter/preview/osal/system_properties.cpp",
16323b3eb3cSopenharmony_ci      ]
16423b3eb3cSopenharmony_ci    } else {
16523b3eb3cSopenharmony_ci      sources += [ "$ace_root/adapter/$platform/osal/system_properties.cpp" ]
16623b3eb3cSopenharmony_ci    }
16723b3eb3cSopenharmony_ci
16823b3eb3cSopenharmony_ci    if (platform == "ohos") {
16923b3eb3cSopenharmony_ci      external_deps = [
17023b3eb3cSopenharmony_ci        "ability_runtime:abilitykit_native",
17123b3eb3cSopenharmony_ci        "hilog:libhilog",
17223b3eb3cSopenharmony_ci        "i18n:intl_util",
17323b3eb3cSopenharmony_ci        "init:libbeget_proxy",
17423b3eb3cSopenharmony_ci        "init:libbegetutil",
17523b3eb3cSopenharmony_ci        "napi:ace_napi",
17623b3eb3cSopenharmony_ci        "window_manager:libdm",
17723b3eb3cSopenharmony_ci      ]
17823b3eb3cSopenharmony_ci
17923b3eb3cSopenharmony_ci      if (defined(config.hichecker_exists) && config.hichecker_exists) {
18023b3eb3cSopenharmony_ci        external_deps += [ "hichecker:libhichecker" ]
18123b3eb3cSopenharmony_ci      }
18223b3eb3cSopenharmony_ci    }
18323b3eb3cSopenharmony_ci  }
18423b3eb3cSopenharmony_ci}
185