# Copyright (c) 2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("../gn/config.gni") ohos_source_set("util_lite") { sources = [ "CallbackQueue.cpp", "CommandParser.cpp", "CppTimer.cpp", "CppTimerManager.cpp", "EndianUtil.cpp", "FileSystem.cpp", "Interrupter.cpp", "JsonReader.cpp", "ModelManager.cpp", "PreviewerEngineLog.cpp", "PublicMethods.cpp", "SharedDataManager.cpp", "TimeTool.cpp", "TraceTool.cpp", "WebSocketServer.cpp", ] cflags = [ "-std=c++17" ] if (platform == "mingw_x86_64") { sources += [ "windows/CrashHandler.cpp", "windows/LocalDate.cpp", "windows/LocalSocket.cpp", ] } else if (platform == "mac_arm64" || platform == "mac_x64") { sources += [ "unix/CrashHandler.cpp", "unix/LocalDate.cpp", "unix/LocalSocket.cpp", ] } else if (platform == "linux_x64") { sources += [ "unix/CrashHandler.cpp", "unix/LocalDate.cpp", "unix/LocalSocket.cpp", ] } include_dirs = [ ".", "../cli/", "../mock/lite/", "//third_party/jsoncpp/include/json/", "//third_party/bounds_checking_function/include/", ] deps = [ "//third_party/libwebsockets:websockets_static" ] part_name = "previewer" subsystem_name = "ide" } ohos_source_set("util_rich") { libs = [] sources = [ "CallbackQueue.cpp", "CppTimer.cpp", "CppTimerManager.cpp", "EndianUtil.cpp", "Interrupter.cpp", "ModelManager.cpp", "PreviewerEngineLog.cpp", "PublicMethods.cpp", "SharedDataManager.cpp", "TimeTool.cpp", "WebSocketServer.cpp", ] cflags = [ "-std=c++17" ] if (platform == "mingw_x86_64") { sources += [ "windows/CrashHandler.cpp", "windows/LocalSocket.cpp", ] } else { sources += [ "unix/CrashHandler.cpp", "unix/LocalSocket.cpp", ] } include_dirs = [ ".", "../cli/", "../mock/rich/", "//third_party/jsoncpp/include/json/", "//third_party/bounds_checking_function/include/", ] deps = [ ":ide_util", "//third_party/libwebsockets:websockets_static", ] part_name = "previewer" subsystem_name = "ide" } ohos_shared_library("ide_util") { if (is_linux || is_mac || is_mingw) { libs = [] sources = [ "CommandParser.cpp", "FileSystem.cpp", "JsonReader.cpp", "PreviewerEngineLog.cpp", "TimeTool.cpp", "TraceTool.cpp", ] cflags = [ "-std=c++17" ] cflags_cc = cflags if (platform == "mingw_x86_64") { sources += [ "windows/ClipboardHelper.cpp", "windows/KeyboardHelper.cpp", "windows/LocalDate.cpp", "windows/LocalSocket.cpp", "windows/StringHelper.cpp", ] } else if (platform == "mac_arm64" || platform == "mac_x64") { cflags += [ "-DNS_FORMAT_ARGUMENT(A)=" ] sources += [ "unix/ClipboardHelper.cpp", "unix/ClipboardObjc.mm", "unix/KeyboardHelper.cpp", "unix/KeyboardObjc.mm", "unix/LocalDate.cpp", "unix/LocalSocket.cpp", ] if (defined(enable_gn_2021)) { frameworks = [ "Cocoa.framework", "Carbon.framework", ] } else { libs = [ "Cocoa.framework", "Carbon.framework", ] } } else if (platform == "linux_x64") { sources += [ "linux/ClipboardHelper.cpp", "linux/ClipboardX11.cpp", "linux/KeyboardHelper.cpp", "unix/LocalDate.cpp", "unix/LocalSocket.cpp", ] libs += [ "X11" ] } include_dirs = [ ".", "//third_party/bounds_checking_function/include/", "//third_party/jsoncpp/include/json/", ] deps = [ "//third_party/bounds_checking_function:libsec_shared", "//third_party/jsoncpp:jsoncpp_static", ] } part_name = "previewer" subsystem_name = "ide" }