• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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("//arkcompiler/toolchain/toolchain.gni")
15
16config("websocket_config") {
17  cflags_cc = [
18    "-fno-complete-member-pointers",
19    "-Wno-implicit-fallthrough",
20    "-fvisibility=default",
21    "-frtti",
22  ]
23}
24
25config("websocket_platform_config") {
26  defines = []
27  if (is_ohos) {
28    defines += [
29      "OHOS_PLATFORM",
30      "UNIX_PLATFORM",
31    ]
32  } else if (is_mingw) {
33    defines += [ "WINDOWS_PLATFORM" ]
34  } else if (is_mac) {
35    defines += [
36      "MAC_PLATFORM",
37      "UNIX_PLATFORM",
38    ]
39  } else if (target_os == "android") {
40    defines += [
41      "ANDROID_PLATFORM",
42      "UNIX_PLATFORM",
43    ]
44  } else if (target_os == "ios") {
45    defines += [
46      "UNIX_PLATFORM",
47      "IOS_PLATFORM",
48    ]
49  } else {
50    defines += [ "UNIX_PLATFORM" ]
51  }
52
53  if (current_cpu == "arm") {
54    defines += [
55      "PANDA_TARGET_ARM32_ABI_SOFT=1",
56      "PANDA_TARGET_ARM32",
57      "PANDA_TARGET_32",
58    ]
59  } else if (current_cpu == "arm64") {
60    defines += [
61      "PANDA_TARGET_ARM64",
62      "PANDA_TARGET_64",
63      "PANDA_ENABLE_GLOBAL_REGISTER_VARIABLES",
64      "PANDA_USE_32_BIT_POINTER",
65    ]
66  } else if (current_cpu == "x86") {
67    defines += [ "PANDA_TARGET_X86" ]
68  } else if (current_cpu == "amd64" || current_cpu == "x64" ||
69             current_cpu == "x86_64") {
70    defines += [
71      "PANDA_TARGET_64",
72      "PANDA_TARGET_AMD64",
73      "PANDA_USE_32_BIT_POINTER",
74    ]
75  }
76}
77
78ohos_source_set("websocket") {
79  defines = []
80  deps = []
81
82  configs = [ sdk_libc_secshared_config ]
83  if (is_mingw || is_mac) {
84    cflags = [ "-std=c++17" ]
85    if (is_mingw) {
86      platform = "windows"
87    } else {
88      platform = "mac"
89    }
90    deps += [
91      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_$platform",
92    ]
93  } else if (target_os == "android") {
94    aosp_deps = [ "shared_library:liblog" ]
95  } else if (is_ohos && is_standard_system) {
96    external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
97  }
98
99  include_dirs = []
100
101  include_dirs += [
102    "$toolchain_root/inspector",
103    "//utils/native/base/include",
104  ]
105
106  sources = [ "websocket.cpp" ]
107
108  deps += [
109    "//third_party/openssl:libcrypto_shared",
110    sdk_libc_secshared_dep,
111  ]
112
113  configs += [
114    ":websocket_config",
115    ":websocket_platform_config",
116  ]
117
118  subsystem_name = "ark"
119  part_name = "toolchain"
120}
121