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/ohos.gni") 15import("//foundation/graphic/graphic_3d/lume/lume_config.gni") 16 17declare_args() { 18 MULTI_ECS_UPDATE_AT_ONCE = "0" 19 UNIFY_RENDER = "1" 20 DBG_DRAW_PIXEL = "0" 21 WIDGET_TRACE_ENABLE = "1" 22} 23 24config("lume3d_config") { 25 visibility = [ ":*" ] 26 defines = 27 [ "USE_LIB_PNG_JPEG_DYNAMIC_PLUGIN=$USE_LIB_PNG_JPEG_DYNAMIC_PLUGIN" ] 28 include_dirs = [ 29 "${LUME_BASE_PATH}/api", 30 "${LUME_CORE_PATH}/api", 31 "${LUME_RENDER_PATH}/api", 32 "${LUME_CORE3D_PATH}/api", 33 ] 34 35 if (current_os == "ohos") { 36 include_dirs += [ "${LUME_CORE_PATH}/api/platform/ohos" ] 37 } 38 if (USE_LIB_PNG_JPEG_DYNAMIC_PLUGIN) { 39 include_dirs += [ 40 "${LUME_PNG_PATH}/api", 41 "${LUME_JPG_PATH}/api", 42 ] 43 } 44 configs = [] 45 46 cflags = [ 47 "-Wall", 48 "-fexceptions", 49 "-Wno-sign-compare", 50 "-Wno-unused-variable", 51 "-Wno-unused-private-field", 52 "-Wno-implicit-fallthrough", 53 "-Wno-reorder", 54 "-Wno-unused-function", 55 "-Wno-tautological-unsigned-zero-compare", 56 57 "-Wno-nullability-completeness", 58 "-Wno-ignored-qualifiers", 59 "-Wno-switch", 60 61 "-DCORE_PUBLIC=__attribute__((visibility(\"default\")))", 62 "-DCORE_BUILD_2D = 0", 63 "-DCORE_BUILD_VULKAN=0", 64 "-DCORE_BUILD_GL=0", 65 "-DCORE_BUILD_GLES=1", 66 "-DCORE_DEV_ENABLED=0", 67 "-DCORE_TESTS_ENABLED=0", 68 "-DCORE_GL_DEBUG=0", 69 "-DCORE_VALIDATION_ENABLED = 0", 70 "-DCORE_VULKAN_VALIDATION_ENABLED = 0", 71 "-DCORE_EMBEDDED_ASSETS_ENABLED = 2", 72 "-DCORE_ENABLE_GPU_QUERIES=0", 73 "-DCORE_DEBUG_GPU_RESOURCE_IDS = 0", 74 "-DCORE_DEBUG_COMMAND_MARKERS_ENABLED = 0", 75 "-DCORE_DEBUG_MARKERS_ENABLED = 0", 76 "-DRENDER_HAS_GL_BACKEND=0", 77 "-DRENDER_HAS_GLES_BACKEND = 1", 78 "-DRENDER_HAS_VULKAN_BACKEND = 1", 79 "-DVK_USE_PLATFORM_OHOS = 1", 80 "-DCORE_LOG_NO_DEBUG=0", 81 "-DCORE_LOG_TO_DEBUG_OUTPUT=1", 82 "-DCORE_LOG_TO_CONSOLE", 83 "-DCORE_LOG_DISABLED=0", 84 "-DCORE_DYNAMIC=1", 85 ] 86} 87 88config("widget_adapter_config") { 89 defines = [ 90 "MULTI_ECS_UPDATE_AT_ONCE=${MULTI_ECS_UPDATE_AT_ONCE}", 91 "EGL_EGLEXT_PROTOTYPES", 92 "GL_GLEXT_PROTOTYPES", 93 "UNIFY_RENDER=${UNIFY_RENDER}", 94 "WIDGET_TRACE_ENABLE=${WIDGET_TRACE_ENABLE}", 95 "DBG_DRAW_PIXEL=${DBG_DRAW_PIXEL}", 96 ] 97 98 if (current_os == "ohos") { 99 defines += [ "__OHOS_PLATFORM__" ] 100 } 101 102 include_dirs = [ "include" ] 103 104 if (current_os == "ohos") { 105 include_dirs += [ "include/ohos" ] 106 } 107 108 if (MULTI_ECS_UPDATE_AT_ONCE == "1") { 109 cflags_cc += [ "-Wno-user-defined-warnings" ] 110 } 111} 112 113ohos_source_set("widget_adapter_source") { 114 defines = [ 115 "CORE_HAS_GLES_BACKEND=1", 116 "CORE_HAS_VULKAN_BACKEND=1", 117 ] 118 119 if (defined(global_parts_info.graphic_graphics_3d_ext)) { 120 defines += [ "_OPEN_BASIS_=1" ] 121 } 122 123 sources = [ 124 "core/src/engine_factory.cpp", 125 "core/src/lume/custom/lume_custom_render.cpp", 126 "core/src/lume/custom/shader_input_buffer.cpp", 127 "core/src/lume/lume_common.cpp", 128 "core/src/lume_render_config.cpp", 129 "src/graphics_manager_common.cpp", 130 "src/graphics_task.cpp", 131 "src/offscreen_context_helper.cpp", 132 "src/widget_adapter.cpp", 133 ] 134 135 include_dirs = [ 136 "core/include", 137 "core/include/lume", 138 "//foundation/graphic/graphic_2d/rosen/modules/", 139 ] 140 141 defines += [ 142 "CORE_HAS_GLES_BACKEND=1", 143 "CORE_HAS_VULKAN_BACKEND=1", 144 ] 145 146 configs = [ 147 ":widget_adapter_config", 148 ":lume3d_config", 149 ] 150 151 public_configs = [ ":widget_adapter_config" ] 152 153 external_deps = [] 154 155 if (current_os == "ohos") { 156 sources += [ 157 "core/src/lume/ohos/lume.cpp", 158 "src/ohos/graphics_manager.cpp", 159 "src/ohos/texture_layer.cpp", 160 ] 161 162 include_dirs += [ 163 "core/include/ohos", 164 "core/include/lume/ohos", 165 ] 166 167 external_deps += [ 168 "graphic_surface:surface", 169 "vulkan-headers:vulkan_headers", 170 ] 171 172 external_deps += [ 173 "ability_runtime:ability_manager", 174 "ability_runtime:app_context", 175 "ability_runtime:data_ability_helper", 176 "ability_runtime:napi_base_context", 177 "ability_runtime:napi_common", 178 "bundle_framework:appexecfwk_base", 179 "bundle_framework:appexecfwk_core", 180 "c_utils:utils", 181 "graphic_2d:EGL", 182 "graphic_2d:GLESv3", 183 "graphic_2d:librender_service_client", 184 "hilog:libhilog", 185 "hitrace:hitrace_meter", 186 "init:libbegetutil", 187 "ipc:ipc_single", 188 "napi:ace_napi", 189 "qos_manager:qos", 190 ] 191 192 defines += [ "LIB_ENGINE_CORE=${LIB_ENGINE_CORE}.z" ] 193 194 if (target_cpu == "arm") { 195 defines += [ 196 "PLATFORM_CORE_ROOT_PATH=/system/lib/", 197 "PLATFORM_CORE_PLUGIN_PATH=/system/lib/graphics3d/", 198 "PLATFORM_APP_ROOT_PATH=/system/lib/", 199 "PLATFORM_APP_PLUGIN_PATH=/system/lib/graphics3d", 200 ] 201 } 202 203 if (target_cpu == "arm64") { 204 defines += [ 205 "PLATFORM_CORE_ROOT_PATH=/system/lib64/", 206 "PLATFORM_CORE_PLUGIN_PATH=/system/lib64/graphics3d/", 207 "PLATFORM_APP_ROOT_PATH=/system/lib64/", 208 "PLATFORM_APP_PLUGIN_PATH=/system/lib64/graphics3d/", 209 ] 210 } 211 } 212 213 if (current_os == "android") { 214 sources += [ 215 "core/src/lume/android/lume.cpp", 216 "src/android/graphics_manager.cpp", 217 "src/android/skia_texture.cpp", 218 "src/android/texture_layer.cpp", 219 ] 220 221 include_dirs += [ 222 "core/include/android", 223 "core/include/lume/android", 224 ] 225 226 aosp_deps = [ 227 "shared_library:libEGL", 228 "shared_library:libGLESv2", 229 "shared_library:libandroid", 230 ] 231 232 deps += [ "$ace_flutter_engine_root:third_party_flutter_engine_android" ] 233 defines += [ "LIB_ENGINE_CORE=${LIB_ENGINE_CORE}" ] 234 } 235 236 part_name = "graphic_3d" 237 subsystem_name = "graphic" 238} 239 240group("3dWidgetAdapterInterface") { 241 public_configs = [ 242 ":widget_adapter_config", 243 "../3d_scene_adapter:scene_adapter_config", 244 "../kits/js:napi_config", 245 ] 246} 247 248ohos_shared_library("lib3dWidgetAdapter") { 249 deps = [ 250 ":widget_adapter_source", 251 "../3d_scene_adapter:scene_adapter_static", 252 ] 253 254 if (defined(global_parts_info.graphic_graphics_3d_ext)) { 255 deps += [ "../mbasis_vfx_plugin/app:3d_particles_app" ] 256 } 257 external_deps = [ "hilog:libhilog" ] 258 259 public_deps = [] 260 261 public_configs = [ 262 ":widget_adapter_config", 263 "../3d_scene_adapter:scene_adapter_config", 264 "../kits/js:napi_config", 265 ] 266 part_name = "graphic_3d" 267 subsystem_name = "graphic" 268} 269