• 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    MULTI_ECS_UPDATE_AT_ONCE="0"
19    UNIFY_RENDER="1"
20    DBG_DRAW_PIXEL="0"
21    WIDGET_TRACE_ENABLE="1"
22}
23
24config("lume3d_config") {
25  visibility = [ ":*" ]
26
27  include_dirs = [
28    "${LUME_BASE_PATH}/api",
29    "${LUME_CORE_PATH}/api",
30    "${LUME_RENDER_PATH}/api",
31    "${LUME_CORE3D_PATH}/api",
32  ]
33
34  if (current_os == "ohos" ) {
35    include_dirs += [
36      "${LUME_CORE_PATH}/api/platform/ohos",
37    ]
38  }
39
40  configs = [
41  ]
42
43  cflags = [
44    "-Wall",
45    "-fexceptions",
46    "-Wno-sign-compare",
47    "-Wno-unused-variable",
48    "-Wno-unused-private-field",
49    "-Wno-implicit-fallthrough",
50    "-Wno-reorder",
51    "-Wno-unused-function",
52    "-Wno-tautological-unsigned-zero-compare",
53
54    "-DCORE_PUBLIC=__attribute__((visibility(\"default\")))",
55    "-DCORE_BUILD_2D = 0",
56    "-DCORE_BUILD_VULKAN=0",
57    "-DCORE_BUILD_GL=0",
58    "-DCORE_BUILD_GLES=1",
59    "-DCORE_DEV_ENABLED=0",
60    "-DCORE_TESTS_ENABLED=0",
61    "-DCORE_GL_DEBUG=0",
62    "-DCORE_VALIDATION_ENABLED = 0",
63    "-DCORE_VULKAN_VALIDATION_ENABLED = 0",
64    "-DCORE_EMBEDDED_ASSETS_ENABLED = 2",
65    "-DCORE_ENABLE_GPU_QUERIES=0",
66    "-DCORE_DEBUG_GPU_RESOURCE_IDS = 0",
67    "-DCORE_DEBUG_COMMAND_MARKERS_ENABLED = 0",
68    "-DCORE_DEBUG_MARKERS_ENABLED = 0",
69    "-DRENDER_HAS_GL_BACKEND=0",
70    "-DRENDER_HAS_GLES_BACKEND = 1",
71    "-DRENDER_HAS_VULKAN_BACKEND = 0",
72    "-DVK_USE_PLATFORM_ANDROID_KHR = 1",
73    "-DCORE_LOG_NO_DEBUG=0",
74    "-DCORE_LOG_TO_DEBUG_OUTPUT=1",
75    "-DCORE_LOG_TO_CONSOLE",
76    "-DCORE_LOG_DISABLED=0",
77    "-DCORE_DYNAMIC=1",
78  ]
79
80}
81
82config("widget_adapter_config") {
83    defines = [
84      "MULTI_ECS_UPDATE_AT_ONCE=${MULTI_ECS_UPDATE_AT_ONCE}",
85      "EGL_EGLEXT_PROTOTYPES",
86      "GL_GLEXT_PROTOTYPES",
87      "UNIFY_RENDER=${UNIFY_RENDER}",
88      "WIDGET_TRACE_ENABLE=${WIDGET_TRACE_ENABLE}",
89      "DBG_DRAW_PIXEL=${DBG_DRAW_PIXEL}"
90    ]
91
92    if (current_os == "ohos" ) {
93        defines += [
94          "__OHOS_PLATFORM__"
95        ]
96    }
97
98    include_dirs = [
99        "include",
100    ]
101
102    if (current_os == "ohos" ) {
103        include_dirs += [
104            "include/ohos",
105        ]
106    }
107
108    if (MULTI_ECS_UPDATE_AT_ONCE == "1") {
109        cflags_cc += [
110          "-Wno-user-defined-warnings"
111        ]
112    }
113}
114
115ohos_source_set("widget_adapter_source") {
116    sources = [
117        "src/widget_adapter.cpp",
118        "src/graphics_manager_common.cpp",
119        "src/offscreen_context_helper.cpp",
120        "src/graphics_task.cpp",
121        "core/src/lume/lume_common.cpp",
122        "core/src/engine_factory.cpp",
123        "core/src/lume/custom/lume_custom_render.cpp",
124        "core/src/lume/custom/shader_input_buffer.cpp",
125    ]
126
127    include_dirs = [
128        "core/include",
129        "core/include/lume",
130        "//foundation/graphic/graphic_2d/rosen/modules/"
131    ]
132
133    defines = [
134      "CORE_HAS_GLES_BACKEND=1"
135    ]
136
137    configs = [
138      ":widget_adapter_config",
139      ":lume3d_config",
140    ]
141
142    public_configs = [
143      ":widget_adapter_config",
144    ]
145
146    if (defined(use_new_skia) && use_new_skia) {
147      deps = [
148        "//third_party/skia:skia_ohos",
149      ]
150    } else {
151      deps = [
152        "$ace_flutter_engine_root/skia:ace_skia_ohos",
153      ]
154    }
155    if (defined(use_rosen_drawing) && use_rosen_drawing) {
156      defines += [ "USE_ROSEN_DRAWING" ]
157    }
158
159    if (current_os == "ohos" ) {
160      sources += [
161        "core/src/lume/ohos/lume.cpp",
162        "src/ohos/graphics_manager.cpp",
163        "src/ohos/texture_layer.cpp",
164      ]
165
166      include_dirs += [
167        "core/include/ohos",
168        "core/include/lume/ohos",
169      ]
170
171      external_deps = [
172        "graphic_2d:libgl",
173        "c_utils:utils",
174        "graphic_2d:librender_service_client",
175        "graphic_2d:surface",
176        "hilog:libhilog",
177        "hitrace:hitrace_meter",
178      ]
179
180      defines += [
181        "LIB_ENGINE_CORE=${LIB_ENGINE_CORE}.z",
182      ]
183
184      if (target_cpu == "arm") {
185        defines += [
186          "PLATFORM_CORE_ROOT_PATH=/system/lib/",
187          "PLATFORM_APP_ROOT_PATH=/system/lib/",
188          "PLATFORM_APP_PLUGIN_PATH=/system/lib/",
189        ]
190      }
191
192      if (target_cpu == "arm64") {
193        defines += [
194          "PLATFORM_CORE_ROOT_PATH=/system/lib64/",
195          "PLATFORM_APP_ROOT_PATH=/system/lib64/",
196          "PLATFORM_APP_PLUGIN_PATH=/system/lib64/",
197        ]
198      }
199    }
200
201    if (current_os == "android" ) {
202      sources += [
203        "core/src/lume/android/lume.cpp",
204        "src/android/graphics_manager.cpp",
205        "src/android/skia_texture.cpp",
206        "src/android/texture_layer.cpp",
207      ]
208
209
210      include_dirs += [
211        "core/include/android",
212        "core/include/lume/android",
213      ]
214
215      aosp_deps = [
216        "shared_library:libEGL",
217        "shared_library:libGLESv2",
218        "shared_library:libandroid",
219      ]
220
221      deps += [
222        "$ace_flutter_engine_root:third_party_flutter_engine_android",
223      ]
224      defines += [
225        "LIB_ENGINE_CORE=${LIB_ENGINE_CORE}",
226      ]
227    }
228
229    part_name = "graphic_3d"
230    subsystem_name = "graphic"
231}
232
233group("3dWidgetAdapterInterface") {
234    public_configs = [ ":widget_adapter_config" ]
235}
236
237ohos_shared_library("lib3dWidgetAdapter") {
238    deps = [
239      ":widget_adapter_source",
240    ]
241    public_configs = [":widget_adapter_config"]
242    part_name = "graphic_3d"
243    subsystem_name = "graphic"
244}
245