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
14import("//build/test.gni")
15import("//foundation/graphic/graphic_2d/graphic_config.gni")
16
17module_output_path = "graphic_2d/rosen/modules/2d_graphics/render_context"
18
19group("unittest") {
20  testonly = true
21
22  deps = [
23    ":2d_graphics_shader_cache_test",
24    ":RenderContextTest",
25  ]
26}
27
28## Build RenderContextTest
29ohos_unittest("RenderContextTest") {
30  module_out_path = module_output_path
31  sources = [ "render_context_test.cpp" ]
32  deps = [
33    ":render_context",
34    "$graphic_2d_root/rosen/modules/render_service_base:librender_service_base",
35  ]
36  if (defined(use_rosen_drawing) && use_rosen_drawing) {
37    defines = [ "USE_ROSEN_DRAWING" ]
38  }
39  include_dirs =
40      [ "$graphic_2d_root/rosen/modules/render_service_base/include" ]
41
42  external_deps = [
43    "c_utils:utils",
44    "hilog:libhilog",
45  ]
46}
47
48## Build render_context.a {{{
49config("render_context_public_config") {
50  include_dirs =
51      [ "$graphic_2d_root/rosen/modules/2d_graphics/src/render_context" ]
52
53  cflags = [
54    "-Wall",
55    "-Werror",
56    "-g3",
57    "-Dprivate=public",
58    "-Dprotected=public",
59  ]
60}
61
62ohos_static_library("render_context") {
63  visibility = [ ":*" ]
64  testonly = true
65
66  public_configs = [ ":render_context_public_config" ]
67
68  public_deps = [
69    "$graphic_2d_root/rosen/modules/render_service_base:librender_service_base",
70    "//third_party/googletest:gtest_main",
71  ]
72  subsystem_name = "graphic"
73  part_name = "graphic_2d"
74}
75
76## Build render_context.a }}}
77
78ohos_unittest("2d_graphics_shader_cache_test") {
79  module_out_path = module_output_path
80
81  sources = [
82    "cache_data_test.cpp",
83    "momory_handler_test.cpp",
84    "shader_cache_test.cpp",
85  ]
86
87  include_dirs = [
88    "$graphic_2d_root/rosen/modules/2d_engine",
89    "$graphic_2d_root/rosen/modules/2d_graphics/src/render_context",
90    "$graphic_2d_root/rosen/modules/2d_graphics/include",
91    "$graphic_2d_root/rosen/modules/render_service_base/include",
92  ]
93
94  include_dirs += [ "//third_party/skia/" ]
95
96  deps = [
97    "$graphic_2d_root/rosen/modules/2d_graphics:2d_graphics",
98    "$graphic_2d_root/rosen/modules/render_service_base:librender_service_base",
99    "//third_party/googletest:gtest_main",
100  ]
101
102  external_deps = [ "hilog:libhilog" ]
103
104  defines = []
105  defines += gpu_defines
106
107  part_name = "graphic_2d"
108  subsystem_name = "graphic"
109}
110