1# Copyright (C) 2022-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("//build/ohos.gni")
15import("//foundation/multimedia/image_framework/ide/image_decode_config.gni")
16
17config("ffi_image_native_config") {
18  include_dirs = [ "include" ]
19  cflags_cc = [ "-std=c++17" ]
20}
21
22ohos_shared_library("cj_image_ffi") {
23  public_configs = [ ":ffi_image_native_config" ]
24
25  include_dirs = [
26    "$image_subsystem/interfaces/innerkits/include",
27    "$image_subsystem/image_framework/frameworks/innerkitsimpl/utils/include",
28  ]
29
30  if (!use_clang_android && !use_clang_ios) {
31    sanitize = {
32      cfi = true
33      cfi_cross_dso = true
34      cfi_vcall_icall_only = true
35      debug = false
36    }
37  }
38
39  cflags = [
40    "-DIMAGE_DEBUG_FLAG",
41    "-DIMAGE_COLORSPACE_FLAG",
42  ]
43
44  if (!defined(defines)) {
45    defines = []
46  }
47
48  if (!ohos_indep_compiler_enable && !build_ohos_sdk &&
49      product_name != "qemu-arm-linux-min" &&
50      product_name != "rk3568_mini_system") {
51    deps = [
52      "$image_subsystem/frameworks/innerkitsimpl/pixelconverter:pixelconvertadapter",
53      "$image_subsystem/frameworks/innerkitsimpl/utils:image_utils",
54      "$image_subsystem/interfaces/innerkits:image_native",
55    ]
56    external_deps = [
57      "c_utils:utils",
58      "graphic_2d:cj_color_manager_ffi",
59      "hilog:libhilog",
60      "hitrace:hitrace_meter",
61      "ipc:ipc_napi",
62      "napi:ace_napi",
63      "napi:cj_bind_ffi",
64      "napi:cj_bind_native",
65    ]
66    sources = [
67      "src/image_creator_impl.cpp",
68      "src/image_ffi.cpp",
69      "src/image_impl.cpp",
70      "src/image_packer_impl.cpp",
71      "src/image_receiver_impl.cpp",
72      "src/image_source_impl.cpp",
73      "src/pixel_map_impl.cpp",
74    ]
75  } else {
76    defines += [ "PREVIEWER" ]
77    sources = [ "src/cj_image_mock.cpp" ]
78  }
79
80  if (is_ohos) {
81    defines += [ "OHOS_PLATFORM" ]
82  }
83
84  if (is_mingw) {
85    defines += [ "WINDOWS_PLATFORM" ]
86  }
87
88  innerapi_tags = [ "platformsdk" ]
89
90  subsystem_name = "multimedia"
91  part_name = "image_framework"
92}
93