1# Copyright (c) 2023 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/ets_frontend/es2panda/es2abc_config.gni")
15import("//build/ohos.gni")
16import("//foundation/arkui/ace_engine/adapter/preview/build/config.gni")
17import("//foundation/arkui/ace_engine/build/ace_gen_obj.gni")
18import("//foundation/multimedia/av_session/config.gni")
19
20es2abc_gen_abc("gen_avpicker_abc") {
21  if (use_mingw_win || use_mac || use_linux) {
22    src_js = rebase_path("avpicker_mock.js")
23    dst_file = rebase_path(target_out_dir + "/avpicker.abc")
24    in_puts = [ "avpicker_mock.js" ]
25    out_puts = [ target_out_dir + "/avpicker.abc" ]
26    extra_args = [ "--module" ]
27  } else {
28    src_js = rebase_path("avpicker.js")
29    dst_file = rebase_path(target_out_dir + "/avpicker.abc")
30    in_puts = [ "avpicker.js" ]
31    out_puts = [ target_out_dir + "/avpicker.abc" ]
32    extra_args = [ "--module" ]
33  }
34}
35
36gen_js_obj("avpicker_abc") {
37  input =
38      get_label_info(":gen_avpicker_abc", "target_out_dir") + "/avpicker.abc"
39  output = target_out_dir + "/avpicker_abc.o"
40  dep = ":gen_avpicker_abc"
41}
42
43gen_obj("avpicker_abc_preview") {
44  input =
45      get_label_info(":gen_avpicker_abc", "target_out_dir") + "/avpicker.abc"
46  output = target_out_dir + "/avpicker_abc.c"
47  snapshot_dep = [ ":gen_avpicker_abc" ]
48}
49
50ohos_shared_library("avcastpicker") {
51  sources = [ "avpicker.cpp" ]
52
53  sanitize = {
54    cfi = true
55    cfi_cross_dso = true
56    debug = false
57  }
58
59  if (use_mingw_win || use_mac || use_linux) {
60    deps = [ ":gen_obj_src_avpicker_abc_preview" ]
61  } else {
62    deps = [ ":avpicker_abc" ]
63  }
64  defines = []
65  if (use_mingw_win) {
66    defines += [ "WINDOWS_PLATFORM" ]
67  } else if (use_mac) {
68    defines += [ "MAC_PLATFORM" ]
69  } else if (use_linux) {
70    defines += [ "LINUX_PLATFORM" ]
71  }
72
73  external_deps = [ "napi:ace_napi" ]
74
75  relative_install_dir = "module/multimedia"
76  subsystem_name = "multimedia"
77  part_name = "av_session"
78}
79
80##################################################################
81
82es2abc_gen_abc("gen_avpickerparam_abc") {
83  if (use_mingw_win || use_mac || use_linux) {
84    src_js = rebase_path("avpickerparam_mock.js")
85    dst_file = rebase_path(target_out_dir + "/avpickerparam.abc")
86    in_puts = [ "avpickerparam_mock.js" ]
87    out_puts = [ target_out_dir + "/avpickerparam.abc" ]
88    extra_args = [ "--module" ]
89  } else {
90    src_js = rebase_path("avpickerparam.js")
91    dst_file = rebase_path(target_out_dir + "/avpickerparam.abc")
92    in_puts = [ "avpickerparam.js" ]
93    out_puts = [ target_out_dir + "/avpickerparam.abc" ]
94    extra_args = [ "--module" ]
95  }
96}
97
98gen_js_obj("avpickerparam_abc") {
99  input = get_label_info(":gen_avpickerparam_abc", "target_out_dir") +
100          "/avpickerparam.abc"
101  output = target_out_dir + "/avpickerparam_abc.o"
102  dep = ":gen_avpickerparam_abc"
103}
104
105gen_obj("avpickerparam_abc_preview") {
106  input = get_label_info(":gen_avpickerparam_abc", "target_out_dir") +
107          "/avpickerparam.abc"
108  output = target_out_dir + "/avpickerparam_abc.c"
109  snapshot_dep = [ ":gen_avpickerparam_abc" ]
110}
111
112ohos_shared_library("avcastpickerparam") {
113  sources = [ "avpickerparam.cpp" ]
114
115  stack_protector_ret = true
116  sanitize = {
117    cfi = true
118    cfi_cross_dso = true
119    debug = false
120  }
121
122  if (use_mingw_win || use_mac || use_linux) {
123    deps = [ ":gen_obj_src_avpickerparam_abc_preview" ]
124  } else {
125    deps = [ ":avpickerparam_abc" ]
126  }
127  defines = []
128  if (use_mingw_win) {
129    defines += [ "WINDOWS_PLATFORM" ]
130  } else if (use_mac) {
131    defines += [ "MAC_PLATFORM" ]
132  } else if (use_linux) {
133    defines += [ "LINUX_PLATFORM" ]
134  }
135
136  external_deps = [ "napi:ace_napi" ]
137
138  relative_install_dir = "module/multimedia"
139  subsystem_name = "multimedia"
140  part_name = "av_session"
141}
142