Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / wtf / BUILD.gn
blob50923be02c75ac5601ab0a4c38b2d0e9cc5ed3a1
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 import("//testing/test.gni")
7 # The list of files is kept in the .gypi.
8 gypi_values = exec_script("//build/gypi_to_gn.py",
9                           [ rebase_path("wtf.gypi") ],
10                           "scope",
11                           [ "wtf.gypi" ])
13 visibility = [ "//third_party/WebKit/*" ]
15 config("wtf_config") {
16   if (is_win) {
17     defines = [
18       "__STD_C",
19       "_CRT_SECURE_NO_DEPRECATE",
20       "_SCL_SECURE_NO_DEPRECATE",
21     ]
22     include_dirs = [
23       "os-win32",
24     ]
26     cflags = [
27       # Don't complain about calling specific versions of templatized
28       # functions (e.g. in RefPtrHashMap.h).
29       "/wd4344",
30       # dtoa, icu, etc. like doing assignment within conditional.
31       "/wd4706",
32     ]
34     if (is_component_build) {
35       # Chromium windows multi-dll build enables C++ exceptions and this causes
36       # wtf to generate 4291 warning due to operator new/delete
37       # implementations. Disable the warning for chromium windows multi-dll
38       # build.
39       cflags += [ "/wd4291" ]
40     }
41   }
44 component("wtf") {
45   sources = gypi_values.wtf_files
47   configs += [
48     "//third_party/WebKit/Source:config",
49     "//third_party/WebKit/Source:non_test_config",
50   ]
52   defines = [ "WTF_IMPLEMENTATION=1" ]
54   public_configs = [
55     ":wtf_config",
56     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
57     "//build/config/compiler:no_size_t_to_int_warning",
58     "//third_party/WebKit/Source:features",
59   ]
61   public_deps = [
62     "//third_party/icu",
63   ]
65   if (is_win) {
66     sources -= [
67       "ThreadingPthreads.cpp",
68     ]
70     cflags = [
71       "/wd4068",  # Unknown pragma.
72     ]
73   } else {
74     # Non-Windows.
75     sources -= [
76       "ThreadSpecificWin.cpp",
77       "ThreadingWin.cpp",
78     ]
79   }
81   if (is_android) {
82     libs = [ "log" ]
83   }
84   if (is_linux) {
85     libs = [ "dl" ]
86   }
88   if (is_mac) {
89     libs = [ "CoreFoundation.framework", "Foundation.framework" ]
90   } else {
91     sources -= [
92       "text/StringImplCF.cpp",
93       "text/AtomicStringCF.cpp",
94       "text/StringCF.cpp",
95     ]
96   }
99 test("wtf_unittests") {
100   visibility = []  # Allow re-assignment of list.
101   visibility = [ "*" ]
103   sources = gypi_values.wtf_unittest_files
105   sources += [ "testing/RunAllTests.cpp" ]
107   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
108   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
110   if (is_win) {
111     cflags = [ "/wd4068" ]  # Unknown pragma.
112   }
114   configs += [ "//third_party/WebKit/Source:config", ]
116   deps = [
117     ":test_support",
118     ":wtf",
119     "//base",
120     "//base/allocator",
121     "//base/test:test_support",
122     "//testing/gmock",
123     "//testing/gtest",
124   ]
127 component("test_support") {
128   output_name = "wtf_test_support"
129   sources = gypi_values.wtf_unittest_helper_files
130   defines = [ "WTF_UNITTEST_HELPERS_IMPLEMENTATION=1" ]
132   configs += [
133     ":wtf_config",
134     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
135     "//build/config/compiler:no_size_t_to_int_warning",
136     "//third_party/WebKit/Source:config",
137     "//third_party/WebKit/Source:non_test_config",
138   ]
140   deps = [
141     ":wtf",
142   ]