1# Copyright (c) 2024 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") 16import("${graphic_2d_root}/rosen/modules/render_service_base/config.gni") 17 18config("rs_graphic_test_config") { 19 include_dirs = [ 20 "include", 21 "resource", 22 "$graphic_2d_root/rosen/modules", 23 "$graphic_2d_root/rosen/modules/render_service_client/core", 24 "$graphic_2d_root/rosen/modules/render_service_base/include", 25 "$graphic_2d_root/rosen/modules/render_service_profiler", 26 "$graphic_2d_root/rosen/modules/2d_graphics", 27 "$graphic_2d_root/rosen/modules/2d_graphics/include", 28 "$graphic_2d_root/rosen/modules/utils", 29 ] 30 31 defines = rs_common_define 32} 33 34ohos_source_set("rs_graphic_test_src") { 35 defines = [] 36 defines += gpu_defines 37 testonly = true 38 39 sources = [ 40 "src/rs_graphic_rootnode.cpp", 41 "src/rs_graphic_test.cpp", 42 "src/rs_graphic_test_director.cpp", 43 "src/rs_graphic_test_ext.cpp", 44 "src/rs_graphic_test_img.cpp", 45 "src/rs_graphic_test_profiler_thread.cpp", 46 "src/rs_graphic_test_profiler.cpp", 47 "src/rs_graphic_test_text.cpp", 48 "src/rs_graphic_test_utils.cpp", 49 "src/rs_parameter_parse.cpp", 50 ] 51 52 cflags = [ 53 "-Wno-pointer-arith", 54 "-Wno-missing-field-initializers", 55 "-Wno-c++11-narrowing", 56 ] 57 58 cflags_cc = [ 59 "-fvisibility-inlines-hidden", 60 "-std=c++17", 61 ] 62 63 public_configs = [ ":rs_graphic_test_config" ] 64 65 deps = [ 66 "$rosen_root/modules/2d_graphics:2d_graphics", 67 "$rosen_root/modules/platform:eventhandler", 68 "$rosen_root/modules/platform:hilog", 69 "$rosen_root/modules/platform:ipc_core", 70 ] 71 72 public_deps = [ 73 "$rosen_root/modules/render_service:librender_service", 74 "$rosen_root/modules/render_service_base:librender_service_base", 75 "$rosen_root/modules/render_service_client:librender_service_client", 76 ] 77 78 public_external_deps = [ 79 "cJSON:cjson", 80 "googletest:gtest", 81 "graphic_surface:surface", 82 "graphics_effect:graphics_effect_core", 83 "hilog:libhilog", 84 "hitrace:hitrace_meter", 85 "image_framework:image_native", 86 "libpng:libpng", 87 "window_manager:libdm", 88 "zlib:libz", 89 ] 90 91 if (rosen_is_ohos && graphic_2d_feature_rs_enable_profiler && 92 player_framework_enable) { 93 defines += [ "RS_PROFILER_ENABLED" ] 94 } 95 96 part_name = "graphic_2d" 97 subsystem_name = "graphic" 98} 99 100ohos_shared_library("rs_graphic_test") { 101 testonly = true 102 103 public_deps = [ ":rs_graphic_test_src" ] 104 105 external_deps = [ "googletest:gtest_main" ] 106 107 part_name = "graphic_2d" 108 subsystem_name = "graphic" 109} 110 111ohos_static_library("rs_graphic_test_main") { 112 testonly = true 113 114 sources = [ "src/rs_graphic_test_main.cpp" ] 115 116 public_deps = [ ":rs_graphic_test_src" ] 117 118 external_deps = [ 119 "eventhandler:libeventhandler", 120 "hilog:libhilog", 121 ] 122 123 part_name = "graphic_2d" 124 subsystem_name = "graphic" 125} 126 127action_foreach("objcopy_resource") { 128 # add resource file here 129 sources = [ 130 "$rosen_root/modules/effect/test/resource/images/test.png", 131 # "resource/pngtest.png", 132 ] 133 134 resource_dir = 135 get_label_info(":binary_resource($current_toolchain)", "target_out_dir") 136 137 outputs = [ "$resource_dir/{{source_name_part}}.data" ] 138 139 script = "build_resource_to_bytecode.py" 140 out_target = rebase_path("$resource_dir/") + "{{source_name_part}}.data" 141 142 args = [ 143 "--input", 144 "{{source}}", 145 "--output", 146 out_target, 147 ] 148} 149