# Copyright (c) 2021-2022 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("//arkcompiler/runtime_core/ark_config.gni") import("../../ets_frontend_config.gni") jsoncpp_root = "$ark_third_party_root/jsoncpp" config("ts2abc_config") { visibility = [ ":*" ] include_dirs = [ ".", "//third_party/jsoncpp/include", "$ark_root/libpandabase", ] if (enable_bytecode_optimizer) { defines = [ "ENABLE_BYTECODE_OPT" ] } configs = [ "$ark_root:ark_config", sdk_libc_secshared_config, "$ark_root/libpandafile:arkfile_public_config", "$ark_root/libpandabase:arkbase_public_config", "$ark_root/assembler:arkassembler_public_config", "//arkcompiler/ets_frontend/merge_abc:panda_assembly_proto_public_config", ] if (enable_bytecode_optimizer) { configs += [ "$ark_root/compiler:arkcompiler_public_config", "$ark_root/bytecode_optimizer:bytecodeopt_public_config", ] } } config("flag_config") { cflags_cc = [ "-fexceptions" ] } source_set("jsoncpp_set_static") { sources = [ "//third_party/jsoncpp/src/lib_json/json_reader.cpp", "//third_party/jsoncpp/src/lib_json/json_value.cpp", "//third_party/jsoncpp/src/lib_json/json_writer.cpp", ] public_configs = [ "$jsoncpp_root:jsoncpp_config" ] public_configs += [ ":flag_config" ] include_dirs = [ "//third_party/jsoncpp/include", "//third_party/jsoncpp/include/json/", ] } ohos_static_library("jsoncpp_static") { deps = [ ":jsoncpp_set_static" ] use_exceptions = true part_name = "ets_frontend" subsystem_name = "arkcompiler" } ohos_executable("ts2abc") { sources = [ "main.cpp", "ts2abc.cpp", ] configs = [ ":ts2abc_config" ] cflags = [ "-Wno-c++20-designator", "-Wno-c99-extensions", "-Wno-unknown-warning-option", ] deps = [ "//arkcompiler/ets_frontend/merge_abc:panda_assembly_proto_static", sdk_libc_secshared_dep, ] external_deps = [] if (is_linux || is_mingw || is_mac) { deps += [ "$ark_third_party_root/jsoncpp:jsoncpp_static" ] if (!is_arkui_x) { external_deps += [ "runtime_core:libarkassembler_frontend_static", "runtime_core:libarkbase_frontend_static", "runtime_core:libarkfile_frontend_static", "runtime_core:libarkziparchive_frontend_static", ] if (enable_bytecode_optimizer) { external_deps += [ "runtime_core:libarkbytecodeopt_frontend_static", "runtime_core:libarkcompiler_frontend_static", ] } } else { deps += [ "$ark_root/assembler:libarkassembler_frontend_static", "$ark_root/libpandabase:libarkbase_frontend_static", "$ark_root/libpandafile:libarkfile_frontend_static", "$ark_root/libziparchive:libarkziparchive_frontend_static", ] if (enable_bytecode_optimizer) { deps += [ "$ark_root/bytecode_optimizer:libarkbytecodeopt_frontend_static", "$ark_root/compiler:libarkcompiler_frontend_static", ] } } } else { deps += [ "$ark_root/assembler:libarkassembler", "$ark_root/libpandabase:libarkbase", "$ark_root/libpandafile:libarkfile", "$ark_root/libziparchive:libarkziparchive", "$jsoncpp_root:jsoncpp", ] if (enable_bytecode_optimizer) { deps += [ "$ark_root/bytecode_optimizer:libarkbytecodeopt", "$ark_root/compiler:libarkcompiler", ] } } if (is_linux) { if (build_public_version) { ldflags = [ "-static-libstdc++" ] } else { libs = [ libcpp_static_lib ] } } output_name = "js2abc" install_enable = false part_name = "ets_frontend" subsystem_name = "arkcompiler" }