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("//build/ohos/ace/ace.gni")
16import("//foundation/graphic/graphic_3d/lume/lume_config.gni")
17
18config("lume3d_config") {
19  visibility = [ ":*" ]
20
21  include_dirs = [
22    "${LUME_BASE_PATH}/api",
23    "${LUME_CORE_PATH}/api",
24    "${LUME_RENDER_PATH}/api",
25    "${LUME_CORE3D_PATH}/api",
26  ]
27
28  if (current_os == "ohos") {
29    include_dirs += [ "${LUME_CORE_PATH}/api/platform/ohos" ]
30  }
31
32  configs = []
33
34  cflags = [
35    "-Wall",
36    "-fexceptions",
37    "-Wno-sign-compare",
38    "-Wno-unused-variable",
39    "-Wno-unused-private-field",
40    "-Wno-implicit-fallthrough",
41    "-Wno-reorder",
42    "-Wno-unused-function",
43    "-Wno-tautological-unsigned-zero-compare",
44    "-Wno-ignored-qualifiers",
45    "-Wno-unused-lambda-capture",
46    "-Wno-unused-but-set-variable",
47
48    "-DCORE_PUBLIC=__attribute__((visibility(\"default\")))",
49    "-DCORE_BUILD_2D = 0",
50    "-DCORE_BUILD_VULKAN=0",
51    "-DCORE_BUILD_GL=0",
52    "-DCORE_BUILD_GLES=1",
53    "-DCORE_DEV_ENABLED=0",
54    "-DCORE_TESTS_ENABLED=0",
55    "-DCORE_GL_DEBUG=0",
56    "-DCORE_VALIDATION_ENABLED = 0",
57    "-DCORE_VULKAN_VALIDATION_ENABLED = 0",
58    "-DCORE_EMBEDDED_ASSETS_ENABLED = 2",
59    "-DCORE_ENABLE_GPU_QUERIES=0",
60    "-DCORE_DEBUG_GPU_RESOURCE_IDS = 0",
61    "-DCORE_DEBUG_COMMAND_MARKERS_ENABLED = 0",
62    "-DCORE_DEBUG_MARKERS_ENABLED = 0",
63    "-DRENDER_HAS_GL_BACKEND=0",
64    "-DRENDER_HAS_GLES_BACKEND = 1",
65    "-DRENDER_HAS_VULKAN_BACKEND = 1",
66    "-DVK_USE_PLATFORM_ANDROID_KHR = 1",
67    "-DCORE_LOG_NO_DEBUG=0",
68    "-DCORE_LOG_TO_DEBUG_OUTPUT=1",
69    "-DCORE_LOG_TO_CONSOLE",
70    "-DCORE_LOG_DISABLED=0",
71    "-DCORE_DYNAMIC=1",
72  ]
73}
74
75config("scene_adapter_config") {
76  defines = []
77
78  include_dirs = [ "include" ]
79  if (KIT_3D_ENABLE) {
80    defines = [ "KIT_3D_ENABLE=$KIT_3D_ENABLE" ]
81  }
82}
83
84group("sceneAdapterInterface") {
85  public_configs = [ ":scene_adapter_config" ]
86}
87
88ohos_source_set("scene_adapter_source") {
89  sources = [
90    "src/scene_adapter.cpp",
91    "src/scene_bridge.cpp",
92  ]
93
94  include_dirs = [
95    "include",
96    "../3d_widget_adapter/core/include",
97    "../lume/metaobject/include",
98    "../lume/scenewidgetplugin/plugin/include",
99  ]
100
101  defines = [
102    "CORE_HAS_GLES_BACKEND=1",
103    "CORE_HAS_VULKAN_BACKEND=1",
104  ]
105
106  configs = [
107    ":lume3d_config",
108    "../3d_widget_adapter:widget_adapter_config",
109  ]
110  external_deps = [
111    "ability_runtime:ability_manager",
112    "ability_runtime:app_context",
113    "ability_runtime:data_ability_helper",
114    "ability_runtime:napi_base_context",
115    "ability_runtime:napi_common",
116    "bundle_framework:appexecfwk_base",
117    "bundle_framework:appexecfwk_core",
118    "c_utils:utils",
119    "graphic_2d:librender_service_client",
120    "hilog:libhilog",
121    "hitrace:hitrace_meter",
122    "init:libbegetutil",
123    "napi:ace_napi",
124  ]
125
126  defines += [ "LIB_ENGINE_CORE=${LIB_ENGINE_CORE}.z" ]
127
128  if (target_cpu == "arm") {
129    defines += [
130      "PLATFORM_CORE_ROOT_PATH=/system/lib/",
131      "PLATFORM_APP_ROOT_PATH=/system/lib/",
132      "PLATFORM_APP_PLUGIN_PATH=/system/lib/",
133    ]
134  }
135
136  if (target_cpu == "arm64") {
137    defines += [
138      "PLATFORM_CORE_ROOT_PATH=/system/lib64/",
139      "PLATFORM_APP_ROOT_PATH=/system/lib64/",
140      "PLATFORM_APP_PLUGIN_PATH=/system/lib64/",
141    ]
142  }
143
144  deps = [ "../kits/js:napiInterface" ]
145
146  part_name = "graphic_3d"
147  subsystem_name = "graphic"
148}
149
150ohos_static_library("scene_adapter_static") {
151  deps = [ ":scene_adapter_source" ]
152  public_configs = [
153    ":scene_adapter_config",
154    ":lume3d_config",
155  ]
156
157  part_name = "graphic_3d"
158  subsystem_name = "graphic"
159}
160