• 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_3d/lume/lume_config.gni")
16
17declare_args() {
18  DOTFIELD_EMBEDDED_ASSETS_ENABLED = true
19  DOTFIELD_ROFS = "rofsDotfield"
20}
21
22config("lume_dotfield_api") {
23  include_dirs = [
24    "api",
25    "assets",
26    "${LUME_CORE3D_PATH}/api"
27  ]
28
29  defines = []
30}
31
32config("lume_dotfield_config") {
33  include_dirs = [
34    "src/",
35  ]
36
37  defines = [ "CORE_PLUGIN=1" ]
38
39  if (DOTFIELD_EMBEDDED_ASSETS_ENABLED) {
40    defines += [ "DOTFIELD_EMBEDDED_ASSETS_ENABLED=1" ]
41  }
42
43  ldflags = [
44    "-Wl,--exclude-libs,ALL",
45  ]
46
47  cflags = [
48    "-Wno-unused-function",
49    "-Wno-unused-parameter",
50    "-Wno-sign-compare",
51    "-Wno-unused-variable",
52    "-Wno-unused-private-field",
53    "-Wno-tautological-unsigned-zero-compare",
54    "-Wno-logical-op-parentheses",
55    "-Wno-unused-local-typedef",
56    "-fvisibility=hidden",
57    "-ffunction-sections",
58    "-fdata-sections",
59    "-Wno-ignored-qualifiers",
60  ]
61  cflags_cc = [
62    "-std=c++17",
63    "-Wno-overloaded-virtual",
64    "-Wno-thread-safety-attributes",
65    "-Wno-missing-braces",
66  ]
67}
68
69ohos_source_set("lume_dotfield_src") {
70  public_configs = [
71    ":lume_dotfield_api",
72    ":lume_dotfield_config",
73    "${LUME_CORE3D_PATH}:lume_3d_api",
74    "${LUME_RENDER_PATH}:lume_render_api",
75    "${LUME_CORE_PATH}:lume_base_api",
76    "${LUME_CORE_PATH}:lume_engine_api",
77    "${LUME_CORE_PATH}:lume_component_help_config",
78    "${LUME_CORE_PATH}:lume_default",
79  ]
80
81  sources = [
82    "src/component_dll.cpp",
83    "src/components/dotfield_component.cpp",
84    "src/render/render_data_store_default_dotfield.cpp",
85    "src/render/render_data_store_default_dotfield.h",
86    "src/render/render_node_dotfield_simulation.cpp",
87    "src/render/render_node_dotfield_simulation.h",
88    "src/systems/dotfield_system.cpp",
89    # "version.cpp",
90  ]
91
92  deps = [
93    "${LUME_CORE_PATH}/DLL:libAGPDLL",
94    "${LUME_RENDER_PATH}:libPluginAGPRender",
95    "${LUME_CORE3D_PATH}/DLL:libPluginAGP3D",
96  ]
97
98  external_deps = [
99    "c_utils:utils",
100    "hilog:libhilog",
101  ]
102  part_name = "graphic_3d"
103  subsystem_name = "graphic"
104}
105
106lume_compile_shader("lume_dotfield_compile_shader") {
107  script = "${LUME_CORE_PATH}/tools/CompilerShader.sh"
108  outputs = [ "$target_gen_dir" ]
109  tool_path = "$target_gen_dir/../LumeBinaryCompile/LumeShaderCompiler"
110  dest_gen_path = "$target_gen_dir/assets"
111  asset_path = rebase_path("./assets/app", root_build_dir)
112  shader_path = "${dest_gen_path}/shaders"
113  include_path = rebase_path("api", root_build_dir)
114  render_include_path = "${LUME_PATH}/${CORE3D_DIR_NAME}/api/"
115  compileShader_deps =
116      [ "${LUME_BINARY_PATH}/LumeShaderCompiler:lume_binary_shader_compile" ]
117  if (ohos_indep_compiler_enable) {
118    tool_path = "//prebuilts/graphics_3d/AGPBinaryCompile"
119    compileShader_deps -= [
120      "${LUME_BINARY_PATH}/LumeShaderCompiler:lume_binary_shader_compile",
121    ]
122  }
123}
124
125lume_rofs("lume_dotfield_rofs") {
126  output_obj = ""
127  if (target_cpu == "arm") {
128    output_obj = "${DOTFIELD_ROFS}_32.o"
129  }
130
131  if (target_cpu == "arm64") {
132    output_obj = "${DOTFIELD_ROFS}_64.o"
133  }
134
135  if (target_cpu == "x86") {
136    output_obj = "${DOTFIELD_ROFS}_x32.o"
137  }
138
139  if (target_cpu == "x64") {
140    output_obj = "${DOTFIELD_ROFS}_x64.o"
141  }
142
143  outputs = "${target_gen_dir}/assets/${output_obj}"
144
145  tool_path = "$target_gen_dir/../LumeBinaryCompile/lumeassetcompiler"
146  root = "/"
147  bin_name = "DOTFIELD_BIN"
148  size_name = "DOTFIELD_BIN_SIZE"
149  base_name = DOTFIELD_ROFS
150  script = "${LUME_CORE_PATH}/tools/CompilerAsset.sh"
151  copy_path = "$target_gen_dir/assets"
152  compileShader_deps = [
153    ":lume_dotfield_compile_shader",
154    "${LUME_BINARY_PATH}/lumeassetcompiler:lume_binary_assets_compile",
155  ]
156  if (ohos_indep_compiler_enable) {
157    tool_path = "//prebuilts/graphics_3d/AGPBinaryCompile/"
158    compileShader_deps -= [
159      "${LUME_BINARY_PATH}/lumeassetcompiler:lume_binary_assets_compile",
160    ]
161  }
162  file_extension = "\".spv;.json;.lsb;.shader;.shadergs;.shadervid;.shaderpl;.rng;.gl;.gles\""
163}
164
165source_set("lume_dotfield_rofs_obj") {
166  output_obj = ""
167  if (target_cpu == "arm") {
168    output_obj = "${DOTFIELD_ROFS}_32.o"
169  }
170
171  if (target_cpu == "arm64") {
172    output_obj = "${DOTFIELD_ROFS}_64.o"
173  }
174
175  if (target_cpu == "x86") {
176    output_obj = "${DOTFIELD_ROFS}_x32.o"
177  }
178
179  if (target_cpu == "x64") {
180    output_obj = "${DOTFIELD_ROFS}_x64.o"
181  }
182
183  sources = [ "${target_gen_dir}/assets/${output_obj}" ]
184  deps = [ ":lume_dotfield_rofs" ]
185}
186
187ohos_static_library("libDotfield") {
188  public_deps = [ ":lume_dotfield_src" ]
189
190  if (DOTFIELD_EMBEDDED_ASSETS_ENABLED) {
191    deps = [ ":lume_dotfield_rofs_obj" ]
192  }
193
194  part_name = "graphic_3d"
195  subsystem_name = "graphic"
196}
197
198config("lume_dotfield_plugin_config") {
199  defines = [
200    "CORE_PLUGIN=1"
201  ]
202}
203
204ohos_source_set("lume_dotfield_src_plugin") {
205  sources = [
206  ]
207
208  configs = [
209    ":lume_dotfield_plugin_config",
210    ":lume_dotfield_api",
211    "${LUME_CORE3D_PATH}:lume_3d_api",
212    "${LUME_RENDER_PATH}:lume_render_api",
213    "${LUME_CORE_PATH}:lume_base_api",
214    "${LUME_CORE_PATH}:lume_engine_api",
215    "${LUME_CORE_PATH}:lume_component_help_config",
216    "${LUME_CORE_PATH}:lume_default",
217  ]
218}
219
220ohos_shared_library("libPluginDotfield") {
221  public_deps = [
222    ":libDotfield",
223    ":lume_dotfield_src_plugin"
224  ]
225
226  relative_install_dir = "graphics3d"
227  part_name = "graphic_3d"
228  subsystem_name = "graphic"
229}
230