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
14declare_args() {
15  #BUILDTYPE="Release"
16  #BUILDTYPE="MinSizeRel"
17  #BUILDTYPE="RelWithDebInfo"
18  BUILDTYPE = "Release"
19
20  LUME_PATH = "foundation/graphic/graphic_3d/lume/"
21
22  BASE_DIR_NAME = "LumeBase"
23  CORE_DIR_NAME = "LumeEngine"
24  RENDER_DIR_NAME = "LumeRender"
25  CORE3D_DIR_NAME = "Lume_3D"
26  BINARY_DIR_NAME = "LumeBinaryCompile"
27
28  LUME_OHOS_BUILD = true
29  CORE_DEV_ENABLED = 1
30
31  LIB_ENGINE_CORE = "libAGPDLL"
32  LIB_RENDER = "libPluginAGPRender"
33  LIB_CORE3D = "libPluginAGP3D"
34  LIB_VULKAN_3D = "//third_party/vulkan-loader:vulkan_loader"
35  METAOBJECT_DIR_NAME = "metaobject"
36  SCENEWIDGETPLUGIN_DIR_NAME = "scenewidgetplugin"
37  ECS_HELPER = "ecshelper"
38}
39
40declare_args() {
41  LUME_ROOT = "//${LUME_PATH}"
42}
43
44declare_args() {
45  LUME_BASE_PATH = "${LUME_ROOT}/${BASE_DIR_NAME}/"
46  LUME_CORE_PATH = "${LUME_ROOT}/${CORE_DIR_NAME}/"
47  LUME_RENDER_PATH = "${LUME_ROOT}/${RENDER_DIR_NAME}/"
48  LUME_CORE3D_PATH = "${LUME_ROOT}/${CORE3D_DIR_NAME}/"
49  LUME_BINARY_PATH = "${LUME_ROOT}/${BINARY_DIR_NAME}/"
50  LUME_ECS_HELPER_PATH = "${LUME_ROOT}/${CORE_DIR_NAME}/${ECS_HELPER}/"
51  LUME_METAOBJECT_PATH = "${LUME_ROOT}/${METAOBJECT_DIR_NAME}"
52  LUME_SCP_PATH = "${LUME_ROOT}/${SCENEWIDGETPLUGIN_DIR_NAME}"
53
54  LUME_CORE_DLL_PATH = "${LUME_ROOT}/${CORE_DIR_NAME}/DLL/"
55  LUME_CORE3D_DLL_PATH = "${LUME_ROOT}/${CORE3D_DIR_NAME}/DLL/"
56}
57
58declare_args() {
59  CORE_STATIC_PLUGIN_HEADER =
60      "\"${LUME_PATH}/${CORE_DIR_NAME}/src/static_plugin_decl.h\""
61}
62
63declare_args() {
64  USE_LIB_PNG_JPEG = true
65  USE_STB_IMAGE = false
66  STB_IMAGE_PATH = "//foundation/graphic/graphic_3d/lume/TMP_STB/"
67}
68
69declare_args() {
70  KIT_3D_ENABLE = true
71}
72
73template("lume_rofs") {
74  name = target_name
75  action(name) {
76    outputs = [ invoker.outputs ]
77    script = invoker.script
78    cpu_type = ""
79    output_obj = ""
80    if (target_cpu == "arm") {
81      cpu_type = "armeabi-v7a"
82      output_obj = "${invoker.base_name}_32.o"
83    }
84
85    if (target_cpu == "arm64") {
86      cpu_type = "arm64-v8a"
87      output_obj = "${invoker.base_name}_64.o"
88    }
89
90    args = [
91      rebase_path(invoker.tool_path, root_build_dir),
92      "-${cpu_type}",
93      rebase_path(invoker.copy_path, root_build_dir),
94      invoker.root,
95      invoker.bin_name,
96      invoker.size_name,
97      invoker.base_name,
98      rebase_path(invoker.copy_path, root_build_dir),
99      output_obj,
100      invoker.file_extension,
101    ]
102
103    deps = []
104    if (defined(invoker.compileShader_deps)) {
105      deps += invoker.compileShader_deps
106    }
107  }
108}
109
110template("lume_binary_complile") {
111  name = target_name
112  action(name) {
113    outputs = invoker.outputs
114    script = invoker.script
115    args = [ rebase_path(invoker.dest_gen_path, root_build_dir) ]
116  }
117}
118
119template("lume_compile_shader") {
120  name = target_name
121  action(name) {
122    script = invoker.script
123    outputs = invoker.outputs
124    args = [
125      rebase_path(invoker.dest_gen_path, root_build_dir),
126      invoker.asset_path,
127      rebase_path(invoker.tool_path, root_build_dir),
128      rebase_path(invoker.shader_path, root_build_dir),
129      invoker.include_path,
130    ]
131
132    if (defined(invoker.render_include_path)) {
133      args += [ invoker.render_include_path ]
134    }
135    deps = []
136    if (defined(invoker.compileShader_deps)) {
137      deps += invoker.compileShader_deps
138    }
139  }
140}
141