1# Copyright (c) 2021 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/ohos.gni") 15import("//foundation/graphic/graphic_2d/graphic_config.gni") 16 17## Build libvsync.so 18 19config("vsync_config") { 20 visibility = [ ":*" ] 21 22 cflags = [ 23 "-Wall", 24 "-Werror", 25 "-g3", 26 ] 27 28 if (graphic_2d_feature_enable_dvsync) { 29 gpu_defines += [ "RS_ENABLE_DVSYNC_2" ] 30 } 31 32 defines = [] 33 defines += gpu_defines 34 35 if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64")) { 36 ldflags = [ "-Wl,-Bsymbolic" ] 37 } 38} 39 40config("vsync_public_config") { 41 include_dirs = [ 42 "$graphic_2d_root/interfaces/inner_api/composer", 43 "$graphic_2d_root/rosen/include/common", 44 "$graphic_2d_root/rosen/modules/composer/vsync/include", 45 "$graphic_2d_root/utils/sandbox", 46 ] 47 if (graphic_2d_feature_enable_dvsync) { 48 include_dirs += [ "$graphic_2d_ext_root/dvsync/dvsync_2/include" ] 49 } 50 if (defined(global_parts_info) && 51 defined(global_parts_info.resourceschedule_resource_schedule_service)) { 52 include_dirs += [ "$graphic_2d_root/rosen/modules/ressched/include" ] 53 } 54} 55 56ohos_shared_library("libvsync") { 57 sanitize = { 58 boundary_sanitize = true 59 integer_overflow = true 60 ubsan = true 61 } 62 sources = [ 63 "src/vsync_callback_listener.cpp", 64 "src/vsync_connection_proxy.cpp", 65 "src/vsync_connection_stub.cpp", 66 "src/vsync_controller.cpp", 67 "src/vsync_distributor.cpp", 68 "src/vsync_generator.cpp", 69 "src/vsync_receiver.cpp", 70 "src/vsync_sampler.cpp", 71 "src/vsync_system_ability_listener.cpp", 72 ] 73 74 include_dirs = [ 75 "$graphic_2d_root/utils/log", 76 "$graphic_2d_root/interfaces/inner_api/common", 77 "$graphic_2d_root/rosen/modules/composer/vsync/include", 78 "$graphic_2d_root/utils/rs_frame_report_ext/include", 79 ] 80 81 defines = [] 82 83 configs = [ ":vsync_config" ] 84 85 public_configs = [ ":vsync_public_config" ] 86 87 deps = [ 88 "$graphic_2d_root/utils:rs_frame_report_ext", 89 "$graphic_2d_root/utils:sandbox_utils", 90 ] 91 92 if (graphic_2d_feature_enable_dvsync) { 93 deps += [ "$graphic_2d_ext_root/dvsync:libdvsync" ] 94 include_dirs += [ "$graphic_2d_ext_root/dvsync/dvsync_2/include" ] 95 sources += 96 [ "$graphic_2d_ext_root/dvsync/dvsync_2/src/dvsync_controller.cpp" ] 97 } 98 99 public_deps = [ 100 "$graphic_2d_root/utils:scoped_bytrace", 101 "$graphic_2d_root/utils:socketpair", 102 ] 103 104 external_deps = [ 105 "access_token:libaccesstoken_sdk", 106 "c_utils:utils", 107 "eventhandler:libeventhandler", 108 "ffrt:libffrt", 109 "hilog:libhilog", 110 "hitrace:hitrace_meter", 111 "init:libbegetutil", 112 "ipc:ipc_core", 113 "qos_manager:qos", 114 "safwk:system_ability_fwk", 115 "samgr:samgr_proxy", 116 ] 117 public_external_deps = [ "c_utils:utils" ] 118 119 if (defined(global_parts_info) && 120 defined(global_parts_info.resourceschedule_resource_schedule_service)) { 121 external_deps += [ "resource_schedule_service:ressched_client" ] 122 defines += [ "COMPOSER_SCHED_ENABLE" ] 123 sources += [ 124 "$graphic_2d_root/rosen/modules/ressched/src/ressched_event_listener.cpp", 125 ] 126 } 127 128 part_name = "graphic_2d" 129 subsystem_name = "graphic" 130} 131 132## Build libvsync.so 133 134group("test") { 135 testonly = true 136 137 deps = [ "test:test" ] 138} 139