James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 1 | # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | config("libpng_config") { |
James Robinson | 6a64b81 | 2014-12-03 13:38:42 -0800 | [diff] [blame] | 6 | include_dirs = [ "." ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 7 | |
| 8 | defines = [ |
| 9 | "CHROME_PNG_WRITE_SUPPORT", |
| 10 | "PNG_USER_CONFIG", |
| 11 | ] |
| 12 | |
| 13 | if (is_android) { |
| 14 | #'toolsets': ['target', 'host'], |
James Robinson | 6a64b81 | 2014-12-03 13:38:42 -0800 | [diff] [blame] | 15 | defines += [ "CHROME_PNG_READ_PACK_SUPPORT" ] # Required by freetype. |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 16 | } |
| 17 | |
| 18 | if (is_win) { |
| 19 | if (component_mode == "shared_library") { |
| 20 | defines += [ |
| 21 | "PNG_USE_DLL", |
| 22 | "PNG_NO_MODULEDEF", |
| 23 | ] |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | source_set("libpng_sources") { |
James Robinson | 6a64b81 | 2014-12-03 13:38:42 -0800 | [diff] [blame] | 29 | sources = [ |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 30 | "png.c", |
| 31 | "png.h", |
| 32 | "pngconf.h", |
| 33 | "pngerror.c", |
| 34 | "pnggccrd.c", |
| 35 | "pngget.c", |
| 36 | "pngmem.c", |
| 37 | "pngpread.c", |
| 38 | "pngread.c", |
| 39 | "pngrio.c", |
| 40 | "pngrtran.c", |
| 41 | "pngrutil.c", |
| 42 | "pngset.c", |
| 43 | "pngtrans.c", |
| 44 | "pngusr.h", |
| 45 | "pngvcrd.c", |
| 46 | "pngwio.c", |
| 47 | "pngwrite.c", |
| 48 | "pngwtran.c", |
| 49 | "pngwutil.c", |
| 50 | ] |
| 51 | |
| 52 | configs -= [ "//build/config/compiler:chromium_code" ] |
| 53 | configs += [ "//build/config/compiler:no_chromium_code" ] |
| 54 | |
| 55 | if (is_win) { |
| 56 | cflags = [ "/wd4267" ] # TODO(jschuh): http://crbug.com/167187 |
| 57 | |
| 58 | if (component_mode == "shared_library") { |
| 59 | defines = [ "PNG_BUILD_DLL" ] |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | public_configs = [ ":libpng_config" ] |
| 64 | |
James Robinson | 6a64b81 | 2014-12-03 13:38:42 -0800 | [diff] [blame] | 65 | public_deps = [ |
| 66 | "//third_party/zlib", |
| 67 | ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | if (is_win) { |
| 71 | component("libpng") { |
James Robinson | 6a64b81 | 2014-12-03 13:38:42 -0800 | [diff] [blame] | 72 | public_deps = [ |
| 73 | ":libpng_sources", |
| 74 | ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 75 | } |
| 76 | } else { |
| 77 | group("libpng") { |
James Robinson | 6a64b81 | 2014-12-03 13:38:42 -0800 | [diff] [blame] | 78 | public_deps = [ |
| 79 | ":libpng_sources", |
| 80 | ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 81 | } |
| 82 | } |