1# Copyright (c) 2022-2024 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 17ispreview = false 18if (is_mingw || is_mac || is_linux) { 19 ispreview = true 20} 21if (!ispreview) { 22 group("previewer_window") { 23 } 24 25 group("previewer_window_napi") { 26 } 27} else { 28 if (current_os == "mac") { 29 suffix = ".dylib" 30 } else if (current_os == "linux") { 31 suffix = ".so" 32 } else if (current_os == "mingw") { 33 suffix = ".dll" 34 } 35 36 config("previewer_window_config") { 37 visibility = [ "*:*" ] 38 visibility += [ 39 "${graphic_base_path}/graphic_2d/rosen/modules/platform/image_native", 40 "${graphic_base_path}/graphic_2d/rosen/modules/platform/ipc_core", 41 "${graphic_base_path}/graphic_2d/rosen/modules/platform/utils", 42 ] 43 44 include_dirs = [ 45 "include", 46 "../utils/include", 47 "${graphic_base_path}/graphic_2d/rosen/modules/platform/utils", 48 "${graphic_base_path}/graphic_2d/rosen/modules/platform/ipc_core", 49 "${graphic_base_path}/graphic_2d/rosen/modules/platform/image_native", 50 "${window_base_path}/interfaces/innerkits/wm", 51 ] 52 } 53 54 ohos_shared_library("previewer_window") { 55 libs = [] 56 57 public_configs = [ 58 ":previewer_window_config", 59 "${ability_runtime_path}/frameworks/simulator/common:ability_simulator_common_config", 60 ] 61 sources = [ 62 "../utils/src/window_transition_info.cpp", 63 "../utils/src/wm_math.cpp", 64 "src/vsync_station.cpp", 65 "src/window.cpp", 66 "src/window_display.cpp", 67 "src/window_impl.cpp", 68 "src/window_model.cpp", 69 "src/window_option.cpp", 70 "src/window_scene.cpp", 71 ] 72 73 include_dirs = [ 74 "include", 75 "${arkui_path}/ace_engine/adapter/preview/external/multimodalinput", 76 "${arkui_path}/ace_engine/", 77 "mock", 78 "../utils/include", 79 "${ide_previewer_external_path}", 80 ] 81 public_deps = [ 82 "${graphic_base_path}/graphic_2d/rosen/modules/platform:ipc_core", 83 "${graphic_base_path}/graphic_2d/rosen/modules/platform:utils", 84 ] 85 86 external_deps = [ 87 "ace_engine:ace_uicontent", 88 "graphic_2d:librender_service_client", 89 "hilog:libhilog", 90 ] 91 92 cflags = [ "-std=c++11" ] 93 part_name = "window_manager" 94 subsystem_name = "window" 95 } 96 97 config("previewer_window_napi_config") { 98 visibility = [ ":*" ] 99 100 include_dirs = [ 101 "../interfaces/kits/napi/window_runtime/window_napi", 102 "../interfaces/kits/napi/window_runtime/window_stage_napi", 103 ] 104 } 105 106 ohos_shared_library("previewer_window_napi") { 107 public_configs = [ ":previewer_window_napi_config" ] 108 109 libs = [] 110 111 sources = [ 112 "${ability_runtime_path}/frameworks/simulator/ability_simulator/src/js_runtime_utils.cpp", 113 "../interfaces/kits/napi/window_runtime/window_napi/js_window.cpp", 114 "../interfaces/kits/napi/window_runtime/window_napi/js_window_utils.cpp", 115 "../interfaces/kits/napi/window_runtime/window_stage_napi/js_window_stage.cpp", 116 117 # mock 118 "mock/js_transition_controller.cpp", 119 "mock/js_window_listener.cpp", 120 "mock/js_window_register_manager.cpp", 121 "mock/permission.cpp", 122 "mock/pixel_map_napi.cpp", 123 "mock/window_manager_napi/js_window_manager.cpp", 124 "mock/window_manager_napi/window_manager_module.cpp", 125 ] 126 127 include_dirs = [ 128 ".", 129 "include", 130 "../utils/include", 131 "mock", 132 "${ability_runtime_path}/interfaces/inner_api/runtime/include", 133 ] 134 135 deps = [ 136 ":previewer_window", 137 "${graphic_base_path}/graphic_2d/rosen/modules/platform:eventhandler", 138 "${graphic_base_path}/graphic_2d/rosen/modules/platform:utils", 139 ] 140 141 external_deps = [ 142 "ace_engine:ace_uicontent", 143 "hilog:libhilog", 144 "napi:ace_napi", 145 ] 146 147 cflags_cc = [ "-DWINDOW_PREVIEW" ] 148 cflags = [ "-std=c++11" ] 149 150 part_name = "window_manager" 151 subsystem_name = "window" 152 } 153 154 ohos_copy("window_stage_copy_modules") { 155 deps = [] 156 sources = [] 157 napi_modules = [ "window_stage_modules:windowstage" ] 158 159 foreach(module, napi_modules) { 160 deps += [ module ] 161 out_path = get_label_info(module, "root_out_dir") 162 out_name = get_label_info(module, "name") 163 sources += [ out_path + "/window/window_manager/lib" + out_name + suffix ] 164 } 165 166 target_path = get_label_info(":copy_previewer_library", "target_out_dir") 167 168 outputs = 169 [ target_path + 170 "/previewer/common/bin/module/application/{{source_file_part}}" ] 171 part_name = "window_manager" 172 subsystem_name = "window" 173 } 174 ohos_copy("copy_previewer_library") { 175 shared_library_path = get_label_info(":previewer_window", "root_out_dir") 176 sources = [ shared_library_path + 177 "/window/window_manager/libpreviewer_window" + suffix ] 178 deps = [ ":previewer_window" ] 179 180 if (current_os == "mingw" || current_os == "mac") { 181 deps += [ ":window_stage_copy_modules" ] 182 shared_library_path = 183 get_label_info(":previewer_window_napi", "root_out_dir") 184 sources += [ shared_library_path + 185 "/window/window_manager/libpreviewer_window_napi" + suffix ] 186 deps += [ ":previewer_window_napi" ] 187 } 188 189 outputs = [ target_out_dir + "/previewer/common/bin/{{source_file_part}}" ] 190 module_source_dir = target_out_dir + "/previewer/common/bin/" 191 module_install_name = "" 192 193 part_name = "window_manager" 194 subsystem_name = "window" 195 } 196} 197