• 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("../gn/config.gni")
15static_library("util_lite") {
16  sources = [
17    "CallbackQueue.cpp",
18    "CommandParser.cpp",
19    "CppTimer.cpp",
20    "CppTimerManager.cpp",
21    "EndianUtil.cpp",
22    "FileSystem.cpp",
23    "Interrupter.cpp",
24    "JsonReader.cpp",
25    "ModelManager.cpp",
26    "PreviewerEngineLog.cpp",
27    "PublicMethods.cpp",
28    "SharedDataManager.cpp",
29    "TimeTool.cpp",
30    "TraceTool.cpp",
31    "WebSocketServer.cpp",
32  ]
33  cflags = [ "-std=c++17" ]
34  if (platform == "mingw_x86_64") {
35    sources += [
36      "windows/CrashHandler.cpp",
37      "windows/LocalDate.cpp",
38      "windows/LocalSocket.cpp",
39    ]
40  } else if (platform == "mac_arm64" || platform == "mac_x64") {
41    sources += [
42      "unix/CrashHandler.cpp",
43      "unix/LocalDate.cpp",
44      "unix/LocalSocket.cpp",
45    ]
46  } else if (platform == "linux_x64") {
47    sources += [
48      "unix/CrashHandler.cpp",
49      "unix/LocalDate.cpp",
50      "unix/LocalSocket.cpp",
51    ]
52  }
53
54  include_dirs = [
55    ".",
56    "../cli/",
57    "../mock/lite/",
58    "//third_party/jsoncpp/include/json/",
59    "//third_party/bounds_checking_function/include/"
60  ]
61  deps = [ "//third_party/libwebsockets:websockets_static" ]
62}
63
64static_library("util_rich") {
65  libs = []
66  sources = [
67    "CallbackQueue.cpp",
68    "CommandParser.cpp",
69    "CppTimer.cpp",
70    "CppTimerManager.cpp",
71    "EndianUtil.cpp",
72    "FileSystem.cpp",
73    "Interrupter.cpp",
74    "JsonReader.cpp",
75    "ModelManager.cpp",
76    "PreviewerEngineLog.cpp",
77    "PublicMethods.cpp",
78    "SharedDataManager.cpp",
79    "TimeTool.cpp",
80    "TraceTool.cpp",
81    "WebSocketServer.cpp",
82  ]
83  cflags = [ "-std=c++17" ]
84  if (platform == "mingw_x86_64") {
85    sources += [
86      "windows/CrashHandler.cpp",
87      "windows/LocalDate.cpp",
88      "windows/LocalSocket.cpp",
89      "windows/ClipboardHelper.cpp",
90      "windows/KeyboardHelper.cpp",
91      "windows/StringHelper.cpp",
92    ]
93  } else if (platform == "mac_arm64" || platform == "mac_x64") {
94    cflags += [ "-DNS_FORMAT_ARGUMENT(A)=" ]
95    sources += [
96      "unix/CrashHandler.cpp",
97      "unix/LocalDate.cpp",
98      "unix/LocalSocket.cpp",
99      "unix/ClipboardObjc.mm",
100      "unix/ClipboardHelper.cpp",
101      "unix/KeyboardObjc.mm",
102      "unix/KeyboardHelper.cpp",
103    ]
104    if (defined(enable_gn_2021)) {
105      frameworks = [
106        "Cocoa.framework",
107        "Carbon.framework",
108      ]
109    } else {
110      libs = [
111        "Cocoa.framework",
112        "Carbon.framework",
113      ]
114    }
115  } else if (platform == "linux_x64") {
116    sources += [
117      "unix/CrashHandler.cpp",
118      "unix/LocalDate.cpp",
119      "unix/LocalSocket.cpp",
120      "linux/ClipboardX11.cpp",
121      "linux/ClipboardHelper.cpp",
122      "linux/KeyboardHelper.cpp",
123    ]
124    libs += [
125      "X11"
126    ]
127  }
128
129  include_dirs = [
130    ".",
131    "../cli/",
132    "../mock/rich/",
133    "//third_party/jsoncpp/include/json/",
134    "//third_party/bounds_checking_function/include/",
135  ]
136  deps = [ "//third_party/libwebsockets:websockets_static" ]
137}
138