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