1# Copyright (c) 2024 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") 16effect_root = "$graphic_2d_root/rosen/modules/effect" 17effect_ndk_include_dir = 18 "$graphic_2d_root/rosen/modules/effect/effect_ndk/include" 19effect_ndk_src_dir = "$graphic_2d_root/rosen/modules/effect/effect_ndk/src" 20 21config("export_config") { 22 include_dirs = [ "$effect_ndk_include_dir" ] 23} 24 25template("effect_ndk_source_set") { 26 forward_variables_from(invoker, "*") 27 28 ohos_source_set(target_name) { 29 defines += invoker.defines 30 cflags_cc = [] 31 32 sanitize = { 33 cfi = true 34 cfi_cross_dso = true 35 cfi_vcall_icall_only = true 36 debug = false 37 } 38 39 external_deps = [ 40 "c_utils:utils", 41 "hilog:libhilog", 42 "image_framework:image", 43 ] 44 45 public_deps = [ 46 "$effect_root//skia_effectChain:skeffectchain", 47 "$effect_root/color_picker:color_picker", 48 ] 49 50 configs = [ ":export_config" ] 51 sources = [ 52 "$effect_ndk_src_dir/effect_filter.cpp", 53 "$effect_ndk_src_dir/filter/filter.cpp", 54 ] 55 56 if (is_arkui_x) { 57 defines += [ "CROSS_PLATFORM" ] 58 } 59 if (rs_enable_gpu) { 60 defines += [ "RS_ENABLE_GPU" ] 61 } 62 if (is_emulator) { 63 defines += [ "ROSEN_EMULATOR" ] 64 } 65 66 include_dirs = [ 67 "$graphic_2d_root/rosen/modules/render_service_base/include", 68 "$graphic_2d_root/modules/2d_graphics/include", 69 ] 70 71 if (platform == "ohos" || platform == "ohos_ng") { 72 defines += [ "OHOS_PLATFORM" ] 73 external_deps += [ 74 "bounds_checking_function:libsec_static", 75 "image_framework:pixelmap", 76 "image_framework:pixelmap_ndk", 77 ] 78 deps = [ "$graphic_2d_root/rosen/modules/render_service_base:librender_service_base" ] 79 cflags = [ "-fstack-protector-strong" ] 80 cflags_cc += [ "-fstack-protector-strong" ] 81 } else { 82 deps = [] 83 cflags = [ "-std=c++17" ] 84 85 if (!is_arkui_x) { 86 deps += [ "$rosen_root/modules/platform:hilog" ] 87 } 88 } 89 part_name = "graphic_2d" 90 subsystem_name = "graphic" 91 } 92} 93 94effect_ndk_source_set("effect_ndk_source_ohos") { 95 platform = "ohos" 96 defines = [] 97} 98 99ohos_shared_library("native_effect_ndk") { 100 sanitize = { 101 cfi = true 102 cfi_cross_dso = true 103 cfi_vcall_icall_only = true 104 debug = false 105 } 106 platform = current_os 107 if (platform == "mingw") { 108 platform = "windows" 109 } 110 public_configs = [ ":export_config" ] 111 112 if (platform == "ohos") { 113 deps = [ "$effect_root/effect_ndk:effect_ndk_source_ohos" ] 114 symlink_target_name = [ "libnative_effect.so" ] 115 innerapi_tags = [ "ndk" ] 116 } 117 part_name = "graphic_2d" 118 subsystem_name = "graphic" 119} 120