1# Copyright (c) 2025 Huawei Device Co., Ltd.. All rights reserved. 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/graphic_config.gni") 16 17if (defined(graphic_2d_ext_feature_enable_ddgr) && 18 (graphic_2d_ext_feature_enable_ddgr || ddgr_feature_cross_compile)) { 19 action("generate_shader_register_code") { 20 sources = ddgr_shader_register_set.sources 21 script = ddgr_shader_register_set.script 22 args = ddgr_shader_register_set.args 23 outputs = ddgr_shader_register_set.outputs 24 } 25 26 ohos_shared_library("libddgr_compiler") { 27 sanitize = { 28 cfi = true 29 cfi_cross_dso = true 30 cfi_no_nvcall = true 31 cfi_vcall_icall_only = true 32 debug = false 33 } 34 35 ldflags = ddgr_link_config_set.ldflags 36 deps = [ ":ddgr_compiler_src_set" ] 37 38 part_name = "graphic_2d" 39 subsystem_name = "graphic" 40 } 41 42 ohos_source_set("ddgr_compiler_src_set") { 43 sanitize = { 44 cfi = true 45 cfi_cross_dso = true 46 cfi_no_nvcall = true 47 cfi_vcall_icall_only = true 48 debug = false 49 } 50 51 configs = [ ":ddgr_compiler_config" ] 52 sources = ddgr_compiler_src_set.sources 53 public_external_deps = ddgr_compiler_src_set.public_external_deps 54 configs += ddgr_compiler_src_set.configs 55 56 deps = [ ":generate_shader_register_code" ] 57 58 part_name = "graphic_2d" 59 subsystem_name = "graphic" 60 } 61 62 config("ddgr_compiler_config") { 63 cflags = ddgr_compiler_src_set.cflags 64 cflags_cc = ddgr_compiler_src_set.cflags_cc 65 defines = ddgr_compiler_src_set.defines 66 include_dirs = ddgr_compiler_src_set.include_dirs 67 } 68 69 ohos_shared_library("libddgr") { 70 sanitize = { 71 cfi = true 72 cfi_cross_dso = true 73 cfi_no_nvcall = true 74 cfi_vcall_icall_only = true 75 debug = false 76 } 77 78 ldflags = ddgr_link_config_set.ldflags 79 deps = [ ":ddgr_src_set" ] 80 data_deps = [ ":libddgr_compiler" ] 81 public_configs = [ ":public_ddgr_config" ] 82 83 part_name = "graphic_2d" 84 subsystem_name = "graphic" 85 } 86 87 ohos_source_set("ddgr_src_set") { 88 sanitize = { 89 cfi = true 90 cfi_cross_dso = true 91 cfi_no_nvcall = true 92 cfi_vcall_icall_only = true 93 debug = false 94 } 95 96 sources = ddgr_src_set.sources 97 configs = [ ":ddgr_config" ] 98 configs += ddgr_src_set.configs 99 public_external_deps = ddgr_src_set.public_external_deps 100 deps = ddgr_src_set.deps 101 102 deps += [ ":generate_shader_register_code" ] 103 104 part_name = "graphic_2d" 105 subsystem_name = "graphic" 106 } 107 108 config("ddgr_config") { 109 cflags = ddgr_src_set.cflags 110 cflags_cc = ddgr_src_set.cflags_cc 111 defines = ddgr_src_set.defines 112 include_dirs = ddgr_src_set.include_dirs 113 } 114 115 config("public_ddgr_config") { 116 defines = public_ddgr_config_set.defines 117 include_dirs = public_ddgr_config_set.include_dirs 118 } 119} else { 120 ohos_shared_library("libddgr") { 121 sanitize = { 122 cfi = true 123 cfi_cross_dso = true 124 cfi_no_nvcall = true 125 cfi_vcall_icall_only = true 126 debug = false 127 } 128 sources = [] 129 130 part_name = "graphic_2d" 131 subsystem_name = "graphic" 132 } 133} 134