• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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      "__PHYSICS_MODULE__",
92    ]
93  }
94
95  include_dirs = [
96    "include",
97    "include/napi",
98  ]
99
100  cflags = [
101    "-Wno-unused-but-set-variable",
102    "-Wno-unused-lambda-capture",
103    "-Wno-unused-variable",
104  ]
105}
106
107ohos_source_set("napi_source") {
108  sources = [
109    "src/AnimationJS.cpp",
110    "src/BaseObjectJS.cpp",
111    "src/BloomJS.cpp",
112    "src/CameraJS.cpp",
113    "src/ColorProxy.cpp",
114    "src/EnvironmentJS.cpp",
115    "src/GeometryJS.cpp",
116    "src/ImageJS.cpp",
117    "src/LightJS.cpp",
118    "src/MaterialJS.cpp",
119    "src/MaterialPropertyJS.cpp",
120    "src/MeshJS.cpp",
121    "src/MeshResourceJS.cpp",
122    "src/NodeImpl.cpp",
123    "src/NodeJS.cpp",
124    "src/PostProcJS.cpp",
125    "src/PromiseBase.cpp",
126    "src/PropertyProxy.cpp",
127    "src/QuatProxy.cpp",
128    "src/Raycast.cpp",
129    "src/SceneComponentJS.cpp",
130    "src/SceneJS.cpp",
131    "src/SceneResourceImpl.cpp",
132    "src/ShaderJS.cpp",
133    "src/SubMeshJS.cpp",
134    "src/TextNodeJS.cpp",
135    "src/ToneMapJS.cpp",
136    "src/Vec2Proxy.cpp",
137    "src/Vec3Proxy.cpp",
138    "src/Vec4Proxy.cpp",
139    "src/geometry_definition/CubeJS.cpp",
140    "src/geometry_definition/CustomJS.cpp",
141    "src/geometry_definition/GeometryDefinition.cpp",
142    "src/geometry_definition/PlaneJS.cpp",
143    "src/geometry_definition/SphereJS.cpp",
144    "src/native_module_export.cpp",
145    "src/nodejstaskqueue.cpp",
146    "src/register_module.cpp",
147  ]
148
149  include_dirs = [ "../../3d_widget_adapter/include/ohos" ]
150
151  defines = []
152
153  configs = [
154    ":lume3d_config",
155    "../../3d_scene_adapter:scene_adapter_config",
156  ]
157
158  public_configs = [ ":napi_config" ]
159
160  deps = [ "../../3d_widget_adapter:lib3dWidgetAdapter" ]
161
162  external_deps = [
163    "c_utils:utils",
164    "graphic_2d:EGL",
165    "graphic_2d:GLESv3",
166    "graphic_surface:surface",
167    "hilog:libhilog",
168    "hitrace:hitrace_meter",
169    "init:libbegetutil",
170    "napi:ace_napi",
171  ]
172
173  part_name = "graphic_3d"
174  subsystem_name = "graphic"
175}
176
177group("napiInterface") {
178  public_configs = [ ":napi_config" ]
179}
180
181ohos_shared_library("libscene") {
182  deps = [ ":napi_source" ]
183  external_deps = [ "hilog:libhilog" ]
184  public_configs = [ ":napi_config" ]
185  relative_install_dir = "module/graphics"
186  part_name = "graphic_3d"
187  subsystem_name = "graphic"
188}
189