Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / sdch / BUILD.gn
blob4c6c5205cb067f0b953c42e4b6c6a24b46795c2f
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.
5 config("sdch_config") {
6   include_dirs = [ "open-vcdiff/src" ]
9 # gn orders flags on a target before flags from configs. The default config
10 # adds -Wall, and these flags have to be after -Wall -- so they need to come
11 # from a config and can't be on the target directly.
12 config("sdch_warnings") {
13   cflags = []
14   if (is_linux) {
15     # TODO(mostynb): remove this if open-vcdiff is ever updated for c++11:
16     cflags += [ "-Wno-deprecated-declarations" ]
17   }
20 static_library("sdch") {
21   sources = [
22     "logging_forward.h",
23     "open-vcdiff/src/addrcache.cc",
24     "open-vcdiff/src/blockhash.cc",
25     "open-vcdiff/src/blockhash.h",
26     "open-vcdiff/src/checksum.h",
27     "open-vcdiff/src/codetable.cc",
28     "open-vcdiff/src/codetable.h",
29     "open-vcdiff/src/compile_assert.h",
30     "open-vcdiff/src/decodetable.cc",
31     "open-vcdiff/src/decodetable.h",
32     "open-vcdiff/src/encodetable.cc",
33     "open-vcdiff/src/encodetable.h",
34     "open-vcdiff/src/google/output_string.h",
35     "open-vcdiff/src/google/vcdecoder.h",
36     "open-vcdiff/src/google/vcencoder.h",
37     "open-vcdiff/src/headerparser.cc",
38     "open-vcdiff/src/headerparser.h",
39     "open-vcdiff/src/instruction_map.cc",
40     "open-vcdiff/src/instruction_map.h",
41     "open-vcdiff/src/jsonwriter.cc",
42     "open-vcdiff/src/jsonwriter.h",
43     "open-vcdiff/src/rolling_hash.h",
44     "open-vcdiff/src/testing.h",
45     "open-vcdiff/src/varint_bigendian.cc",
46     "open-vcdiff/src/varint_bigendian.h",
47     "open-vcdiff/src/vcdecoder.cc",
48     "open-vcdiff/src/vcdiff_defs.h",
49     "open-vcdiff/src/vcdiffengine.cc",
50     "open-vcdiff/src/vcdiffengine.h",
51     "open-vcdiff/src/vcencoder.cc",
52     "open-vcdiff/vsprojects/config.h",
53     "open-vcdiff/vsprojects/stdint.h",
54   ]
56   configs += [ ":sdch_warnings" ]
57   public_configs = [ ":sdch_config" ]
59   deps = [
60     "//base",
61     "//third_party/zlib",
62   ]
64   if (is_linux || is_android) {
65     include_dirs = [ "linux" ]
66   } else if (is_ios) {
67     include_dirs = [ "ios" ]
68   } else if (is_mac) {
69     include_dirs = [ "mac" ]
70     defines = [ "OPEN_VCDIFF_USE_AUTO_PTR" ]
71   } else if (is_win) {
72     include_dirs = [ "win" ]
73   }
75   # open-vcdiff's logging.h introduces static initializers. This was
76   # reported upstream years ago (
77   # https://github.com/google/open-vcdiff/issues/33 ). Since
78   # upstream won't fix this, work around it on the chromium side:
79   # Inject a header that forwards to base/logging.h instead (which doesn't
80   # introduce static initializers, and which prevents open-vcdiff's
81   # logging.h from being used).
82   if (is_win) {
83     cflags = [
84       "/FI",
85       "sdch/logging_forward.h",
86     ]
87   } else {
88     logging_file = rebase_path("logging_forward.h", root_build_dir)
89     cflags = [
90       "-include",
91       logging_file,
92     ]
93   }