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