• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_manager_hilog.cpp",
63      "../utils/src/window_transition_info.cpp",
64      "../utils/src/wm_math.cpp",
65      "src/vsync_station.cpp",
66      "src/window.cpp",
67      "src/window_display.cpp",
68      "src/window_impl.cpp",
69      "src/window_model.cpp",
70      "src/window_option.cpp",
71      "src/window_scene.cpp",
72    ]
73
74    include_dirs = [
75      "include",
76      "${arkui_path}/ace_engine/adapter/preview/external/multimodalinput",
77      "${arkui_path}/ace_engine/",
78      "mock",
79      "../utils/include",
80      "${ide_previewer_external_path}",
81      "${window_base_path}/interfaces/kits/napi/window_animation",
82    ]
83    public_deps = [
84      "${graphic_base_path}/graphic_2d/rosen/modules/platform:ipc_core",
85      "${graphic_base_path}/graphic_2d/rosen/modules/platform:utils",
86    ]
87
88    external_deps = [
89      "ace_engine:ace_uicontent",
90      "graphic_2d:librender_service_base",
91      "graphic_2d:librender_service_client",
92      "hilog:libhilog",
93    ]
94
95    cflags = [ "-std=c++11" ]
96    cflags_cc = [ "-std=c++17" ]
97    part_name = "window_manager"
98    subsystem_name = "window"
99  }
100
101  config("previewer_window_napi_config") {
102    visibility = [ ":*" ]
103
104    include_dirs = [
105      "../interfaces/kits/napi/window_runtime/window_napi",
106      "../interfaces/kits/napi/window_runtime/window_stage_napi",
107    ]
108  }
109
110  ohos_shared_library("previewer_window_napi") {
111    public_configs = [ ":previewer_window_napi_config" ]
112
113    libs = []
114
115    sources = [
116      "${ability_runtime_path}/frameworks/simulator/ability_simulator/src/js_runtime_utils.cpp",
117      "../interfaces/kits/napi/window_animation/js_window_animation_utils.cpp",
118      "../interfaces/kits/napi/window_runtime/window_napi/js_window.cpp",
119      "../interfaces/kits/napi/window_runtime/window_napi/js_window_utils.cpp",
120      "../interfaces/kits/napi/window_runtime/window_stage_napi/js_window_stage.cpp",
121      "../utils/src/window_manager_hilog.cpp",
122
123      # mock
124      "mock/js_transition_controller.cpp",
125      "mock/js_window_listener.cpp",
126      "mock/js_window_register_manager.cpp",
127      "mock/permission.cpp",
128      "mock/pixel_map_napi.cpp",
129      "mock/window_manager_napi/js_window_manager.cpp",
130      "mock/window_manager_napi/window_manager_module.cpp",
131    ]
132
133    include_dirs = [
134      ".",
135      "include",
136      "../utils/include",
137      "mock",
138      "${ability_runtime_path}/interfaces/inner_api/runtime/include",
139      "${window_base_path}/interfaces/kits/napi/window_animation",
140    ]
141
142    deps = [
143      ":previewer_window",
144      "${graphic_base_path}/graphic_2d/rosen/modules/platform:eventhandler",
145      "${graphic_base_path}/graphic_2d/rosen/modules/platform:utils",
146    ]
147
148    external_deps = [
149      "ace_engine:ace_uicontent",
150      "hilog:libhilog",
151      "napi:ace_napi",
152    ]
153
154    if (!build_ohos_sdk && !is_mingw) {
155      external_deps += [ "ability_runtime:ability_manager" ]
156    }
157
158    cflags_cc = [ "-DWINDOW_PREVIEW" ]
159    cflags = [ "-std=c++11" ]
160
161    part_name = "window_manager"
162    subsystem_name = "window"
163  }
164
165  ohos_copy("window_stage_copy_modules") {
166    deps = []
167    sources = []
168    napi_modules = [ "window_stage_modules:windowstage" ]
169
170    foreach(module, napi_modules) {
171      deps += [ module ]
172      out_path = get_label_info(module, "root_out_dir")
173      out_name = get_label_info(module, "name")
174      sources += [ out_path + "/window/window_manager/lib" + out_name + suffix ]
175    }
176
177    target_path = get_label_info(":copy_previewer_library", "target_out_dir")
178
179    outputs =
180        [ target_path +
181          "/previewer/common/bin/module/application/{{source_file_part}}" ]
182    part_name = "window_manager"
183    subsystem_name = "window"
184  }
185  ohos_copy("copy_previewer_library") {
186    shared_library_path = get_label_info(":previewer_window", "root_out_dir")
187    sources = [ shared_library_path +
188                "/window/window_manager/libpreviewer_window" + suffix ]
189    deps = [ ":previewer_window" ]
190
191    if (current_os == "mingw" || current_os == "mac") {
192      deps += [ ":window_stage_copy_modules" ]
193      shared_library_path =
194          get_label_info(":previewer_window_napi", "root_out_dir")
195      sources += [ shared_library_path +
196                   "/window/window_manager/libpreviewer_window_napi" + suffix ]
197      deps += [ ":previewer_window_napi" ]
198    }
199
200    outputs = [ target_out_dir + "/previewer/common/bin/{{source_file_part}}" ]
201    module_source_dir = target_out_dir + "/previewer/common/bin/"
202    module_install_name = ""
203
204    part_name = "window_manager"
205    subsystem_name = "window"
206  }
207}
208