• 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
17ohos_source_set("util_lite") {
18  sources = [
19    "CallbackQueue.cpp",
20    "CommandParser.cpp",
21    "CppTimer.cpp",
22    "CppTimerManager.cpp",
23    "EndianUtil.cpp",
24    "FileSystem.cpp",
25    "Interrupter.cpp",
26    "JsonReader.cpp",
27    "ModelManager.cpp",
28    "PreviewerEngineLog.cpp",
29    "PublicMethods.cpp",
30    "SharedDataManager.cpp",
31    "TimeTool.cpp",
32    "TraceTool.cpp",
33    "WebSocketServer.cpp",
34  ]
35  cflags = [ "-std=c++17" ]
36  if (platform == "mingw_x86_64") {
37    sources += [
38      "windows/CrashHandler.cpp",
39      "windows/LocalDate.cpp",
40      "windows/LocalSocket.cpp",
41      "windows/NativeFileSystem.cpp",
42    ]
43  } else if (platform == "mac_arm64" || platform == "mac_x64") {
44    sources += [
45      "unix/CrashHandler.cpp",
46      "unix/LocalDate.cpp",
47      "unix/LocalSocket.cpp",
48      "unix/NativeFileSystem.cpp",
49    ]
50  } else if (platform == "linux_x64" || platform == "linux_arm64") {
51    sources += [
52      "unix/CrashHandler.cpp",
53      "unix/LocalDate.cpp",
54      "unix/LocalSocket.cpp",
55      "unix/NativeFileSystem.cpp",
56    ]
57  }
58
59  include_dirs = [
60    ".",
61    "../cli/",
62    "../mock/lite/",
63    "//third_party/bounds_checking_function/include/",
64    "//third_party/cJSON/",
65  ]
66
67  deps = [
68    "//third_party/cJSON:cjson_static",
69    "//third_party/libwebsockets:websockets_static",
70  ]
71  part_name = "previewer"
72  subsystem_name = "ide"
73}
74
75ohos_source_set("util_rich") {
76  libs = []
77  sources = [
78    "CallbackQueue.cpp",
79    "CppTimer.cpp",
80    "CppTimerManager.cpp",
81    "EndianUtil.cpp",
82    "Interrupter.cpp",
83    "ModelManager.cpp",
84    "PreviewerEngineLog.cpp",
85    "PublicMethods.cpp",
86    "SharedDataManager.cpp",
87    "TimeTool.cpp",
88    "WebSocketServer.cpp",
89  ]
90  cflags = [ "-std=c++17" ]
91  if (platform == "mingw_x86_64") {
92    sources += [
93      "windows/CrashHandler.cpp",
94      "windows/LocalSocket.cpp",
95    ]
96  } else {
97    sources += [
98      "unix/CrashHandler.cpp",
99      "unix/LocalSocket.cpp",
100    ]
101  }
102
103  include_dirs = [
104    ".",
105    "../cli/",
106    "../mock/rich/",
107    "//third_party/bounds_checking_function/include/",
108  ]
109
110  deps = [
111    ":ide_util",
112    "//third_party/libwebsockets:websockets_static",
113  ]
114  part_name = "previewer"
115  subsystem_name = "ide"
116}
117
118ohos_shared_library("ide_util") {
119  if (is_linux || is_mac || is_mingw) {
120    libs = []
121    sources = [
122      "CommandParser.cpp",
123      "FileSystem.cpp",
124      "JsonReader.cpp",
125      "PreviewerEngineLog.cpp",
126      "TimeTool.cpp",
127      "TraceTool.cpp",
128    ]
129    cflags = [ "-std=c++17" ]
130    cflags_cc = cflags
131    if (platform == "mingw_x86_64") {
132      sources += [
133        "windows/ClipboardHelper.cpp",
134        "windows/KeyboardHelper.cpp",
135        "windows/LocalDate.cpp",
136        "windows/LocalSocket.cpp",
137        "windows/NativeFileSystem.cpp",
138        "windows/StringHelper.cpp",
139      ]
140      if (defined(enable_component_test) && enable_component_test) {
141        defines = [ "COMPONENT_TEST_ENABLED" ]
142      }
143    } else if (platform == "mac_arm64" || platform == "mac_x64") {
144      cflags += [ "-DNS_FORMAT_ARGUMENT(A)=" ]
145      sources += [
146        "unix/ClipboardHelper.cpp",
147        "unix/ClipboardObjc.mm",
148        "unix/KeyboardHelper.cpp",
149        "unix/KeyboardObjc.mm",
150        "unix/LocalDate.cpp",
151        "unix/LocalSocket.cpp",
152        "unix/NativeFileSystem.cpp",
153      ]
154      if (defined(enable_gn_2021)) {
155        frameworks = [
156          "Cocoa.framework",
157          "Carbon.framework",
158        ]
159      } else {
160        libs = [
161          "Cocoa.framework",
162          "Carbon.framework",
163        ]
164      }
165    } else if (platform == "linux_x64" || platform == "linux_arm64") {
166      sources += [
167        "linux/ClipboardHelper.cpp",
168        "linux/ClipboardX11.cpp",
169        "linux/KeyboardHelper.cpp",
170        "unix/LocalDate.cpp",
171        "unix/LocalSocket.cpp",
172        "unix/NativeFileSystem.cpp",
173      ]
174      libs += [ "X11" ]
175    }
176
177    include_dirs = [
178      ".",
179      "//third_party/bounds_checking_function/include/",
180      "//third_party/cJSON/",
181    ]
182
183    deps = [
184      "//third_party/bounds_checking_function:libsec_shared",
185      "//third_party/cJSON:cjson",
186    ]
187  }
188  part_name = "previewer"
189  subsystem_name = "ide"
190}
191