blob: 69a07232cc517eb166c1ee8e0fac50753fa72a48 [file] [log] [blame]
Hangyu Kuangf047e7c2016-07-06 14:21:45 -07001#
2# Copyright 2014 The LibYuv Project Authors. All rights reserved.
3#
4# Use of this source code is governed by a BSD-style license
5# that can be found in the LICENSE file in the root of the source
6# tree. An additional intellectual property rights grant can be found
7# in the file PATENTS. All contributing project authors may
8# be found in the AUTHORS file in the root of the source tree.
9
10# This is a copy of WebRTC's BUILD.gn.
11
12if (is_win) {
13 gflags_gen_arch_root = "gen/win"
14} else {
15 gflags_gen_arch_root = "gen/posix"
16}
17
18config("gflags_config") {
19 include_dirs = [
20 "$gflags_gen_arch_root/include", # For configured files.
21 "src/src", # For everything else.
22 ]
23
24 defines = [
25 # These macros exist so flags and symbols are properly exported when
26 # building DLLs. Since we don't build DLLs, we need to disable them.
27 "GFLAGS_DLL_DECL=",
28 "GFLAGS_DLL_DECLARE_FLAG=",
29 "GFLAGS_DLL_DEFINE_FLAG=",
30 ]
31
32 # GN orders flags on a target before flags from configs. The default config
33 # adds -Wall, and this flag have to be after -Wall -- so they need to
34 # come from a config and can't be on the target directly.
35 if (is_clang) {
36 cflags = [ "-Wno-unused-local-typedef" ]
37 }
38}
39
40source_set("gflags") {
41 cflags = []
42 sources = [
43 "src/src/gflags.cc",
44 "src/src/gflags_completions.cc",
45 "src/src/gflags_reporting.cc",
46 ]
47 if (is_win) {
48 sources += [ "src/src/windows_port.cc" ]
49
50 cflags += [
51 "/wd4005", # WIN32_LEAN_AND_MEAN.
52 "/wd4267", # Conversion from size_t to "type".
53 ]
54 }
55
56 include_dirs = [
57 "$gflags_gen_arch_root/include/gflags", # For configured files.
58 "$gflags_gen_arch_root/include/private", # For config.h
59 ]
60
61 public_configs = [ ":gflags_config" ]
62
63 configs -= [ "//build/config/compiler:chromium_code" ]
64 configs += [ "//build/config/compiler:no_chromium_code" ]
65
66 if (is_win) {
67 configs -= [ "//build/config/win:unicode" ]
68 }
69
70 if (is_clang) {
71 # TODO(andrew): Look into fixing this warning upstream:
72 # http://code.google.com/p/webrtc/issues/detail?id=760
73 configs -= [ "//build/config/clang:extra_warnings" ]
74 cflags += [ "-Wno-microsoft-include" ]
75 }
76}