• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2025 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("dependency_inputs.gni")
16
17SUBSYSTEM_NAME="thirdparty"
18PART_NAME="mesa3d"
19
20action("mesa3d_action_build") {
21  print("mesa3d_action_build")
22  script = "//third_party/mesa3d/ohos/build_ohos64.py"
23  inputs = deps_inputs
24  outputs = [
25    "${root_build_dir}/thirdparty/mesa3d/lib/libEGL_mesa.so",
26    "${root_build_dir}/thirdparty/mesa3d/lib/libgallium-25.0.1.so",
27  ]
28  ohos_root_path = rebase_path("//")
29  product_name = rebase_path("${root_build_dir}", "//out")
30  mesa3d_source_path = rebase_path("//third_party/mesa3d", root_build_dir)
31
32  if (is_asan) {
33    if (use_hwasan) {
34      asan_option = "hwasan"
35    } else {
36      asan_option = "swasan"
37    }
38  } else {
39    asan_option = "noasan"
40  }
41
42  if (use_clang_coverage) {
43    coverage_option = "use_clang_coverage"
44  } else {
45    coverage_option = "no_coverage"
46  }
47  if (mesa3d_feature_upgrade_skia) {
48    skia_version = "new_skia"
49  } else {
50    skia_version = "skia"
51  }
52  args = [
53    "$ohos_root_path",
54    "$product_name",
55    "$mesa3d_source_path",
56    "$asan_option",
57    "$coverage_option",
58    "$skia_version"
59  ]
60  external_deps = [
61    "hilog:libhilog",
62    "hitrace:hitrace_meter",
63    "init:libbegetutil",
64    "graphic_surface:surface",
65    "zlib:libz",
66  ]
67  if (mesa3d_feature_upgrade_skia) {
68    external_deps += [ "skia:expatm133", ]
69  } else {
70    external_deps += [ "skia:expat", ]
71  }
72}
73
74ohos_copy("mesa3d_unstripped_copy") {
75  sources = [
76    "${root_build_dir}/thirdparty/mesa3d/lib/libEGL_mesa.so",
77    "${root_build_dir}/thirdparty/mesa3d/lib/libgallium-25.0.1.so",
78  ]
79  outputs = [ root_out_dir + "/lib.unstripped/thirdparty/mesa3d/{{source_file_part}}" ]
80  deps = [ ":mesa3d_action_build" ]
81}
82
83ohos_prebuilt_shared_library("mesa3d_libEGL") {
84  source = "${root_build_dir}/thirdparty/mesa3d/lib/libEGL_mesa.so"
85  subsystem_name = "$SUBSYSTEM_NAME"
86  part_name = "$PART_NAME"
87  module_install_dir = "lib64"
88  install_enable = true
89  enable_strip = true
90  mini_debug = true
91  deps = [
92    ":mesa3d_action_build",
93    ":mesa3d_unstripped_copy"
94  ]
95}
96
97ohos_prebuilt_shared_library("mesa3d_libgallium") {
98  source = "${root_build_dir}/thirdparty/mesa3d/lib/libgallium-25.0.1.so"
99  subsystem_name = "$SUBSYSTEM_NAME"
100  part_name = "$PART_NAME"
101  module_install_dir = "lib64"
102  install_enable = true
103  enable_strip = true
104  mini_debug = true
105  deps = [
106    ":mesa3d_action_build",
107    ":mesa3d_unstripped_copy"
108  ]
109}
110
111group("zink_opengl") {
112  deps = [
113    ":mesa3d_libEGL",
114    ":mesa3d_libgallium",
115  ]
116}
117