Fix compilation error triggered with -Werror=sign-compare
[chromium-blink-merge.git] / sdch / BUILD.gn
blob24af3a41da70ca9c6cc516178522fa9c1a155089
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 static_library("sdch") {
10   sources = [
11     "logging_forward.h",
12     "open-vcdiff/src/addrcache.cc",
13     "open-vcdiff/src/blockhash.cc",
14     "open-vcdiff/src/blockhash.h",
15     "open-vcdiff/src/checksum.h",
16     "open-vcdiff/src/codetable.cc",
17     "open-vcdiff/src/codetable.h",
18     "open-vcdiff/src/compile_assert.h",
19     "open-vcdiff/src/decodetable.cc",
20     "open-vcdiff/src/decodetable.h",
21     "open-vcdiff/src/encodetable.cc",
22     "open-vcdiff/src/encodetable.h",
23     "open-vcdiff/src/google/output_string.h",
24     "open-vcdiff/src/google/vcdecoder.h",
25     "open-vcdiff/src/headerparser.cc",
26     "open-vcdiff/src/headerparser.h",
27     "open-vcdiff/src/instruction_map.cc",
28     "open-vcdiff/src/instruction_map.h",
29     "open-vcdiff/src/rolling_hash.h",
30     "open-vcdiff/src/testing.h",
31     "open-vcdiff/src/varint_bigendian.cc",
32     "open-vcdiff/src/varint_bigendian.h",
33     "open-vcdiff/src/vcdecoder.cc",
34     "open-vcdiff/src/vcdiff_defs.h",
35     "open-vcdiff/src/vcdiffengine.cc",
36     "open-vcdiff/src/vcdiffengine.h",
37     "open-vcdiff/vsprojects/config.h",
38     "open-vcdiff/vsprojects/stdint.h",
39   ]
41   direct_dependent_configs = [ ":sdch_config" ]
43   deps = [
44     "//base",
45     "//third_party/zlib",
46   ]
48   if (is_linux || is_android) {
49     include_dirs = [ "linux" ]
50   } else if (is_ios) {
51     include_dirs = [ "ios" ]
52   } else if (is_mac) {
53     include_dirs = [ "mac" ]
54   } else if (is_win) {
55     include_dirs = [ "win" ]
56   }
58   # open-vcdiff's logging.h introduces static initializers. This was
59   # reported upstream years ago (
60   # https://code.google.com/p/open-vcdiff/issues/detail?id=33 ). Since
61   # upstream won't fix this, work around it on the chromium side:
62   # Inject a header that forwards to base/logging.h instead (which doesn't
63   # introduce static initializers, and which prevents open-vcdiff's
64   # logging.h from being used).
65   logging_file = rebase_path("logging_forward.h", root_build_dir)
66   if (is_win) {
67     cflags = [
68       "/FI", rebase_path("//build/intsafe_workaround.h", root_build_dir),
69       "/FI", logging_file,
70     ]
71   } else {
72     cflags = [ "-include", logging_file ]
73     if (is_linux) {
74       # TODO(mostynb): remove this if open-vcdiff is ever updated for c++11:
75       cflags += [ "-Wno-deprecated-declarations" ]
76     }
77   }