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("//build/ohos/ace/ace.gni") 16import("//foundation/graphic/graphic_3d/lume/lume_config.gni") 17 18config("lume3d_config") { 19 visibility = [ ":*" ] 20 defines = 21 [ "USE_LIB_PNG_JPEG_DYNAMIC_PLUGIN=$USE_LIB_PNG_JPEG_DYNAMIC_PLUGIN" ] 22 include_dirs = [ 23 "${LUME_BASE_PATH}/api", 24 "${LUME_CORE_PATH}/api", 25 "${LUME_RENDER_PATH}/api", 26 "${LUME_CORE3D_PATH}/api", 27 "${LUME_META_PATH}/include", 28 "${LUME_SCENE_PATH}/include", 29 "${LUME_FONT_PATH}/include", 30 "//foundation/graphic/graphic_3d/camera_preview_plugin/api/", 31 ] 32 33 if (current_os == "ohos") { 34 include_dirs += [ "${LUME_CORE_PATH}/api/platform/ohos" ] 35 } 36 if (USE_LIB_PNG_JPEG_DYNAMIC_PLUGIN) { 37 include_dirs += [ 38 "${LUME_PNG_PATH}/api", 39 "${LUME_JPG_PATH}/api", 40 ] 41 } 42 configs = [ 43 "${LUME_CORE_PATH}:lume_component_help_config", 44 "${LUME_ROOT}/LumeFont:lume_font_api", 45 "${LUME_ROOT}/Lume_3DText:lume_3dtext_api", 46 ] 47 48 cflags = [ 49 "-Wall", 50 "-fexceptions", 51 "-Wno-sign-compare", 52 "-Wno-unused-variable", 53 "-Wno-unused-private-field", 54 "-Wno-implicit-fallthrough", 55 "-Wno-reorder", 56 "-Wno-unused-function", 57 "-Wno-tautological-unsigned-zero-compare", 58 "-Wno-ignored-qualifiers", 59 "-Wno-unused-lambda-capture", 60 "-Wno-unused-but-set-variable", 61 62 "-DCORE_PUBLIC=__attribute__((visibility(\"default\")))", 63 "-DCORE_BUILD_2D = 0", 64 "-DCORE_BUILD_VULKAN=0", 65 "-DCORE_BUILD_GL=0", 66 "-DCORE_BUILD_GLES=1", 67 "-DCORE_DEV_ENABLED=0", 68 "-DCORE_TESTS_ENABLED=0", 69 "-DCORE_GL_DEBUG=0", 70 "-DCORE_VALIDATION_ENABLED = 0", 71 "-DCORE_VULKAN_VALIDATION_ENABLED = 0", 72 "-DCORE_EMBEDDED_ASSETS_ENABLED = 2", 73 "-DCORE_ENABLE_GPU_QUERIES=0", 74 "-DCORE_DEBUG_GPU_RESOURCE_IDS = 0", 75 "-DCORE_DEBUG_COMMAND_MARKERS_ENABLED = 0", 76 "-DCORE_DEBUG_MARKERS_ENABLED = 0", 77 "-DRENDER_HAS_GL_BACKEND=0", 78 "-DRENDER_HAS_GLES_BACKEND = 1", 79 "-DRENDER_HAS_VULKAN_BACKEND = 1", 80 "-DVK_USE_PLATFORM_OHOS = 1", 81 "-DCORE_LOG_NO_DEBUG=0", 82 "-DCORE_LOG_TO_DEBUG_OUTPUT=1", 83 "-DCORE_LOG_TO_CONSOLE", 84 "-DCORE_LOG_DISABLED=0", 85 "-DCORE_DYNAMIC=1", 86 ] 87} 88 89config("scene_adapter_config") { 90 defines = [] 91 92 include_dirs = [ "include" ] 93 94 if (KIT_3D_ENABLE) { 95 defines = [ "KIT_3D_ENABLE=$KIT_3D_ENABLE" ] 96 } 97 if (current_os == "ohos") { 98 defines += [ 99 "__OHOS_PLATFORM__", 100 "__SCENE_ADAPTER__", 101 ] 102 } 103} 104 105group("sceneAdapterInterface") { 106 public_configs = [ ":scene_adapter_config" ] 107} 108 109ohos_source_set("scene_adapter_source") { 110 sources = [ 111 "src/scene_adapter.cpp", 112 "src/scene_bridge.cpp", 113 ] 114 115 include_dirs = [ 116 "include", 117 "../3d_widget_adapter/core/include", 118 ] 119 120 defines = [ 121 "CORE_HAS_GLES_BACKEND=1", 122 "CORE_HAS_VULKAN_BACKEND=1", 123 ] 124 125 configs = [ 126 ":lume3d_config", 127 "../3d_widget_adapter:widget_adapter_config", 128 ] 129 130 external_deps = [ 131 "ability_runtime:ability_manager", 132 "ability_runtime:app_context", 133 "ability_runtime:data_ability_helper", 134 "ability_runtime:napi_base_context", 135 "bundle_framework:appexecfwk_base", 136 "bundle_framework:appexecfwk_core", 137 "c_utils:utils", 138 "graphic_2d:EGL", 139 "graphic_2d:GLESv3", 140 "graphic_2d:librender_service_base", 141 "graphic_2d:librender_service_client", 142 "graphic_surface:surface", 143 "graphic_surface:sync_fence", 144 "hilog:libhilog", 145 "hitrace:hitrace_meter", 146 "init:libbegetutil", 147 "input:libmmi-client", 148 "ipc:ipc_single", 149 "napi:ace_napi", 150 "vulkan-headers:vulkan_headers", 151 ] 152 defines += [ "LIB_ENGINE_CORE=${LIB_ENGINE_CORE}.z" ] 153 154 if (target_cpu == "arm" || target_cpu == "x86") { 155 defines += [ 156 "PLATFORM_CORE_ROOT_PATH=/system/lib/", 157 "PLATFORM_CORE_PLUGIN_PATH=/system/lib/graphics3d", 158 "PLATFORM_APP_ROOT_PATH=/system/lib/", 159 "PLATFORM_APP_PLUGIN_PATH=/system/lib/graphics3d", 160 ] 161 } 162 163 if (target_cpu == "arm64" || target_cpu == "x64") { 164 defines += [ 165 "PLATFORM_CORE_ROOT_PATH=/system/lib64/", 166 "PLATFORM_CORE_PLUGIN_PATH=/system/lib64/graphics3d/", 167 "PLATFORM_APP_ROOT_PATH=/system/lib64/", 168 "PLATFORM_APP_PLUGIN_PATH=/system/lib64/graphics3d/", 169 ] 170 } 171 172 deps = [ "../kits/js:napiInterface" ] 173 174 part_name = "graphic_3d" 175 subsystem_name = "graphic" 176} 177 178ohos_static_library("scene_adapter_static") { 179 deps = [ ":scene_adapter_source" ] 180 181 public_configs = [ 182 ":scene_adapter_config", 183 ":lume3d_config", 184 ] 185 186 part_name = "graphic_3d" 187 subsystem_name = "graphic" 188} 189