• 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/ohos.gni")
15import("//foundation/graphic/graphic_2d/frameworks/text/config.gni")
16import("//foundation/graphic/graphic_2d/graphic_config.gni")
17
18group("cj_drawing") {
19  deps = [
20    ":cj_drawing_ffi",
21    ":cj_drawing_impl",
22  ]
23}
24
25config("drawing_config") {
26  include_dirs = [ "../drawing" ]
27}
28
29config("local_drawing_config") {
30  visibility = [ ":*" ]
31
32  include_dirs = [
33    "../drawing",
34    "$graphic_2d_root/frameworks/text/adapter/skia",
35    "$graphic_2d_root/rosen/modules/2d_graphics/include",
36    "$graphic_2d_root/rosen/modules/2d_graphics/src",
37    "$graphic_2d_root/rosen/modules/2d_graphics/src/drawing/engine_adapter",
38    "$graphic_2d_root/rosen/modules/render_service_base/include",
39  ]
40}
41
42ohos_shared_library("cj_drawing_ffi") {
43  sanitize = {
44    cfi = true
45    cfi_cross_dso = true
46    cfi_vcall_icall_only = true
47    debug = false
48  }
49  sources = [ "cj_drawing_ffi.cpp" ]
50
51  configs = [
52    ":drawing_config",
53    ":local_drawing_config",
54  ]
55
56  deps = [ ":cj_drawing_impl" ]
57
58  external_deps = [
59    "hilog:libhilog",
60    "napi:cj_bind_ffi",
61    "napi:cj_bind_native",
62    "skia:skia_canvaskit",
63  ]
64
65  innerapi_tags = [ "platformsdk" ]
66  subsystem_name = "graphic"
67  part_name = "graphic_2d"
68}
69
70ohos_shared_library("cj_drawing_impl") {
71  sources = [
72    "cj_drawing_util.cpp",
73    "matrix_impl/cj_matrix.cpp",
74  ]
75  defines = []
76  configs = [ ":local_drawing_config" ]
77  public_configs = [ ":drawing_config" ]
78
79  deps = [
80    "$graphic_2d_root/rosen/modules/2d_graphics:2d_graphics",
81    "$graphic_2d_root/rosen/modules/render_service_base:librender_service_base",
82  ]
83
84  external_deps = [
85    "napi:cj_bind_ffi",
86    "napi:cj_bind_native",
87  ]
88
89  if (current_os == "ohos" || current_os == "ohos_ng") {
90    sanitize = {
91      boundary_sanitize = true
92      integer_overflow = true
93      ubsan = true
94      cfi = true
95      cfi_cross_dso = true
96      cfi_vcall_icall_only = true
97      debug = false
98    }
99    external_deps += [ "hilog:libhilog" ]
100    deps += [ "$graphic_2d_root/utils:libgraphic_utils" ]
101    defines += [ "ROSEN_OHOS" ]
102    cflags_cc = [ "-std=c++17" ]
103  } else {
104    defines += [ "MODULE_DRAWING" ]
105    cflags_cc = [ "-std=c++17" ]
106  }
107
108  if (current_os == "mingw") {
109    defines += [ "WINDOWS_PLATFORM" ]
110  }
111
112  innerapi_tags = [ "platformsdk" ]
113  subsystem_name = "graphic"
114  part_name = "graphic_2d"
115}
116