1# Copyright (c) 2021-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") 15import("//build/ohos.gni") 16 17config("ark_toolchain_common_config") { 18 defines = [ "PANDA_ENABLE_LTO" ] 19 cflags_cc = [ 20 "-Wall", 21 "-Wshadow", 22 "-Werror", 23 "-Wextra", 24 "-pedantic", 25 "-Wno-invalid-offsetof", 26 "-Wno-gnu-statement-expression", 27 "-pipe", 28 "-Wdate-time", 29 "-funwind-tables", 30 "-fasynchronous-unwind-tables", 31 "-Wformat=2", 32 ] 33 include_dirs = [ "//third_party/libuv/include" ] 34 if (is_linux) { 35 defines += [ 36 "PANDA_TARGET_UNIX", 37 "PANDA_TARGET_LINUX", 38 "PANDA_USE_FUTEX", 39 ] 40 } else if (is_mingw) { 41 cflags_cc += [ 42 "-std=c++17", 43 "-Wno-ignored-attributes", 44 ] 45 defines += [ 46 "PANDA_TARGET_WINDOWS", 47 "_CRTBLD", 48 "__LIBMSVCRT__", 49 ] 50 } else if (is_mac) { 51 defines += [ 52 "PANDA_TARGET_UNIX", 53 "PANDA_TARGET_MACOS", 54 ] 55 } else if (target_os == "android") { 56 defines += [ 57 "PANDA_TARGET_ANDROID", 58 "PANDA_TARGET_UNIX", 59 "PANDA_USE_FUTEX", 60 ] 61 } else if (target_os == "ios") { 62 defines += [ 63 "PANDA_TARGET_UNIX", 64 "PANDA_TARGET_IOS", 65 ] 66 } else { 67 defines += [ 68 "PANDA_TARGET_UNIX", 69 "PANDA_USE_FUTEX", 70 ] 71 if (!is_standard_system && (current_cpu != "arm" || is_wearable_product)) { 72 defines += [ "PANDA_TARGET_MOBILE" ] 73 } 74 } 75 76 if (is_debug) { 77 cflags_cc += [ 78 "-O0", 79 "-ggdb3", 80 ] 81 } else { 82 defines += [ "NDEBUG" ] 83 } 84} 85 86config("ark_toolchain_public_config") { 87 defines = [] 88 if (!is_mingw && !is_mac) { 89 defines += [ 90 "ECMASCRIPT_SUPPORT_CPUPROFILER", 91 "ECMASCRIPT_SUPPORT_HEAPPROFILER", 92 "ECMASCRIPT_SUPPORT_SNAPSHOT", 93 "ECMASCRIPT_SUPPORT_DEBUGGER", 94 ] 95 } else if (target_os == "android") { 96 defines += [ 97 "ECMASCRIPT_SUPPORT_CPUPROFILER", 98 "ECMASCRIPT_SUPPORT_DEBUGGER", 99 ] 100 } 101 102 include_dirs = [ 103 # Dependent on runtime_core include 104 "$ark_root", 105 "$js_root", 106 "$toolchain_root", 107 ] 108} 109 110# ecmascript unit testcase config 111config("toolchain_test_config") { 112 visibility = [ ":*" ] 113 114 configs = [ 115 "$toolchain_root:ark_toolchain_public_config", 116 "$toolchain_root:ark_toolchain_common_config", 117 ] 118 119 ldflags = [ "-Wl,-rpath=\$ORIGIN/" ] 120} 121 122group("ark_toolchain_packages") { 123 deps = [] 124 if (host_os != "mac") { 125 deps += [ 126 "$toolchain_root/connect_server:connectserver_debugger", 127 "//arkcompiler/toolchain/inspector:ark_debugger", 128 "//arkcompiler/toolchain/tooling:libark_ecma_debugger", 129 "//third_party/libuv:uv", 130 ] 131 } 132} 133 134group("ark_toolchain_unittest") { 135 testonly = true 136 deps = [] 137 if (host_os != "mac") { 138 deps += [ 139 "//arkcompiler/toolchain/tooling/test:unittest", 140 "//arkcompiler/toolchain/websocket/test:unittest", 141 "//third_party/libuv:uv", 142 ] 143 if (is_ohos && is_standard_system) { 144 deps += [ "//arkcompiler/toolchain/test/fuzztest:fuzztest" ] 145 } 146 } 147} 148 149group("ark_toolchain_host_unittest") { 150 testonly = true 151 deps = [] 152 if (host_os != "mac") { 153 # js unittest 154 deps += [ 155 "//arkcompiler/toolchain/tooling/test:host_unittest", 156 "//arkcompiler/toolchain/websocket/test:host_unittest", 157 ] 158 } 159} 160 161group("ark_js_host_unittest") { 162 testonly = true 163 deps = [ 164 "//arkcompiler/ets_runtime:ark_runtime_host_unittest", 165 "//arkcompiler/toolchain:ark_toolchain_host_unittest", 166 "//third_party/libuv:uv", 167 ] 168} 169