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