• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
2
3import("//build/ohos.gni")
4
5action("libpng_action") {
6  script = "//third_party/libpng/install.py"
7  outputs = [
8    "${target_gen_dir}/libpng-1.6.38/png.c",
9    "${target_gen_dir}/libpng-1.6.38/pngerror.c",
10    "${target_gen_dir}/libpng-1.6.38/pngget.c",
11    "${target_gen_dir}/libpng-1.6.38/pngmem.c",
12    "${target_gen_dir}/libpng-1.6.38/pngpread.c",
13    "${target_gen_dir}/libpng-1.6.38/pngread.c",
14    "${target_gen_dir}/libpng-1.6.38/pngrio.c",
15    "${target_gen_dir}/libpng-1.6.38/pngrtran.c",
16    "${target_gen_dir}/libpng-1.6.38/pngrutil.c",
17    "${target_gen_dir}/libpng-1.6.38/pngset.c",
18    "${target_gen_dir}/libpng-1.6.38/pngtrans.c",
19    "${target_gen_dir}/libpng-1.6.38/pngwio.c",
20    "${target_gen_dir}/libpng-1.6.38/pngwrite.c",
21    "${target_gen_dir}/libpng-1.6.38/pngwtran.c",
22    "${target_gen_dir}/libpng-1.6.38/pngwutil.c",
23    "${target_gen_dir}/libpng-1.6.38/arm/arm_init.c",
24    "${target_gen_dir}/libpng-1.6.38/arm/filter_neon_intrinsics.c",
25    "${target_gen_dir}/libpng-1.6.38/arm/palette_neon_intrinsics.c",
26  ]
27
28  inputs = [ "//third_party/libpng/libpng-1.6.38.tar.gz" ]
29  libpng_path = rebase_path("${target_gen_dir}", root_build_dir)
30  libpng_source_path = rebase_path("//third_party/libpng", root_build_dir)
31  args = [
32    "--gen-dir",
33    "$libpng_path",
34    "--source-dir",
35    "$libpng_source_path",
36  ]
37}
38
39if (defined(ohos_lite)) {
40  import("//build/lite/config/component/lite_component.gni")
41
42  config("libpng_config") {
43    include_dirs = [ "${target_gen_dir}/libpng-1.6.38/" ]
44  }
45
46  libpng_source = get_target_outputs(":libpng_action")
47
48  lite_library("libpng") {
49    if (ohos_kernel_type == "liteos_m") {
50      target_type = "static_library"
51      deps = [ "//build/lite/config/component/zlib:zlib_static" ]
52    } else {
53      target_type = "shared_library"
54      deps = [ "//build/lite/config/component/zlib:zlib_shared" ]
55    }
56    deps += [ ":libpng_action" ]
57    if (defined(board_toolchain_type) && board_toolchain_type == "iccarm") {
58      cflags = [
59        "--diag_suppress",
60        "Pa082,Pa084",
61      ]
62      cflags_cc = cflags
63    }
64    sources = libpng_source
65    public_configs = [ ":libpng_config" ]
66  }
67} else {
68  import("//build/ohos.gni")
69
70  config("libpng_config") {
71    include_dirs = [ "${target_gen_dir}/libpng-1.6.38/" ]
72  }
73
74  config("libpng_wno_config") {
75    cflags = [ "-Wno-implicit-fallthrough" ]
76  }
77
78  ohos_source_set("png_static") {
79    sources = get_target_outputs(":libpng_action")
80    include_dirs = [
81      "${target_gen_dir}/libpng-1.6.38/",
82      "//third_party/zlib",
83    ]
84    deps = [ ":libpng_action" ]
85    public_configs = [ ":libpng_config" ]
86    part_name = "libpng"
87    subsystem_name = "thirdparty"
88  }
89
90  ohos_shared_library("libpng") {
91    deps = [ ":libpng_static" ]
92    public_configs = [ ":libpng_config" ]
93    configs = [ ":libpng_wno_config" ]
94    innerapi_tags = [
95      "platformsdk",
96      "chipsetsdk",
97    ]
98    subsystem_name = "thirdparty"
99    install_images = [
100      "system",
101      "updater",
102    ]
103    part_name = "libpng"
104    output_name = "libpng"
105    install_enable = true
106  }
107
108  ohos_static_library("libpng_static") {
109    sources = get_target_outputs(":libpng_action")
110
111    include_dirs = [
112      "${target_gen_dir}/libpng-1.6.38/",
113      "//third_party/zlib",
114    ]
115    deps = [ "//third_party/zlib:libz" ]
116    deps += [ ":libpng_action" ]
117    public_configs = [ ":libpng_config" ]
118    configs = [ ":libpng_wno_config" ]
119    part_name = "libpng"
120    subsystem_name = "thirdparty"
121  }
122}
123