• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2025 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("//build/config/components/ets_frontend/es2abc_config.gni")
15import("//build/ohos.gni")
16import("//foundation/arkui/ace_engine/ace_config.gni")
17import("//foundation/arkui/ace_engine/build/ace_gen_obj.gni")
18
19es2abc_gen_abc("gen_segmentbuttonv2_abc") {
20  src_js = rebase_path("segmentbuttonv2.js")
21  dst_file = rebase_path(target_out_dir + "/segmentbuttonv2.abc")
22  in_puts = [ "segmentbuttonv2.js" ]
23  out_puts = [ target_out_dir + "/segmentbuttonv2.abc" ]
24  extra_args = [ "--module" ]
25}
26
27gen_js_obj("segmentbuttonv2_abc") {
28  input = get_label_info(":gen_segmentbuttonv2_abc", "target_out_dir") +
29          "/segmentbuttonv2.abc"
30  output = target_out_dir + "/segmentbuttonv2_abc.o"
31  dep = ":gen_segmentbuttonv2_abc"
32}
33
34gen_obj("segmentbuttonv2_abc_preview") {
35  input = get_label_info(":gen_segmentbuttonv2_abc", "target_out_dir") +
36          "/segmentbuttonv2.abc"
37  output = target_out_dir + "/segmentbuttonv2_abc.c"
38  snapshot_dep = [ ":gen_segmentbuttonv2_abc" ]
39}
40
41template("segmentbuttonv2_static") {
42  forward_variables_from(invoker, "*")
43
44  ohos_source_set(target_name) {
45    defines += invoker.defines
46    cflags_cc += invoker.cflags_cc
47    configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
48
49    sources = [ "segmentbuttonv2.cpp" ]
50    deps =
51        [ "$ace_root/interfaces/napi/kits/utils:napi_utils_static_${platform}" ]
52    external_deps = []
53
54    if (platform != "" && is_arkui_x) {
55      deps += [ "//plugins/libs/napi:napi_$platform" ]
56      include_dirs = [ "//commonlibrary/c_utils/base/include" ]
57    } else {
58      external_deps += [ "napi:ace_napi" ]
59    }
60
61    if (defined(config.libace_target)) {
62      deps += [ config.libace_target ]
63    }
64
65    if (use_mingw_win || use_mac || use_linux) {
66      deps += [ ":gen_obj_src_segmentbuttonv2_abc_preview" ]
67    } else {
68      deps += [ ":segmentbuttonv2_abc" ]
69    }
70
71    subsystem_name = ace_engine_subsystem
72    part_name = ace_engine_part
73  }
74}
75
76foreach(item, ace_platforms) {
77  segmentbuttonv2_static("segmentbuttonv2_static_" + item.name) {
78    defines = []
79    cflags_cc = []
80    config = {
81    }
82    platform = item.name
83
84    if (defined(item.config)) {
85      config = item.config
86    }
87
88    if (defined(config.defines)) {
89      defines = config.defines
90    }
91
92    if (defined(config.cflags_cc)) {
93      cflags_cc = config.cflags_cc
94    }
95  }
96}
97