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  ]
29
30  if (current_os == "ohos") {
31    include_dirs += [ "${LUME_CORE_PATH}/api/platform/ohos" ]
32  }
33
34  configs = []
35
36  cflags = [
37    "-Wall",
38    "-fexceptions",
39    "-Wno-sign-compare",
40    "-Wno-unused-variable",
41    "-Wno-unused-private-field",
42    "-Wno-implicit-fallthrough",
43    "-Wno-reorder",
44    "-Wno-unused-function",
45    "-Wno-tautological-unsigned-zero-compare",
46
47    "-Wno-nullability-completeness",
48    "-Wno-ignored-qualifiers",
49    "-Wno-switch",
50
51    "-DCORE_PUBLIC=__attribute__((visibility(\"default\")))",
52    "-DCORE_BUILD_2D = 0",
53    "-DCORE_BUILD_VULKAN=0",
54    "-DCORE_BUILD_GL=0",
55    "-DCORE_BUILD_GLES=1",
56    "-DCORE_DEV_ENABLED=0",
57    "-DCORE_TESTS_ENABLED=0",
58    "-DCORE_GL_DEBUG=0",
59    "-DCORE_VALIDATION_ENABLED = 0",
60    "-DCORE_VULKAN_VALIDATION_ENABLED = 0",
61    "-DCORE_EMBEDDED_ASSETS_ENABLED = 2",
62    "-DCORE_ENABLE_GPU_QUERIES=0",
63    "-DCORE_DEBUG_GPU_RESOURCE_IDS = 0",
64    "-DCORE_DEBUG_COMMAND_MARKERS_ENABLED = 0",
65    "-DCORE_DEBUG_MARKERS_ENABLED = 0",
66    "-DRENDER_HAS_GL_BACKEND=0",
67    "-DRENDER_HAS_GLES_BACKEND = 1",
68    "-DRENDER_HAS_VULKAN_BACKEND = 1",
69    "-DVK_USE_PLATFORM_ANDROID_KHR = 1",
70    "-DCORE_LOG_NO_DEBUG=0",
71    "-DCORE_LOG_TO_DEBUG_OUTPUT=1",
72    "-DCORE_LOG_TO_CONSOLE",
73    "-DCORE_LOG_DISABLED=0",
74    "-DCORE_DYNAMIC=1",
75  ]
76}
77
78config("napi_config") {
79  defines = []
80
81  if (current_os == "ohos") {
82    defines += [
83      "__OHOS_PLATFORM__",
84      "__SCENE_ADAPTER__",
85    ]
86  }
87
88  include_dirs = [
89    "include",
90    "include/napi",
91  ]
92
93  cflags = [
94    "-Wno-unused-but-set-variable",
95    "-Wno-unused-lambda-capture",
96    "-Wno-unused-variable",
97  ]
98}
99
100ohos_source_set("napi_source") {
101  sources = [
102    "src/AnimationJS.cpp",
103    "src/BaseObjectJS.cpp",
104    "src/CameraJS.cpp",
105    "src/ColorProxy.cpp",
106    "src/EnvironmentJS.cpp",
107    "src/GeometryJS.cpp",
108    "src/ImageJS.cpp",
109    "src/LightJS.cpp",
110    "src/MaterialJS.cpp",
111    "src/MeshJS.cpp",
112    "src/NodeImpl.cpp",
113    "src/NodeJS.cpp",
114    "src/ObjectProxy.cpp",
115    "src/PostProcJS.cpp",
116    "src/PropertyProxy.cpp",
117    "src/QuatProxy.cpp",
118    "src/SceneJS.cpp",
119    "src/SceneResourceImpl.cpp",
120    "src/ShaderJS.cpp",
121    "src/SubMeshJS.cpp",
122    "src/ToneMapJS.cpp",
123    "src/Vec2Proxy.cpp",
124    "src/Vec3Proxy.cpp",
125    "src/Vec4Proxy.cpp",
126    "src/native_module_export.cpp",
127    "src/register_module.cpp",
128  ]
129
130  include_dirs = [ "../../3d_widget_adapter/includ/ohos" ]
131
132  defines = []
133
134  configs = [
135    ":lume3d_config",
136    "${LUME_METAOBJECT_PATH}:lume_metaobject_config",
137    "${LUME_SCP_PATH}:lume_scenewidget_config",
138    "../../3d_scene_adapter:scene_adapter_config",
139  ]
140
141  public_configs = [ ":napi_config" ]
142
143  deps = [ "../../3d_widget_adapter:lib3dWidgetAdapter" ]
144
145  external_deps = [
146    "c_utils:utils",
147    "egl:libEGL",
148    "hilog:libhilog",
149    "hitrace:hitrace_meter",
150    "init:libbegetutil",
151    "napi:ace_napi",
152  ]
153
154  part_name = "graphic_3d"
155  subsystem_name = "graphic"
156}
157
158group("napiInterface") {
159  public_configs = [ ":napi_config" ]
160}
161
162ohos_shared_library("libscene") {
163  deps = [ ":napi_source" ]
164  public_configs = [ ":napi_config" ]
165  relative_install_dir = "module/graphics"
166  part_name = "graphic_3d"
167  subsystem_name = "graphic"
168}
169