OLD | NEW |
| (Empty) |
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("sdch_config") { | |
6 include_dirs = [ "open-vcdiff/src" ] | |
7 } | |
8 | |
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/google/vcencoder.h", | |
26 "open-vcdiff/src/headerparser.cc", | |
27 "open-vcdiff/src/headerparser.h", | |
28 "open-vcdiff/src/instruction_map.cc", | |
29 "open-vcdiff/src/instruction_map.h", | |
30 "open-vcdiff/src/jsonwriter.h", | |
31 "open-vcdiff/src/jsonwriter.cc", | |
32 "open-vcdiff/src/rolling_hash.h", | |
33 "open-vcdiff/src/testing.h", | |
34 "open-vcdiff/src/varint_bigendian.cc", | |
35 "open-vcdiff/src/varint_bigendian.h", | |
36 "open-vcdiff/src/vcdecoder.cc", | |
37 "open-vcdiff/src/vcencoder.cc", | |
38 "open-vcdiff/src/vcdiff_defs.h", | |
39 "open-vcdiff/src/vcdiffengine.cc", | |
40 "open-vcdiff/src/vcdiffengine.h", | |
41 "open-vcdiff/vsprojects/config.h", | |
42 "open-vcdiff/vsprojects/stdint.h", | |
43 ] | |
44 | |
45 public_configs = [ ":sdch_config" ] | |
46 | |
47 deps = [ | |
48 "//base", | |
49 "//third_party/zlib", | |
50 ] | |
51 | |
52 # gn orders flags on a target before flags from configs. The default config | |
53 # adds -Wall, and these flags have to be after -Wall -- so they need to come | |
54 # from a config and can't be on the target directly. | |
55 config("sdch_warnings") { | |
56 cflags = [] | |
57 if (is_linux) { | |
58 # TODO(mostynb): remove this if open-vcdiff is ever updated for c++11: | |
59 cflags += [ "-Wno-deprecated-declarations" ] | |
60 } | |
61 | |
62 if (is_clang) { | |
63 # sdch uses the pre-c++11 typedef-as-static_assert hack. | |
64 # https://code.google.com/p/open-vcdiff/issues/detail?id=44 | |
65 cflags += [ "-Wno-unused-local-typedef" ] | |
66 } | |
67 } | |
68 configs += [ ":sdch_warnings" ] | |
69 | |
70 if (is_linux || is_android) { | |
71 include_dirs = [ "linux" ] | |
72 } else if (is_ios) { | |
73 include_dirs = [ "ios" ] | |
74 } else if (is_mac) { | |
75 include_dirs = [ "mac" ] | |
76 } else if (is_win) { | |
77 include_dirs = [ "win" ] | |
78 } | |
79 | |
80 # open-vcdiff's logging.h introduces static initializers. This was | |
81 # reported upstream years ago ( | |
82 # https://code.google.com/p/open-vcdiff/issues/detail?id=33 ). Since | |
83 # upstream won't fix this, work around it on the chromium side: | |
84 # Inject a header that forwards to base/logging.h instead (which doesn't | |
85 # introduce static initializers, and which prevents open-vcdiff's | |
86 # logging.h from being used). | |
87 if (is_win) { | |
88 cflags = [ | |
89 "/FI", | |
90 "sdch/logging_forward.h", | |
91 ] | |
92 } else { | |
93 logging_file = rebase_path("logging_forward.h", root_build_dir) | |
94 cflags = [ | |
95 "-include", | |
96 logging_file, | |
97 ] | |
98 } | |
99 } | |
OLD | NEW |