• 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
14if (!defined(ark_standalone_build)) {
15  ark_standalone_build = false
16}
17
18if (!ark_standalone_build) {
19  build_root = "//build"
20  ark_third_party_root = "//third_party"
21  import("$build_root/ohos.gni")
22} else {
23  ark_third_party_root = "//arkcompiler/toolchain/build/third_party_gn"
24  import("$build_root/ark.gni")
25}
26ark_root = "//arkcompiler/runtime_core"
27js_root = "//arkcompiler/ets_runtime"
28compile_llvm_online = false
29run_with_asan = false
30enable_leak_check = false
31enable_bytrace = true
32enable_hitrace = true
33enable_hilog = true
34enable_dump_in_faultlog = true
35enable_cow_array = true
36enable_coverage = false
37enable_asm_assert = false
38asan_lib_path = "/usr/lib/llvm-10/lib/clang/10.0.0/lib/linux"
39if (is_standard_system) {
40  icu_part_name = "icu"
41  icu_subsystem_name = "thirdparty"
42} else {
43  icu_part_name = "i18n"
44  icu_subsystem_name = "global"
45}
46
47# For OpenHarmony build, always link with the static lib:
48sdk_libc_secshared_dep =
49    "$ark_third_party_root/bounds_checking_function:libsec_static"
50sdk_libc_secshared_config =
51    "$ark_third_party_root/bounds_checking_function:libsec_public_config"
52
53# Generate file for a template and YAML data provided.
54#
55# Mandatory arguments:
56# data_file -- YAML data full name
57# template_file -- template full name
58# output_file -- output file full name
59# requires -- a list of scripts that provide data-querying API for templates
60# extra_dependencies -- a list of files that should be considered as dependencies, must be lable
61template("ark_gen_file") {
62  assert(defined(invoker.data_file), "data_file is required!")
63  assert(defined(invoker.template_file), "template_file is required!")
64  assert(defined(invoker.output_file), "output_file is required!")
65
66  requires = ""
67  if (defined(invoker.requires)) {
68    requires = string_join(",", rebase_path(invoker.requires, root_build_dir))
69  }
70
71  extra_dependencies = []
72  if (defined(invoker.extra_dependencies)) {
73    extra_dependencies += invoker.extra_dependencies
74  }
75
76  action("$target_name") {
77    script = "$ark_root/isa/gen.rb"
78
79    # rerun action when data file or template file update
80    inputs = [
81      invoker.template_file,
82      invoker.data_file,
83    ]
84    outputs = [ invoker.output_file ]
85    args = [
86      "--template",
87      rebase_path(invoker.template_file, root_build_dir),
88      "--data",
89      rebase_path(invoker.data_file, root_build_dir),
90      "--require",
91      requires,
92      "--output",
93      rebase_path(outputs[0]),
94    ]
95
96    deps = extra_dependencies
97  }
98}
99