1# Copyright (c) 2021-2025 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("../windowmanager_aafwk.gni") 16 17config("libwm_private_config") { 18 visibility = [ ":*" ] 19 20 include_dirs = [ 21 "include", 22 "../wmserver/include/zidl", 23 "../window_scene/session/host/include", 24 "${dmserver_gen_path}", 25 ] 26} 27 28config("libwm_public_config") { 29 include_dirs = [ 30 "../wmserver/include", 31 "../interfaces/innerkits", 32 "../interfaces/innerkits/dm", 33 "../interfaces/innerkits/wm", 34 "../utils/include", 35 "../window_scene", 36 ] 37} 38 39## Build libwm_static.a 40ohos_static_library("libwm_static") { 41 branch_protector_ret = "pac_ret" 42 sanitize = { 43 cfi = true 44 cfi_cross_dso = true 45 cfi_vcall_icall_only = true 46 debug = false 47 integer_overflow = true 48 ubsan = true 49 boundary_sanitize = true 50 } 51 include_dirs = [ 52 "../utils/include", 53 "../window_scene/intention_event/service/anr_manager/include", 54 "../window_scene/intention_event/framework/anr_handler/include", 55 "${window_base_path}/interfaces/innerkits/dm", 56 "${window_base_path}/window_scene/intention_event/include", 57 ] 58 59 sources = [ 60 "../wmserver/src/zidl/window_manager_proxy.cpp", 61 "src/extension_window.cpp", 62 "src/extension_window_impl.cpp", 63 "src/floating_ball_controller.cpp", 64 "src/floating_ball_manager.cpp", 65 "src/floating_ball_option.cpp", 66 "src/future_callback.cpp", 67 "src/lifecycle_future_callback.cpp", 68 "src/gtx_input_event_sender.cpp", 69 "src/input_transfer_station.cpp", 70 "src/native_pip_window_listener.cpp", 71 "src/pattern_detach_callback.cpp", 72 "src/picture_in_picture_controller.cpp", 73 "src/picture_in_picture_controller_base.cpp", 74 "src/picture_in_picture_manager.cpp", 75 "src/picture_in_picture_option.cpp", 76 "src/root_scene.cpp", 77 "src/screen_scene.cpp", 78 "src/static_call.cpp", 79 "src/ui_extension/provider_data_handler.cpp", 80 "src/web_picture_in_picture_controller.cpp", 81 "src/window.cpp", 82 "src/window_accessibility_controller.cpp", 83 "src/window_adapter.cpp", 84 "src/window_agent.cpp", 85 "src/window_display_change_adapter.cpp", 86 "src/window_extension_session_impl.cpp", 87 "src/window_impl.cpp", 88 "src/window_input_channel.cpp", 89 "src/window_input_intercept.cpp", 90 "src/window_input_intercept_client.cpp", 91 "src/window_inspector.cpp", 92 "src/window_manager.cpp", 93 "src/window_manager_agent.cpp", 94 "src/window_option.cpp", 95 "src/window_prepare_terminate.cpp", 96 "src/window_scene.cpp", 97 "src/window_scene_session_impl.cpp", 98 "src/window_session_impl.cpp", 99 "src/zidl/pattern_detach_callback_proxy.cpp", 100 "src/zidl/pattern_detach_callback_stub.cpp", 101 "src/zidl/window_manager_agent_stub.cpp", 102 "src/zidl/window_stub.cpp", 103 ] 104 105 configs = [ 106 ":libwm_private_config", 107 "${window_base_path}/resources/config/build:coverage_flags", 108 ] 109 110 public_configs = [ ":libwm_public_config" ] 111 112 deps = [ 113 "${window_base_path}/dm:libdm", 114 "${window_base_path}/utils:libwmutil", 115 "${window_base_path}/utils:libwmutil_base", 116 "${window_base_path}/window_scene/common:window_scene_common", 117 "${window_base_path}/window_scene/intention_event:libintention_event", 118 "${window_base_path}/window_scene/intention_event/service:intention_event_anr_manager", 119 "${window_base_path}/window_scene/interfaces/innerkits:libwsutils", 120 "${window_base_path}/window_scene/screen_session_manager_client:screen_session_manager_client", 121 "${window_base_path}/window_scene/session:scene_session", 122 "${window_base_path}/window_scene/session_manager:session_manager", 123 ] 124 125 external_deps = [ 126 "ability_base:configuration", 127 "ability_base:want", 128 "ability_runtime:ability_context_native", 129 "ability_runtime:ability_manager", 130 "ability_runtime:app_manager", 131 "accessibility:accessibility_common", 132 "ace_engine:ace_uicontent", 133 "ace_engine:ace_xcomponent_controller", 134 "bundle_framework:appexecfwk_core", 135 "bundle_framework:libappexecfwk_common", 136 "c_utils:utils", 137 "eventhandler:libeventhandler", 138 "graphic_2d:librender_service_client", 139 "graphic_2d:window_animation", 140 "hilog:libhilog", 141 "hisysevent:libhisysevent", 142 "hitrace:hitrace_meter", 143 "image_framework:image_native", 144 "init:libbegetutil", 145 "input:libmmi-client", 146 "ipc:ipc_single", 147 "napi:ace_napi", 148 "samgr:samgr_proxy", 149 ] 150 151 defines = [] 152 153 if (defined(global_parts_info) && 154 defined(global_parts_info.barrierfree_accessibility)) { 155 external_deps += [ "accessibility:accessibility_common" ] 156 } 157 158 defines += [ "FRAME_TRACE_ENABLE" ] 159 external_deps += [ "frame_aware_sched:frame_trace_intf" ] 160 161 if (defined(global_parts_info) && 162 defined(global_parts_info.resourceschedule_resource_schedule_service)) { 163 external_deps += [ "resource_schedule_service:ressched_client" ] 164 defines += [ "RESOURCE_SCHEDULE_SERVICE_ENABLE" ] 165 } 166 167 if (defined(global_parts_info) && 168 defined(global_parts_info.powermgr_power_manager)) { 169 external_deps += [ "power_manager:powermgr_client" ] 170 defines += [ "POWER_MANAGER_ENABLE" ] 171 } 172 173 if (!defined(global_parts_info) || 174 defined(global_parts_info.inputmethod_imf)) { 175 imf_enable = true 176 } else { 177 imf_enable = false 178 } 179 print("imf_enable: ", imf_enable) 180 181 if (imf_enable == true) { 182 external_deps += [ "imf:inputmethod_client" ] 183 defines += [ "IMF_ENABLE" ] 184 } 185 186 part_name = "window_manager" 187 subsystem_name = "window" 188} 189 190## Build libwm.so 191ohos_shared_library("libwm") { 192 branch_protector_ret = "pac_ret" 193 sanitize = { 194 cfi = true 195 cfi_cross_dso = true 196 cfi_vcall_icall_only = true 197 debug = false 198 } 199 include_dirs = [ 200 "../utils/include", 201 "../window_scene/intention_event/service/anr_manager/include", 202 "../window_scene/intention_event/framework/anr_handler/include", 203 "${window_base_path}/interfaces/innerkits/dm", 204 "${window_base_path}/window_scene/intention_event/include", 205 ] 206 207 sources = [ 208 "../wmserver/src/zidl/window_manager_proxy.cpp", 209 "src/extension_window.cpp", 210 "src/extension_window_impl.cpp", 211 "src/floating_ball_controller.cpp", 212 "src/floating_ball_manager.cpp", 213 "src/floating_ball_option.cpp", 214 "src/future_callback.cpp", 215 "src/lifecycle_future_callback.cpp", 216 "src/gtx_input_event_sender.cpp", 217 "src/input_transfer_station.cpp", 218 "src/native_pip_window_listener.cpp", 219 "src/pattern_detach_callback.cpp", 220 "src/picture_in_picture_controller.cpp", 221 "src/picture_in_picture_controller_base.cpp", 222 "src/picture_in_picture_manager.cpp", 223 "src/picture_in_picture_option.cpp", 224 "src/root_scene.cpp", 225 "src/screen_scene.cpp", 226 "src/static_call.cpp", 227 "src/ui_extension/provider_data_handler.cpp", 228 "src/web_picture_in_picture_controller.cpp", 229 "src/window.cpp", 230 "src/window_accessibility_controller.cpp", 231 "src/window_adapter.cpp", 232 "src/window_agent.cpp", 233 "src/window_display_change_adapter.cpp", 234 "src/window_extension_session_impl.cpp", 235 "src/window_impl.cpp", 236 "src/window_input_channel.cpp", 237 "src/window_input_intercept.cpp", 238 "src/window_input_intercept_client.cpp", 239 "src/window_inspector.cpp", 240 "src/window_manager.cpp", 241 "src/window_manager_agent.cpp", 242 "src/window_option.cpp", 243 "src/window_prepare_terminate.cpp", 244 "src/window_scene.cpp", 245 "src/window_scene_session_impl.cpp", 246 "src/window_session_impl.cpp", 247 "src/zidl/pattern_detach_callback_proxy.cpp", 248 "src/zidl/pattern_detach_callback_stub.cpp", 249 "src/zidl/window_manager_agent_stub.cpp", 250 "src/zidl/window_stub.cpp", 251 ] 252 253 configs = [ 254 ":libwm_private_config", 255 "../resources/config/build:coverage_flags", 256 ] 257 258 public_configs = [ ":libwm_public_config" ] 259 260 deps = [ 261 "${window_base_path}/utils:libwmutil", 262 "${window_base_path}/utils:libwmutil_base", 263 "${window_base_path}/window_scene/common:window_scene_common", 264 "${window_base_path}/window_scene/intention_event:libintention_event", 265 "${window_base_path}/window_scene/intention_event/service:intention_event_anr_manager", 266 "${window_base_path}/window_scene/interfaces/innerkits:libwsutils", 267 "${window_base_path}/window_scene/screen_session_manager_client:screen_session_manager_client", 268 "${window_base_path}/window_scene/session:scene_session", 269 "${window_base_path}/window_scene/session_manager:session_manager", 270 "../dm:libdm", 271 ] 272 273 external_deps = [ 274 "ability_base:configuration", 275 "ability_base:want", 276 "ability_runtime:ability_context_native", 277 "ability_runtime:ability_manager", 278 "ability_runtime:app_context", 279 "ability_runtime:app_manager", 280 "ability_runtime:runtime", 281 "accessibility:accessibility_common", 282 "ace_engine:ace_uicontent", 283 "ace_engine:ace_xcomponent_controller", 284 "bundle_framework:appexecfwk_core", 285 "bundle_framework:libappexecfwk_common", 286 "c_utils:utils", 287 "eventhandler:libeventhandler", 288 "graphic_2d:librender_service_base", 289 "graphic_2d:librender_service_client", 290 "graphic_2d:window_animation", 291 "hilog:libhilog", 292 "hisysevent:libhisysevent", 293 "hitrace:hitrace_meter", 294 "image_framework:image_native", 295 "init:libbegetutil", 296 "input:libmmi-client", 297 "ipc:ipc_single", 298 "napi:ace_napi", 299 "samgr:samgr_proxy", 300 ] 301 302 defines = [] 303 304 if (defined(global_parts_info) && 305 defined(global_parts_info.barrierfree_accessibility)) { 306 external_deps += [ "accessibility:accessibility_common" ] 307 } 308 309 defines += [ "FRAME_TRACE_ENABLE" ] 310 external_deps += [ "frame_aware_sched:frame_trace_intf" ] 311 312 if (defined(global_parts_info) && 313 defined(global_parts_info.resourceschedule_resource_schedule_service)) { 314 external_deps += [ "resource_schedule_service:ressched_client" ] 315 defines += [ "RESOURCE_SCHEDULE_SERVICE_ENABLE" ] 316 } 317 318 if (!defined(global_parts_info) || 319 defined(global_parts_info.inputmethod_imf)) { 320 imf_enable = true 321 } else { 322 imf_enable = false 323 } 324 325 if (defined(global_parts_info) && 326 defined(global_parts_info.powermgr_power_manager)) { 327 external_deps += [ "power_manager:powermgr_client" ] 328 defines += [ "POWER_MANAGER_ENABLE" ] 329 } 330 print("imf_enable: ", imf_enable) 331 332 if (imf_enable == true) { 333 external_deps += [ "imf:inputmethod_client" ] 334 defines += [ "IMF_ENABLE" ] 335 } 336 337 part_name = "window_manager" 338 subsystem_name = "window" 339 340 if (build_variant == "user") { 341 defines += [ "IS_RELEASE_VERSION" ] 342 } 343} 344 345## Build libwm_lite.so 346ohos_shared_library("libwm_lite") { 347 defines = [ "USE_ADAPTER_LITE" ] 348 include_dirs = [ 349 "../interfaces/innerkits/wm", 350 "../utils/include", 351 ] 352 sources = [ 353 "../utils/src/window_visibility_info.cpp", 354 "src/window_adapter_lite.cpp", 355 "src/window_manager_agent_lite.cpp", 356 "src/window_manager_lite.cpp", 357 "src/window_option.cpp", 358 "src/zidl/window_manager_agent_stub.cpp", 359 ] 360 361 configs = [ 362 ":libwm_private_config", 363 "../resources/config/build:coverage_flags", 364 ] 365 366 deps = [ 367 "${window_base_path}/utils:libwmutil_base", 368 "${window_base_path}/window_scene/interfaces/innerkits:libwsutils", 369 "${window_base_path}/window_scene/session_manager:session_manager_lite", 370 ] 371 372 public_configs = [ ":libwm_public_config" ] 373 374 external_deps = [ 375 "ability_runtime:ability_manager", 376 "accessibility:accessibility_common", 377 "bundle_framework:appexecfwk_core", 378 "c_utils:utils", 379 "hilog:libhilog", 380 "image_framework:image_native", 381 "init:libbegetutil", 382 "input:libmmi-client", 383 "ipc:ipc_single", 384 "samgr:samgr_proxy", 385 ] 386 387 defines += [ "FRAME_TRACE_ENABLE" ] 388 external_deps += [ "frame_aware_sched:frame_trace_intf" ] 389 390 if (defined(global_parts_info) && 391 defined(global_parts_info.resourceschedule_resource_schedule_service)) { 392 external_deps += [ "resource_schedule_service:ressched_client" ] 393 defines += [ "RESOURCE_SCHEDULE_SERVICE_ENABLE" ] 394 } 395 396 if (!defined(global_parts_info) || 397 defined(global_parts_info.inputmethod_imf)) { 398 imf_enable = true 399 } else { 400 imf_enable = false 401 } 402 403 if (defined(global_parts_info) && 404 defined(global_parts_info.powermgr_power_manager)) { 405 external_deps += [ "power_manager:powermgr_client" ] 406 defines += [ "POWER_MANAGER_ENABLE" ] 407 } 408 print("imf_enable: ", imf_enable) 409 410 if (imf_enable == true) { 411 external_deps += [ "imf:inputmethod_client" ] 412 defines += [ "IMF_ENABLE" ] 413 } 414 415 part_name = "window_manager" 416 subsystem_name = "window" 417 418 if (build_variant == "user") { 419 defines += [ "IS_RELEASE_VERSION" ] 420 } 421} 422 423group("test") { 424 testonly = true 425 deps = [ "test:test" ] 426} 427 428## Build libwm_ndk.so 429ohos_shared_library("libwm_ndk") { 430 output_name = "libnative_window_manager" 431 output_extension = "so" 432 branch_protector_ret = "pac_ret" 433 434 sanitize = { 435 cfi = true 436 cfi_cross_dso = true 437 cfi_vcall_icall_only = true 438 debug = false 439 } 440 441 include_dirs = [ 442 "${window_base_path}/interfaces/kits/ndk/wm", 443 "${window_base_path}/interfaces/inner_kits/wm", 444 ] 445 446 sources = [ 447 "src/oh_window.cpp", 448 "src/oh_window_event_filter.cpp", 449 "src/oh_window_pip.cpp", 450 ] 451 452 deps = [ 453 ":libwm", 454 "${window_base_path}/utils:libwmutil_base", 455 "${window_base_path}/wm:libpip_web", 456 ] 457 458 innerapi_tags = [ "ndk" ] 459 460 external_deps = [ 461 "ability_base:configuration", 462 "ability_base:want", 463 "ability_runtime:ability_context_native", 464 "ability_runtime:ability_manager", 465 "ability_runtime:app_manager", 466 "ace_engine:ace_uicontent", 467 "ace_engine:ace_xcomponent_controller", 468 "c_utils:utils", 469 "eventhandler:libeventhandler", 470 "graphic_2d:color_manager", 471 "graphic_2d:librender_service_client", 472 "hilog:libhilog", 473 "image_framework:pixelmap", 474 "input:libmmi-client", 475 "input:oh_input_manager", 476 "ipc:ipc_core", 477 ] 478 479 part_name = "window_manager" 480 subsystem_name = "window" 481} 482 483config("libpip_web_public_config") { 484 include_dirs = [ 485 "//foundation/window/window_manager/interfaces/innerkits/wm", 486 "//foundation/window/window_manager/wm/include", 487 ] 488} 489 490config("libpip_web_private_config") { 491 visibility = [ ":*" ] 492 493 include_dirs = [ 494 "//foundation/window/window_manager/interfaces/innerkits/wm", 495 "//foundation/window/window_manager/wm/include", 496 ] 497} 498 499## Build libpip_web.so 500ohos_shared_library("libpip_web") { 501 branch_protector_ret = "pac_ret" 502 sanitize = { 503 cfi = true 504 cfi_cross_dso = true 505 cfi_vcall_icall_only = true 506 debug = false 507 } 508 install_enable = true 509 sources = [ "src/web_picture_in_picture_controller_interface.cpp" ] 510 511 configs = [ 512 ":libpip_web_private_config", 513 "../resources/config/build:coverage_flags", 514 ] 515 516 public_configs = [ ":libpip_web_public_config" ] 517 518 deps = [ 519 "${window_base_path}/dm:libdm", 520 "${window_base_path}/utils:libwmutil", 521 "${window_base_path}/utils:libwmutil_base", 522 "${window_base_path}/window_scene/common:window_scene_common", 523 "${window_base_path}/window_scene/intention_event:libintention_event", 524 "${window_base_path}/window_scene/intention_event/service:intention_event_anr_manager", 525 "${window_base_path}/window_scene/interfaces/innerkits:libwsutils", 526 "${window_base_path}/window_scene/session:scene_session", 527 "${window_base_path}/window_scene/session_manager:session_manager", 528 "${window_base_path}/wm:libwm", 529 ] 530 531 external_deps = [ 532 "ability_base:configuration", 533 "ability_base:want", 534 "ability_runtime:ability_context_native", 535 "ability_runtime:ability_manager", 536 "ability_runtime:app_context", 537 "ability_runtime:app_manager", 538 "accessibility:accessibility_common", 539 "ace_engine:ace_uicontent", 540 "ace_engine:ace_xcomponent_controller", 541 "bundle_framework:appexecfwk_core", 542 "bundle_framework:libappexecfwk_common", 543 "c_utils:utils", 544 "eventhandler:libeventhandler", 545 "graphic_2d:librender_service_base", 546 "graphic_2d:librender_service_client", 547 "graphic_2d:window_animation", 548 "hilog:libhilog", 549 "hisysevent:libhisysevent", 550 "hitrace:hitrace_meter", 551 "image_framework:image_native", 552 "init:libbegetutil", 553 "input:libmmi-client", 554 "ipc:ipc_single", 555 "napi:ace_napi", 556 "samgr:samgr_proxy", 557 ] 558 559 innerapi_tags = [ "platformsdk_indirect" ] 560 part_name = "window_manager" 561 subsystem_name = "window" 562 563 defines = [] 564 if (build_variant == "user") { 565 defines += [ "IS_RELEASE_VERSION" ] 566 } 567} 568 569config("libpip_ndk_public_config") { 570 include_dirs = [ "//foundation/window/window_manager/interfaces/kits/ndk/wm" ] 571} 572 573## Build libpip_ndk.so 574ohos_shared_library("libpip_ndk") { 575 output_extension = "so" 576 branch_protector_ret = "pac_ret" 577 578 sanitize = { 579 cfi = true 580 cfi_cross_dso = true 581 cfi_vcall_icall_only = true 582 debug = false 583 } 584 585 public_configs = [ ":libpip_ndk_public_config" ] 586 587 include_dirs = [ 588 "//foundation/window/window_manager", 589 "//foundation/window/window_manager/interfaces/innerkits", 590 "//foundation/window/window_manager/interfaces/inner_kits/wm", 591 "//foundation/window/window_manager/interfaces/kits/ndk/wm", 592 "//foundation/window/window_manager/wm/include", 593 ] 594 595 sources = [ "src/oh_window_pip.cpp" ] 596 597 deps = [ 598 ":libwm", 599 "${window_base_path}/utils:libwmutil_base", 600 "${window_base_path}/wm:libpip_web", 601 ] 602 603 innerapi_tags = [ "ndk" ] 604 605 external_deps = [ 606 "ability_base:configuration", 607 "ability_base:want", 608 "ability_runtime:ability_context_native", 609 "ability_runtime:ability_manager", 610 "ability_runtime:app_context", 611 "ability_runtime:app_manager", 612 "accessibility:accessibility_common", 613 "ace_engine:ace_uicontent", 614 "ace_engine:ace_xcomponent_controller", 615 "bundle_framework:appexecfwk_core", 616 "bundle_framework:libappexecfwk_common", 617 "c_utils:utils", 618 "eventhandler:libeventhandler", 619 "graphic_2d:librender_service_base", 620 "graphic_2d:librender_service_client", 621 "graphic_2d:window_animation", 622 "hilog:libhilog", 623 "hisysevent:libhisysevent", 624 "hitrace:hitrace_meter", 625 "image_framework:image_native", 626 "init:libbegetutil", 627 "input:libmmi-client", 628 "ipc:ipc_single", 629 "napi:ace_napi", 630 "samgr:samgr_proxy", 631 ] 632 633 part_name = "window_manager" 634 subsystem_name = "window" 635} 636