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} 19 20config("lume3d_config") { 21 visibility = [ ":*" ] 22 23 include_dirs = [ 24 "${LUME_BASE_PATH}/api", 25 "${LUME_CORE_PATH}/api", 26 "${LUME_RENDER_PATH}/api", 27 "${LUME_CORE3D_PATH}/api", 28 "${LUME_META_PATH}/include", 29 "${LUME_SCENE_PATH}/include", 30 ] 31 32 if (current_os == "ohos") { 33 include_dirs += [ "${LUME_CORE_PATH}/api/platform/ohos" ] 34 } 35 36 configs = [ 37 "${LUME_ROOT}/LumeFont:lume_font_api", 38 "${LUME_ROOT}/Lume_3DText:lume_3dtext_api", 39 ] 40 41 cflags = [ 42 "-Wall", 43 "-fexceptions", 44 "-Wno-sign-compare", 45 "-Wno-unused-variable", 46 "-Wno-unused-private-field", 47 "-Wno-implicit-fallthrough", 48 "-Wno-reorder", 49 "-Wno-unused-function", 50 "-Wno-tautological-unsigned-zero-compare", 51 52 "-Wno-nullability-completeness", 53 "-Wno-ignored-qualifiers", 54 "-Wno-switch", 55 "-Wno-overloaded-virtual", 56 "-Wno-parentheses", 57 58 "-DCORE_PUBLIC=__attribute__((visibility(\"default\")))", 59 "-DCORE_BUILD_2D = 0", 60 "-DCORE_BUILD_VULKAN=0", 61 "-DCORE_BUILD_GL=0", 62 "-DCORE_BUILD_GLES=1", 63 "-DCORE_DEV_ENABLED=0", 64 "-DCORE_TESTS_ENABLED=0", 65 "-DCORE_GL_DEBUG=0", 66 "-DCORE_VALIDATION_ENABLED = 0", 67 "-DCORE_VULKAN_VALIDATION_ENABLED = 0", 68 "-DCORE_EMBEDDED_ASSETS_ENABLED = 2", 69 "-DCORE_ENABLE_GPU_QUERIES=0", 70 "-DCORE_DEBUG_GPU_RESOURCE_IDS = 0", 71 "-DCORE_DEBUG_COMMAND_MARKERS_ENABLED = 0", 72 "-DCORE_DEBUG_MARKERS_ENABLED = 0", 73 "-DRENDER_HAS_GL_BACKEND=0", 74 "-DRENDER_HAS_GLES_BACKEND = 1", 75 "-DRENDER_HAS_VULKAN_BACKEND = 1", 76 "-DVK_USE_PLATFORM_OHOS = 1", 77 "-DCORE_LOG_NO_DEBUG=0", 78 "-DCORE_LOG_TO_DEBUG_OUTPUT=1", 79 "-DCORE_LOG_TO_CONSOLE", 80 "-DCORE_DYNAMIC=1", 81 ] 82} 83 84config("napi_config") { 85 defines = [] 86 87 if (current_os == "ohos") { 88 defines += [ 89 "__OHOS_PLATFORM__", 90 "__SCENE_ADAPTER__", 91 "__NAPI_CALL_TF_WITH_PRIORITY__", 92 "__PHYSICS_MODULE__", 93 ] 94 } 95 96 include_dirs = [ 97 "src", 98 "include", 99 "include/napi", 100 ] 101 102 cflags = [ 103 "-Wno-unused-but-set-variable", 104 "-Wno-unused-lambda-capture", 105 "-Wno-unused-variable", 106 ] 107} 108 109ohos_source_set("napi_source") { 110 sources = [ 111 "src/AnimationJS.cpp", 112 "src/ArrayPropertyProxy.cpp", 113 "src/BaseObjectJS.cpp", 114 "src/BloomJS.cpp", 115 "src/CameraJS.cpp", 116 "src/ColorProxy.cpp", 117 "src/DisposeContainer.cpp", 118 "src/EnvironmentJS.cpp", 119 "src/GeometryJS.cpp", 120 "src/geometry_definition/CubeJS.cpp", 121 "src/geometry_definition/CustomJS.cpp", 122 "src/geometry_definition/GeometryDefinition.cpp", 123 "src/geometry_definition/PlaneJS.cpp", 124 "src/geometry_definition/SphereJS.cpp", 125 "src/ImageJS.cpp", 126 "src/JsObjectCache.cpp", 127 "src/LightJS.cpp", 128 "src/MaterialJS.cpp", 129 "src/MaterialPropertyJS.cpp", 130 "src/MeshJS.cpp", 131 "src/MeshResourceJS.cpp", 132 "src/MorpherJS.cpp", 133 "src/napi/array.cpp", 134 "src/napi/env.cpp", 135 "src/napi/function.cpp", 136 "src/napi/object.cpp", 137 "src/napi/strong_ref.cpp", 138 "src/napi/utils.cpp", 139 "src/napi/value.cpp", 140 "src/napi/weak_ref.cpp", 141 "src/native_module_export.cpp", 142 "src/NodeImpl.cpp", 143 "src/NodeJS.cpp", 144 "src/nodejstaskqueue.cpp", 145 "src/ParamParsing.cpp", 146 "src/PostProcJS.cpp", 147 "src/Promise.cpp", 148 "src/PropertyProxy.cpp", 149 "src/QuatProxy.cpp", 150 "src/Raycast.cpp", 151 "src/register_module.cpp", 152 "src/RenderContextJS.cpp", 153 "src/SamplerJS.cpp", 154 "src/SceneComponentJS.cpp", 155 "src/SceneJS.cpp", 156 "src/SceneResourceImpl.cpp", 157 "src/ShaderJS.cpp", 158 "src/SubMeshJS.cpp", 159 "src/TextNodeJS.cpp", 160 "src/ToneMapJS.cpp", 161 "src/TrueRootObject.cpp", 162 "src/Vec2Proxy.cpp", 163 "src/Vec3Proxy.cpp", 164 "src/Vec4Proxy.cpp", 165 ] 166 167 include_dirs = [ "../../3d_widget_adapter/include/ohos" ] 168 169 defines = [] 170 171 configs = [ 172 ":lume3d_config", 173 "../../3d_scene_adapter:scene_adapter_config", 174 ] 175 176 public_configs = [ ":napi_config" ] 177 178 deps = [ "../../3d_widget_adapter:lib3dWidgetAdapter" ] 179 180 external_deps = [ 181 "c_utils:utils", 182 "graphic_2d:EGL", 183 "graphic_2d:GLESv3", 184 "graphic_surface:surface", 185 "hilog:libhilog", 186 "hitrace:hitrace_meter", 187 "init:libbegetutil", 188 "napi:ace_napi", 189 ] 190 191 part_name = "graphic_3d" 192 subsystem_name = "graphic" 193} 194 195group("napiInterface") { 196 public_configs = [ ":napi_config" ] 197} 198 199ohos_shared_library("libscene") { 200 deps = [ ":napi_source" ] 201 external_deps = [ "hilog:libhilog" ] 202 public_configs = [ ":napi_config" ] 203 relative_install_dir = "module/graphics" 204 part_name = "graphic_3d" 205 subsystem_name = "graphic" 206} 207