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