• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 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("./gn/config.gni")
16
17template("previewer_executable") {
18  ohos_executable(target_name) {
19    subsystem_name = "ide"
20    part_name = invoker.part_name
21    output_name = invoker.output_name
22    sources = invoker.src
23    configs = [ ":myconfig" ]
24    include_dirs = [
25      "./util/",
26      "./cli/",
27      "./mock/",
28      "./jsapp/",
29    ]
30
31    include_dirs += invoker.includes
32    deps = [ "//third_party/bounds_checking_function:libsec_static" ]
33    deps += invoker.deps
34    libs = invoker.libs
35
36    if (platform == "mingw_x86_64") {
37      defines = [ "NOGDI" ]
38      ldflags = [
39        "-static",
40        "-lws2_32",
41        "-lshlwapi",
42        "-ldbghelp",
43      ]
44    } else {
45      defines = []
46    }
47    cflags = [
48      "-std=c++17",
49      "-Wno-deprecated-declarations",
50      "-Wno-reorder",
51      "-Wno-sign-compare",
52    ]
53  }
54}
55
56group("rich_ace_previewer") {
57  if (platform == "mingw_x86_64") {
58    deps = [ ":rich_previewer(${windows_buildtool})" ]
59  } else if (platform == "mac_arm64" || platform == "mac_x64") {
60    deps = [ ":rich_previewer(${mac_buildtool})" ]
61  } else if (platform == "linux_x64") {
62    deps = [ ":rich_previewer(${linux_buildtool})" ]
63  }
64}
65
66group("lite_ace_previewer") {
67  if (platform == "mingw_x86_64") {
68    deps = [ ":lite_previewer(${windows_buildtool})" ]
69  } else if (platform == "mac_arm64" || platform == "mac_x64") {
70    deps = [ ":lite_previewer(${mac_buildtool})" ]
71  } else if (platform == "linux_x64") {
72    deps = [ ":lite_previewer(${linux_buildtool})" ]
73  }
74}
75
76previewer_executable("rich_previewer") {
77  part_name = "previewer"
78  output_name = "Previewer"
79  src = [ "RichPreviewer.cpp" ]
80  includes = os_include_dirs
81  includes += [
82    "./mock/rich/",
83    "./jsapp/rich/",
84  ]
85  libs = []
86  deps = [
87    "cli:cli_rich",
88    "jsapp:jsapp_rich",
89    "mock:mock_rich",
90    "util:util_rich",
91    "//third_party/libwebsockets:websockets_static",
92  ]
93}
94
95previewer_executable("lite_previewer") {
96  part_name = "litePreviewer"
97  output_name = "Simulator"
98  src = [ "ThinPreviewer.cpp" ]
99  includes = [
100    "//foundation/ace/frameworks/base/utils/",
101    "./mock/lite/",
102    "./jsapp/lite/",
103    "//foundation/arkui/ui_lite/interfaces/innerkits/",
104    "//foundation/graphic/graphic_utils_lite/interfaces/kits/",
105    "//foundation/graphic/graphic_utils_lite/interfaces/innerkits/",
106    "//foundation/arkui/ui_lite/frameworks/dock/",
107  ]
108  deps = [
109    "cli:cli_lite",
110    "jsapp:jsapp_lite",
111    "mock:mock_lite",
112    "util:util_lite",
113    "//foundation/arkui/ace_engine_lite/frameworks/targets/simulator:ace_lite",
114    "//third_party/libwebsockets:websockets_static",
115  ]
116  if (platform == "mingw_x86_64") {
117    libs = [ "psapi" ]
118  } else if (platform == "mac_arm64" || platform == "mac_x64") {
119    libs = []
120  } else if (platform == "linux_x64") {
121    libs = []
122  }
123}
124
125config("myconfig") {
126  cflags = [
127    "-std=c++17",
128    "-Wno-error=implicit-fallthrough",
129  ]
130}
131
132# copy liteWearable config dir
133ohos_copy("copy_previewer_fonts_lite") {
134  sources = [
135    "//foundation/arkui/ui_lite/tools/qt/simulator/font/SourceHanSansSC-Regular.otf",
136    "//foundation/arkui/ui_lite/tools/qt/simulator/font/font.bin",
137    "//foundation/arkui/ui_lite/tools/qt/simulator/font/line_cj.brk",
138  ]
139  outputs = [ target_out_dir + "/previewer/liteWearable/config/" +
140              "/{{source_file_part}}" ]
141  module_source_dir = target_out_dir + "/previewer/liteWearable/config/"
142  module_install_name = ""
143}
144
145# copy ide dynamic lib
146ohos_copy("copy_ide_library") {
147  if (platform == "mingw_x86_64") {
148    suffix = ".dll"
149  } else if (platform == "mac_arm64" || platform == "mac_x64") {
150    suffix = ".dylib"
151  } else if (platform == "linux_x64") {
152    suffix = ".so"
153  }
154  deps = []
155  sources = []
156
157  deps += [ "util:ide_util" ]
158  out_path = get_label_info("util:ide_util", "root_out_dir")
159  sources += [ out_path + "/ide/previewer/libide_util" + suffix ]
160
161  deps += [ "jsapp/rich/external:ide_extension" ]
162  out_path = get_label_info("jsapp/rich/external:ide_extension", "root_out_dir")
163  sources += [ out_path + "/ide/previewer/libide_extension" + suffix ]
164
165  outputs = [ target_out_dir + "/previewer/common/bin/{{source_file_part}}" ]
166  module_source_dir = target_out_dir + "/previewer/common/bin/"
167  module_install_name = ""
168}
169