• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/runtime_core/ark_config.gni")
15
16jsoncpp_root = "$ark_third_party_root/jsoncpp"
17
18config("ts2abc_config") {
19  visibility = [ ":*" ]
20  include_dirs = [
21    ".",
22    "$jsoncpp_root/include",
23    "$ark_root/libpandabase",
24  ]
25
26  if (enable_bytecode_optimizer) {
27    defines = [ "ENABLE_BYTECODE_OPT" ]
28  }
29
30  configs = [
31    "$ark_root:ark_config",
32    sdk_libc_secshared_config,
33    "$ark_root/libpandafile:arkfile_public_config",
34    "$ark_root/libpandabase:arkbase_public_config",
35    "$ark_root/runtime:arkruntime_public_config",
36    "$ark_root/assembler:arkassembler_public_config",
37    "//arkcompiler/ets_frontend/merge_abc:panda_assembly_proto_public_config",
38  ]
39
40  if (enable_bytecode_optimizer) {
41    configs += [
42      "$ark_root/compiler:arkcompiler_public_config",
43      "$ark_root/bytecode_optimizer:bytecodeopt_public_config",
44    ]
45  }
46}
47
48config("flag_config") {
49  cflags_cc = [ "-fexceptions" ]
50}
51
52source_set("jsoncpp_set_static") {
53  sources = [
54    "//third_party/jsoncpp/src/lib_json/json_reader.cpp",
55    "//third_party/jsoncpp/src/lib_json/json_value.cpp",
56    "//third_party/jsoncpp/src/lib_json/json_writer.cpp",
57  ]
58  public_configs = [ "$jsoncpp_root:jsoncpp_config" ]
59  public_configs += [ ":flag_config" ]
60  include_dirs = [
61    "$jsoncpp_root/include",
62    "$jsoncpp_root/include/json/",
63  ]
64}
65
66if (!ark_standalone_build) {
67  ohos_static_library("jsoncpp_static") {
68    deps = [ ":jsoncpp_set_static" ]
69    use_exceptions = true
70    part_name = "ets_frontend"
71    subsystem_name = "arkcompiler"
72  }
73
74  ohos_executable("ts2abc") {
75    sources = [
76      "main.cpp",
77      "ts2abc.cpp",
78    ]
79
80    configs = [ ":ts2abc_config" ]
81
82    cflags = [
83      "-Wno-c++20-designator",
84      "-Wno-c99-extensions",
85      "-Wno-unknown-warning-option",
86    ]
87
88    deps = [
89      "//arkcompiler/ets_frontend/merge_abc:panda_assembly_proto_static",
90      sdk_libc_secshared_dep,
91    ]
92
93    if (is_linux || is_mingw || is_mac) {
94      deps += [
95        "$ark_root/assembler:libarkassembler_frontend_static",
96        "$ark_root/libpandabase:libarkbase_frontend_static",
97        "$ark_root/libpandafile:libarkfile_frontend_static",
98        "$ark_root/libziparchive:libarkziparchive_frontend_static",
99        "//third_party/jsoncpp:jsoncpp_static",
100      ]
101      if (enable_bytecode_optimizer) {
102        deps += [
103          "$ark_root/bytecode_optimizer:libarkbytecodeopt_frontend_static",
104          "$ark_root/compiler:libarkcompiler_frontend_static",
105        ]
106      }
107    } else {
108      deps += [
109        "$ark_root/assembler:libarkassembler",
110        "$ark_root/libpandabase:libarkbase",
111        "$ark_root/libpandafile:libarkfile",
112        "$ark_root/libziparchive:libarkziparchive",
113        "$jsoncpp_root:jsoncpp",
114      ]
115      if (enable_bytecode_optimizer) {
116        deps += [
117          "$ark_root/bytecode_optimizer:libarkbytecodeopt",
118          "$ark_root/compiler:libarkcompiler",
119        ]
120      }
121    }
122
123    if (is_linux) {
124      if (build_public_version) {
125        ldflags = [ "-static-libstdc++" ]
126      } else {
127        libs = [ libcpp_static_lib ]
128      }
129    }
130
131    output_name = "js2abc"
132    install_enable = false
133    part_name = "ets_frontend"
134    subsystem_name = "arkcompiler"
135  }
136}
137