1# Copyright (c) 2020 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# http://www.apache.org/licenses/LICENSE-2.0 6# Unless required by applicable law or agreed to in writing, software 7# distributed under the License is distributed on an "AS IS" BASIS, 8# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9# See the License for the specific language governing permissions and 10# limitations under the License. 11 12if (defined(ohos_lite)) { 13 import("//build/lite/config/component/lite_component.gni") 14} else { 15 import("//build/ohos.gni") 16} 17config("freetype_config") { 18 defines = [ "FT2_BUILD_LIBRARY" ] 19 include_dirs = [ "include" ] 20} 21 22freetype_sources = [ 23 "src\autofit\autofit.c", 24 "src\base\ftbase.c", 25 "src\base\ftbbox.c", 26 "src\base\ftbdf.c", 27 "src\base\ftbitmap.c", 28 "src\base\ftcid.c", 29 "src\base\ftdebug.c", 30 "src\base\ftfstype.c", 31 "src\base\ftgasp.c", 32 "src\base\ftglyph.c", 33 "src\base\ftgxval.c", 34 "src\base\ftinit.c", 35 "src\base\ftmm.c", 36 "src\base\ftotval.c", 37 "src\base\ftpatent.c", 38 "src\base\ftpfr.c", 39 "src\base\ftstroke.c", 40 "src\base\ftsynth.c", 41 "src\base\ftsystem.c", 42 "src\base\fttype1.c", 43 "src\base\ftwinfnt.c", 44 "src\bdf\bdf.c", 45 "src\cache\ftcache.c", 46 "src\cff\cff.c", 47 "src\cid\type1cid.c", 48 "src\gzip\ftgzip.c", 49 "src\lzw\ftlzw.c", 50 "src\pcf\pcf.c", 51 "src\pfr\pfr.c", 52 "src\psaux\psaux.c", 53 "src\pshinter\pshinter.c", 54 "src\psnames\psmodule.c", 55 "src\raster\raster.c", 56 "src\sdf\ftbsdf.c", 57 "src\sdf\ftsdf.c", 58 "src\sdf\ftsdfcommon.c", 59 "src\sdf\ftsdfrend.c", 60 "src\sfnt\sfnt.c", 61 "src\smooth\smooth.c", 62 "src\svg\ftsvg.c", 63 "src\truetype\truetype.c", 64 "src\type1\type1.c", 65 "src\type42\type42.c", 66 "src\winfonts\winfnt.c", 67] 68 69if (defined(ohos_lite)) { 70 lite_library("freetype") { 71 if (ohos_kernel_type == "liteos_m") { 72 target_type = "static_library" 73 } else { 74 target_type = "shared_library" 75 } 76 77 deps = [ "//third_party/libpng:libpng" ] 78 sources = freetype_sources 79 include_dirs = [ 80 "src/base", 81 "//third_party/libpng", 82 ] 83 84 public_configs = [ ":freetype_config" ] 85 defines = [ "FT_CONFIG_OPTION_USE_PNG" ] 86 87 if (target_type == "static_library") { 88 deps += [ "//build/lite/config/component/zlib:zlib_static" ] 89 defines += [ "FT_CONFIG_OPTION_SYSTEM_ZLIB" ] 90 } 91 92 if (defined(board_toolchain_type) && board_toolchain_type == "iccarm") { 93 cflags = [ 94 "--diag_suppress", 95 "Pa082,Pa084,Pa128,Pe128,Pa134,Pa137,Pe550", 96 ] 97 cflags_cc = cflags 98 } 99 } 100 101 lite_component("freetype_shared") { 102 features = [ ":freetype" ] 103 } 104} else { 105 ohos_static_library("freetype_static") { 106 sources = freetype_sources 107 include_dirs = [ "src\base" ] 108 public_configs = [ ":freetype_config" ] 109 deps = [ "//third_party/zlib:libz" ] 110 defines = [ "FT_CONFIG_OPTION_SYSTEM_ZLIB" ] 111 } 112} 113