• 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")
15import("../../ets_frontend_config.gni")
16
17jsoncpp_root = "$ark_third_party_root/jsoncpp"
18
19config("ts2abc_config") {
20  visibility = [ ":*" ]
21  include_dirs = [
22    ".",
23    "//third_party/jsoncpp/include",
24    "$ark_root/libpandabase",
25  ]
26
27  if (enable_bytecode_optimizer) {
28    defines = [ "ENABLE_BYTECODE_OPT" ]
29  }
30
31  configs = [
32    "$ark_root:ark_config",
33    sdk_libc_secshared_config,
34    "$ark_root/libpandafile:arkfile_public_config",
35    "$ark_root/libpandabase:arkbase_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    "//third_party/jsoncpp/include",
62    "//third_party/jsoncpp/include/json/",
63  ]
64}
65
66ohos_static_library("jsoncpp_static") {
67  deps = [ ":jsoncpp_set_static" ]
68  use_exceptions = true
69  part_name = "ets_frontend"
70  subsystem_name = "arkcompiler"
71}
72
73ohos_executable("ts2abc") {
74  sources = [
75    "main.cpp",
76    "ts2abc.cpp",
77  ]
78
79  configs = [ ":ts2abc_config" ]
80
81  cflags = [
82    "-Wno-c++20-designator",
83    "-Wno-c99-extensions",
84    "-Wno-unknown-warning-option",
85  ]
86
87  deps = [
88    "//arkcompiler/ets_frontend/merge_abc:panda_assembly_proto_static",
89    sdk_libc_secshared_dep,
90  ]
91
92  external_deps = []
93
94  if (is_linux || is_mingw || is_mac) {
95    deps += [ "$ark_third_party_root/jsoncpp:jsoncpp_static" ]
96    if (!is_cross_platform_build) {
97      external_deps += [
98        "runtime_core:libarkassembler_frontend_static",
99        "runtime_core:libarkbase_frontend_static",
100        "runtime_core:libarkfile_frontend_static",
101        "runtime_core:libarkziparchive_frontend_static",
102      ]
103      if (enable_bytecode_optimizer) {
104        external_deps += [
105          "runtime_core:libarkbytecodeopt_frontend_static",
106          "runtime_core:libarkcompiler_frontend_static",
107        ]
108      }
109    } else {
110      deps += [
111        "$ark_root/assembler:libarkassembler_frontend_static",
112        "$ark_root/libpandabase:libarkbase_frontend_static",
113        "$ark_root/libpandafile:libarkfile_frontend_static",
114        "$ark_root/libziparchive:libarkziparchive_frontend_static",
115      ]
116      if (enable_bytecode_optimizer) {
117        deps += [
118          "$ark_root/bytecode_optimizer:libarkbytecodeopt_frontend_static",
119          "$ark_root/compiler:libarkcompiler_frontend_static",
120        ]
121      }
122    }
123  } else {
124    deps += [
125      "$ark_root/assembler:libarkassembler",
126      "$ark_root/libpandabase:libarkbase",
127      "$ark_root/libpandafile:libarkfile",
128      "$ark_root/libziparchive:libarkziparchive",
129      "$jsoncpp_root:jsoncpp",
130    ]
131    if (enable_bytecode_optimizer) {
132      deps += [
133        "$ark_root/bytecode_optimizer:libarkbytecodeopt",
134        "$ark_root/compiler:libarkcompiler",
135      ]
136    }
137  }
138
139  if (is_linux) {
140    if (build_public_version) {
141      ldflags = [ "-static-libstdc++" ]
142    } else {
143      libs = [ libcpp_static_lib ]
144    }
145  }
146
147  output_name = "js2abc"
148  install_enable = false
149  part_name = "ets_frontend"
150  subsystem_name = "arkcompiler"
151}
152