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 "../utils/src/js_err_utils.cpp", 117 118 # mock 119 "mock/js_transition_controller.cpp", 120 "mock/js_window_listener.cpp", 121 "mock/js_window_register_manager.cpp", 122 "mock/permission.cpp", 123 "mock/pixel_map_napi.cpp", 124 "mock/window_manager_napi/js_window_manager.cpp", 125 "mock/window_manager_napi/window_manager_module.cpp", 126 ] 127 128 include_dirs = [ 129 ".", 130 "include", 131 "../utils/include", 132 "mock", 133 "${ability_runtime_path}/interfaces/inner_api/runtime/include", 134 ] 135 136 deps = [ 137 ":previewer_window", 138 "${graphic_base_path}/graphic_2d/rosen/modules/platform:eventhandler", 139 "${graphic_base_path}/graphic_2d/rosen/modules/platform:utils", 140 ] 141 142 external_deps = [ 143 "ace_engine:ace_uicontent", 144 "hilog:libhilog", 145 "napi:ace_napi", 146 ] 147 148 cflags_cc = [ "-DWINDOW_PREVIEW" ] 149 cflags = [ "-std=c++11" ] 150 151 part_name = "window_manager" 152 subsystem_name = "window" 153 } 154 155 ohos_copy("window_stage_copy_modules") { 156 deps = [] 157 sources = [] 158 napi_modules = [ "window_stage_modules:windowstage" ] 159 160 foreach(module, napi_modules) { 161 deps += [ module ] 162 out_path = get_label_info(module, "root_out_dir") 163 out_name = get_label_info(module, "name") 164 sources += [ out_path + "/window/window_manager/lib" + out_name + suffix ] 165 } 166 167 target_path = get_label_info(":copy_previewer_library", "target_out_dir") 168 169 outputs = 170 [ target_path + 171 "/previewer/common/bin/module/application/{{source_file_part}}" ] 172 part_name = "window_manager" 173 subsystem_name = "window" 174 } 175 ohos_copy("copy_previewer_library") { 176 shared_library_path = get_label_info(":previewer_window", "root_out_dir") 177 sources = [ shared_library_path + 178 "/window/window_manager/libpreviewer_window" + suffix ] 179 deps = [ ":previewer_window" ] 180 181 if (current_os == "mingw" || current_os == "mac") { 182 deps += [ ":window_stage_copy_modules" ] 183 shared_library_path = 184 get_label_info(":previewer_window_napi", "root_out_dir") 185 sources += [ shared_library_path + 186 "/window/window_manager/libpreviewer_window_napi" + suffix ] 187 deps += [ ":previewer_window_napi" ] 188 } 189 190 outputs = [ target_out_dir + "/previewer/common/bin/{{source_file_part}}" ] 191 module_source_dir = target_out_dir + "/previewer/common/bin/" 192 module_install_name = "" 193 194 part_name = "window_manager" 195 subsystem_name = "window" 196 } 197} 198