1e9297d28Sopenharmony_ci# Copyright (C) 2023 Huawei Device Co., Ltd.
2e9297d28Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3e9297d28Sopenharmony_ci# you may not use this file except in compliance with the License.
4e9297d28Sopenharmony_ci# You may obtain a copy of the License at
5e9297d28Sopenharmony_ci#
6e9297d28Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7e9297d28Sopenharmony_ci#
8e9297d28Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9e9297d28Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10e9297d28Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11e9297d28Sopenharmony_ci# See the License for the specific language governing permissions and
12e9297d28Sopenharmony_ci# limitations under the License.
13e9297d28Sopenharmony_ci
14e9297d28Sopenharmony_ciimport("//build/ohos.gni")
15e9297d28Sopenharmony_ciimport("//foundation/graphic/graphic_2d/graphic_config.gni")
16e9297d28Sopenharmony_ci
17e9297d28Sopenharmony_ciconfig("libhyper_graphic_manager_config") {
18e9297d28Sopenharmony_ci  visibility = [ ":*" ]
19e9297d28Sopenharmony_ci
20e9297d28Sopenharmony_ci  include_dirs = [
21e9297d28Sopenharmony_ci    "core/config",
22e9297d28Sopenharmony_ci    "core/frame_rate_manager",
23e9297d28Sopenharmony_ci    "core/hgm_screen_manager",
24e9297d28Sopenharmony_ci    "core/utils",
25e9297d28Sopenharmony_ci    "$graphic_2d_root/rosen/modules/composer/hdi_backend/include",
26e9297d28Sopenharmony_ci    "$graphic_2d_root/rosen/modules/platform/ipc_core",
27e9297d28Sopenharmony_ci    "$graphic_2d_root/rosen/modules/render_service/core",
28e9297d28Sopenharmony_ci    "$graphic_2d_root/rosen/modules/render_service_base/include",
29e9297d28Sopenharmony_ci    "$graphic_2d_root/rosen/modules/composer/vsync/include",
30e9297d28Sopenharmony_ci    "$graphic_2d_root/utils/log",
31e9297d28Sopenharmony_ci    "$graphic_2d_root/interfaces/inner_api/composer",
32e9297d28Sopenharmony_ci    "$graphic_2d_root/interfaces/inner_api/common",
33e9297d28Sopenharmony_ci    "$graphic_2d_root/rosen/modules/render_frame_trace/include",
34e9297d28Sopenharmony_ci    "$graphic_2d_root/utils/log",
35e9297d28Sopenharmony_ci    "$graphic_2d_root/utils/sandbox",
36e9297d28Sopenharmony_ci  ]
37e9297d28Sopenharmony_ci
38e9297d28Sopenharmony_ci  cflags = [ "-g3" ]
39e9297d28Sopenharmony_ci  if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64")) {
40e9297d28Sopenharmony_ci    if (!use_libfuzzer) {
41e9297d28Sopenharmony_ci      cflags += [ "-flto=thin" ]
42e9297d28Sopenharmony_ci    }
43e9297d28Sopenharmony_ci  }
44e9297d28Sopenharmony_ci}
45e9297d28Sopenharmony_ci
46e9297d28Sopenharmony_ciohos_shared_library("libhyper_graphic_manager") {
47e9297d28Sopenharmony_ci  branch_protector_ret = "pac_ret"
48e9297d28Sopenharmony_ci  sanitize = {
49e9297d28Sopenharmony_ci    cfi = true
50e9297d28Sopenharmony_ci    cfi_cross_dso = true
51e9297d28Sopenharmony_ci    cfi_vcall_icall_only = true
52e9297d28Sopenharmony_ci    debug = false
53e9297d28Sopenharmony_ci  }
54e9297d28Sopenharmony_ci  public_configs = [ ":libhyper_graphic_manager_config" ]
55e9297d28Sopenharmony_ci
56e9297d28Sopenharmony_ci  sources = [
57e9297d28Sopenharmony_ci    "core/config/hgm_config_callback_manager.cpp",
58e9297d28Sopenharmony_ci    "core/config/xml_parser.cpp",
59e9297d28Sopenharmony_ci    "core/frame_rate_manager/hgm_energy_consumption_policy.cpp",
60e9297d28Sopenharmony_ci    "core/frame_rate_manager/hgm_frame_rate_manager.cpp",
61e9297d28Sopenharmony_ci    "core/frame_rate_manager/hgm_idle_detector.cpp",
62e9297d28Sopenharmony_ci    "core/frame_rate_manager/hgm_multi_app_strategy.cpp",
63e9297d28Sopenharmony_ci    "core/frame_rate_manager/hgm_task_handle_thread.cpp",
64e9297d28Sopenharmony_ci    "core/frame_rate_manager/hgm_touch_manager.cpp",
65e9297d28Sopenharmony_ci    "core/frame_rate_manager/hgm_vsync_generator_controller.cpp",
66e9297d28Sopenharmony_ci    "core/hgm_screen_manager/hgm_core.cpp",
67e9297d28Sopenharmony_ci    "core/hgm_screen_manager/hgm_screen.cpp",
68e9297d28Sopenharmony_ci    "core/hgm_screen_manager/hgm_screen_info.cpp",
69e9297d28Sopenharmony_ci    "core/utils/hgm_one_shot_timer.cpp",
70e9297d28Sopenharmony_ci    "frame_rate_vote/rs_frame_rate_vote.cpp",
71e9297d28Sopenharmony_ci    "frame_rate_vote/rs_video_frame_rate_vote.cpp",
72e9297d28Sopenharmony_ci  ]
73e9297d28Sopenharmony_ci  if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64")) {
74e9297d28Sopenharmony_ci    cflags = []
75e9297d28Sopenharmony_ci    if (!use_libfuzzer) {
76e9297d28Sopenharmony_ci      cflags += [ "-flto=thin" ]
77e9297d28Sopenharmony_ci    }
78e9297d28Sopenharmony_ci    if (enhanced_opt) {
79e9297d28Sopenharmony_ci      if (!use_libfuzzer) {
80e9297d28Sopenharmony_ci        cflags += [ "-fwhole-program-vtables" ]
81e9297d28Sopenharmony_ci      }
82e9297d28Sopenharmony_ci    }
83e9297d28Sopenharmony_ci  }
84e9297d28Sopenharmony_ci
85e9297d28Sopenharmony_ci  deps = [
86e9297d28Sopenharmony_ci    "$graphic_2d_root/rosen/modules/composer:libcomposer",
87e9297d28Sopenharmony_ci    "$graphic_2d_root/rosen/modules/render_frame_trace:render_frame_trace",
88e9297d28Sopenharmony_ci    "$graphic_2d_root/rosen/modules/render_service_base:librender_service_base",
89e9297d28Sopenharmony_ci  ]
90e9297d28Sopenharmony_ci
91e9297d28Sopenharmony_ci  external_deps = [
92e9297d28Sopenharmony_ci    "c_utils:utils",
93e9297d28Sopenharmony_ci    "config_policy:configpolicy_util",
94e9297d28Sopenharmony_ci    "eventhandler:libeventhandler",
95e9297d28Sopenharmony_ci    "ffrt:libffrt",
96e9297d28Sopenharmony_ci    "hicollie:libhicollie",
97e9297d28Sopenharmony_ci    "hisysevent:libhisysevent",
98e9297d28Sopenharmony_ci    "hitrace:hitrace_meter",
99e9297d28Sopenharmony_ci    "init:libbeget_proxy",
100e9297d28Sopenharmony_ci    "init:libbegetutil",
101e9297d28Sopenharmony_ci    "ipc:ipc_core",
102e9297d28Sopenharmony_ci    "libxml2:libxml2",
103e9297d28Sopenharmony_ci  ]
104e9297d28Sopenharmony_ci
105e9297d28Sopenharmony_ci  if (defined(graphic_2d_hgm_configs.vendor_root)) {
106e9297d28Sopenharmony_ci    sources += graphic_2d_hgm_configs.libhyper_graphic_manager_ext_sources
107e9297d28Sopenharmony_ci    sources -= graphic_2d_hgm_configs.libhyper_graphic_manager_ext_sources_del
108e9297d28Sopenharmony_ci  }
109e9297d28Sopenharmony_ci
110e9297d28Sopenharmony_ci  part_name = "graphic_2d"
111e9297d28Sopenharmony_ci  subsystem_name = "graphic"
112e9297d28Sopenharmony_ci
113e9297d28Sopenharmony_ci  if (is_standard_system) {
114e9297d28Sopenharmony_ci    external_deps += [ "hilog:libhilog" ]
115e9297d28Sopenharmony_ci  } else {
116e9297d28Sopenharmony_ci    external_deps += [ "hilog:libhilog" ]
117e9297d28Sopenharmony_ci  }
118e9297d28Sopenharmony_ci}
119