• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2023 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_2d/graphic_config.gni")
16import("//foundation/graphic/graphic_3d/lume/lume_config.gni")
17
18declare_args() {
19  CORE3D_EMBEDDED_ASSETS_ENABLED=true
20  CORE3D_ROFS = "rofs3D"
21}
22
23config("lume_3d_api") {
24  include_dirs = [
25    "api",
26  ]
27}
28
29config("lume_3d_config") {
30  include_dirs = [
31    "3rdparty/",
32    "src/",
33    "assets/",
34  ]
35
36  defines = [
37    "__OHOS_PLATFORM__",
38    "CORE3D_PUBLIC=__attribute__((visibility(\"default\")))",
39    "CORE_USE_COMPILER_GENERATED_STATIC_LIST=1",
40    "CORE3D_SHARED_LIBRARY=1",
41    "CORE3D_VALIDATION_ENABLED=0",
42    "CORE3D_TESTS_ENABLED=0",
43    "CORE3D_DEV_ENABLED=${CORE_DEV_ENABLED}",
44    "CORE3D_PUBLIC=__attribute__((visibility(\"default\")))",
45    "CORE_USE_COMPILER_GENERATED_STATIC_LIST=1",
46    "CORE_STATIC_PLUGIN_HEADER=${CORE_STATIC_PLUGIN_HEADER }"
47  ]
48
49  if (LUME_OHOS_BUILD) {
50    defines += [
51      "__OHOS_PLATFORM__",
52    ]
53  }
54
55  if (CORE3D_EMBEDDED_ASSETS_ENABLED) {
56    defines += [
57      "CORE3D_EMBEDDED_ASSETS_ENABLED=1",
58    ]
59  }
60}
61
62ohos_source_set("lume_3d_src") {
63  public_configs = [
64    ":lume_3d_config",
65    ":lume_3d_api",
66    "${LUME_RENDER_PATH}:lume_render_api",
67    "${LUME_CORE_PATH}:lume_base_api",
68    "${LUME_CORE_PATH}:lume_engine_api",
69    "${LUME_CORE_PATH}:lume_component_help_config",
70    "${LUME_CORE_PATH}:lume_default"
71  ]
72
73  sources = [
74    "version.cpp",
75    "src/graphics_context.h",
76    "src/graphics_context.cpp",
77
78    "src/ecs/components/animation_component_manager.cpp",
79    "src/ecs/components/animation_input_component_manager.cpp",
80    "src/ecs/components/animation_output_component_manager.cpp",
81    "src/ecs/components/animation_state_component_manager.cpp",
82    "src/ecs/components/animation_state_component.h",
83    "src/ecs/components/animation_track_component_manager.cpp",
84    "src/ecs/components/render_handle_component_manager.cpp",
85    "src/ecs/components/environment_component_manager.cpp",
86    "src/ecs/components/fog_component_manager.cpp",
87    "src/ecs/components/initial_transform_component.h",
88    "src/ecs/components/initial_transform_component_manager.cpp",
89    "src/ecs/components/camera_component_manager.cpp",
90    "src/ecs/components/joint_matrices_component_manager.cpp",
91    "src/ecs/components/layer_flag_bits_metadata.h",
92    "src/ecs/components/layer_component_manager.cpp",
93    "src/ecs/components/light_component_manager.cpp",
94    "src/ecs/components/local_matrix_component_manager.cpp",
95    "src/ecs/components/material_extension_component_manager.cpp",
96    "src/ecs/components/material_component_manager.cpp",
97    "src/ecs/components/mesh_component_manager.cpp",
98    "src/ecs/components/name_component_manager.cpp",
99    "src/ecs/components/node_component_manager.cpp",
100    "src/ecs/components/physical_camera_component_manager.cpp",
101    "src/ecs/components/planar_reflection_component_manager.cpp",
102    "src/ecs/components/post_process_component_manager.cpp",
103    "src/ecs/components/previous_joint_matrices_component_manager.cpp",
104    "src/ecs/components/previous_world_matrix_component_manager.cpp",
105    "src/ecs/components/render_mesh_batch_component_manager.cpp",
106    "src/ecs/components/render_mesh_component_manager.cpp",
107    "src/ecs/components/render_configuration_component_manager.cpp",
108    "src/ecs/components/skin_component_manager.cpp",
109    "src/ecs/components/skin_joints_component_manager.cpp",
110    "src/ecs/components/skin_ibm_component_manager.cpp",
111    "src/ecs/components/world_matrix_component_manager.cpp",
112    "src/ecs/components/transform_component_manager.cpp",
113    "src/ecs/components/uri_component_manager.cpp",
114    "src/ecs/components/morph_component_manager.cpp",
115    "src/ecs/components/rsdz_model_id_component_manager.cpp",
116    "src/ecs/systems/animation_playback.h",
117    "src/ecs/systems/animation_playback.cpp",
118    "src/ecs/systems/animation_system.h",
119    "src/ecs/systems/animation_system.cpp",
120    "src/ecs/systems/local_matrix_system.h",
121    "src/ecs/systems/local_matrix_system.cpp",
122    "src/ecs/systems/node_system.h",
123    "src/ecs/systems/node_system.cpp",
124    "src/ecs/systems/render_preprocessor_system.cpp",
125    "src/ecs/systems/render_system.h",
126    "src/ecs/systems/render_system.cpp",
127    "src/ecs/systems/skinning_system.h",
128    "src/ecs/systems/skinning_system.cpp",
129    "src/ecs/systems/morphing_system.h",
130    "src/ecs/systems/morphing_system.cpp",
131
132    "src/gltf/data.h",
133    "src/gltf/gltf2.h",
134    "src/gltf/gltf2.cpp",
135    "src/gltf/gltf2_data_structures.h",
136    "src/gltf/gltf2_exporter.h",
137    "src/gltf/gltf2_exporter.cpp",
138    "src/gltf/gltf2_importer.h",
139    "src/gltf/gltf2_importer.cpp",
140    "src/gltf/gltf2_loader.h",
141    "src/gltf/gltf2_loader.cpp",
142    "src/gltf/gltf2_util.h",
143    "src/gltf/gltf2_util.cpp",
144
145    "src/loader/json_util.h",
146
147    "src/plugin/static_plugin.cpp",
148    #"src/plugin/static_registry.cpp",
149
150    "src/property/property_handle.h",
151    "src/property/property_handle.cpp",
152
153    "src/render/render_node_scene_util.h",
154    "src/render/render_node_scene_util.cpp",
155
156    "src/render/node/render_node_create_default_camera_gpu_images.h",
157    "src/render/node/render_node_create_default_camera_gpu_images.cpp",
158    "src/render/node/render_node_default_cameras.h",
159    "src/render/node/render_node_default_cameras.cpp",
160    "src/render/node/render_node_default_camera_controller.h",
161    "src/render/node/render_node_default_camera_controller.cpp",
162    "src/render/node/render_node_default_env.h",
163    "src/render/node/render_node_default_env.cpp",
164    "src/render/node/render_node_default_lights.h",
165    "src/render/node/render_node_default_lights.cpp",
166    "src/render/node/render_node_default_material_objects.h",
167    "src/render/node/render_node_default_material_objects.cpp",
168    "src/render/node/render_node_default_material_render_slot.h",
169    "src/render/node/render_node_default_material_render_slot.cpp",
170    "src/render/node/render_node_default_material_deferred_shading.h",
171    "src/render/node/render_node_default_material_deferred_shading.cpp",
172    "src/render/node/render_node_default_shadow_render_slot.h",
173    "src/render/node/render_node_default_shadow_render_slot.cpp",
174    "src/render/node/render_node_default_shadows_blur.h",
175    "src/render/node/render_node_default_shadows_blur.cpp",
176    "src/render/node/render_node_morph.h",
177    "src/render/node/render_node_morph.cpp",
178
179    "src/render/datastore/render_data_store_default_camera.h",
180    "src/render/datastore/render_data_store_default_camera.cpp",
181    "src/render/datastore/render_data_store_default_light.h",
182    "src/render/datastore/render_data_store_default_light.cpp",
183    "src/render/datastore/render_data_store_default_material.h",
184    "src/render/datastore/render_data_store_default_material.cpp",
185    "src/render/datastore/render_data_store_default_scene.h",
186    "src/render/datastore/render_data_store_default_scene.cpp",
187    "src/render/datastore/render_data_store_morph.h",
188    "src/render/datastore/render_data_store_morph.cpp",
189
190    "src/util/component_util_functions.h",
191    "src/util/linear_allocator.h",
192    "src/util/mesh_builder.h",
193    "src/util/mesh_builder.cpp",
194    "src/util/mesh_util.h",
195    "src/util/mesh_util.cpp",
196    "src/util/picking.h",
197    "src/util/picking.cpp",
198    "src/util/render_util.h",
199    "src/util/render_util.cpp",
200    "src/util/scene_util.h",
201    "src/util/scene_util.cpp",
202    "src/util/string_util.h",
203    "src/util/uri_lookup.cpp",
204    "src/util/uri_lookup.h",
205  ]
206
207  external_deps = [
208    "c_utils:utils",
209  ]
210  part_name = "graphic_3d"
211  subsystem_name = "graphic"
212}
213
214lume_compile_shader("lume_3d_compile_shader")
215{
216  script = "${LUME_CORE_PATH}/tools/CompilerShader.sh"
217  outputs = [ "$target_gen_dir" ]
218  tool_path = "$target_gen_dir"
219  dest_gen_path = "$target_gen_dir/assets"
220  asset_path = rebase_path("./assets/3d", root_build_dir)
221  shader_path = "${dest_gen_path}/shaders"
222  include_path = rebase_path("api", root_build_dir)
223  render_include_path = "${LUME_PATH}/${RENDER_DIR_NAME}/api/"
224  compileShader_deps=["${LUME_BINARY_PATH}/LumeShaderCompiler:lume_binary_shader_compile"]
225}
226
227lume_rofs("lume_3d_rofs")
228{
229  output_obj= ""
230  if (target_cpu == "arm") {
231    output_obj = "${CORE3D_ROFS}_32.o"
232  }
233
234  if (target_cpu == "arm64") {
235    output_obj = "${CORE3D_ROFS}_64.o"
236  }
237
238  outputs = "${target_gen_dir}/assets/${output_obj}"
239
240  tool_path = "$target_gen_dir"
241  root = "/"
242  bin_name = "BINARY_DATA_FOR_3D"
243  size_name = "SIZE_OF_DATA_FOR_3D"
244  base_name = CORE3D_ROFS
245  script = "${LUME_CORE_PATH}/tools/CompilerAsset.sh"
246  copy_path = "$target_gen_dir/assets"
247  compileShader_deps = [
248    ":lume_3d_compile_shader",
249    "${LUME_BINARY_PATH}/lumeassetcompiler:lume_binary_assets_compile"
250    ]
251  file_extension = "\".spv;.json;.lsb;.shader;.shadergs;.shadervid;.shaderpl;.rng;.gl;.gles\""
252}
253
254source_set("lume_3d_rofs_obj") {
255  output_obj = ""
256  if (target_cpu == "arm") {
257    output_obj = "${CORE3D_ROFS}_32.o"
258  }
259
260  if (target_cpu == "arm64") {
261    output_obj = "${CORE3D_ROFS}_64.o"
262  }
263
264  sources = [
265    "${target_gen_dir}/assets/${output_obj}"
266  ]
267  deps = [
268    ":lume_3d_rofs"
269  ]
270}
271
272ohos_static_library("libAGP3D") {
273  public_deps = [
274    ":lume_3d_src",
275  ]
276
277  if (CORE3D_EMBEDDED_ASSETS_ENABLED) {
278    deps = [
279      ":lume_3d_rofs_obj"
280    ]
281  }
282
283  part_name = "graphic_3d"
284  subsystem_name = "graphic"
285}
286