Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / wtf / BUILD.gn
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 # The list of files is kept in the .gypi.
6 gypi_values = exec_script("//build/gypi_to_gn.py",
7                           [ rebase_path("wtf.gypi") ],
8                           "scope",
9                           [ "wtf.gypi" ])
10
11 visibility = [ "//third_party/WebKit/*" ]
12
13 config("wtf_config") {
14   if (is_win) {
15     defines = [
16       "__STD_C",
17       "_CRT_SECURE_NO_DEPRECATE",
18       "_SCL_SECURE_NO_DEPRECATE",
19       "CRASH=__debugbreak",
20     ]
21     include_dirs = [
22       "os-win32",
23     ]
24
25     cflags = [
26       # Don't complain about calling specific versions of templatized
27       # functions (e.g. in RefPtrHashMap.h).
28       "/wd4344",
29       # Conversion from 'size_t' to 'type'.
30       "/wd4267",
31       # dtoa, icu, etc. like doing assignment within conditional.
32       "/wd4706",
33     ]
34
35     if (component_mode == "shared_library") {
36       # Chromium windows multi-dll build enables C++ exceptions and this causes
37       # wtf to generate 4291 warning due to operator new/delete
38       # implementations. Disable the warning for chromium windows multi-dll
39       # build.
40       cflags += [ "/wd4291" ]
41     }
42   }
43 }
44
45 component("wtf") {
46   sources = gypi_values.wtf_files
47
48   configs += [
49     "//third_party/WebKit/Source:config",
50     "//third_party/WebKit/Source:non_test_config",
51   ]
52
53   defines = [ "WTF_IMPLEMENTATION=1" ]
54
55   public_configs = [
56     ":wtf_config",
57     "//third_party/WebKit/Source:features",
58   ]
59
60   public_deps = [
61     "//third_party/icu",
62   ]
63
64   if (is_win) {
65     sources -= [
66       "ThreadingPthreads.cpp",
67     ]
68
69     cflags = [
70       "/wd4068",  # Unknown pragma.
71     ]
72   } else {
73     # Non-Windows.
74     sources -= [
75       "ThreadSpecificWin.cpp",
76       "ThreadingWin.cpp",
77     ]
78   }
79
80   if (is_android) {
81     libs = [ "log" ]
82   }
83
84   if (is_mac) {
85     libs = [ "CoreFoundation.framework", "Foundation.framework" ]
86   } else {
87     sources -= [
88       "text/StringImplCF.cpp",
89       "text/AtomicStringCF.cpp",
90       "text/StringCF.cpp",
91     ]
92   }
93 }
94
95 test("wtf_unittests") {
96   sources = gypi_values.wtf_unittest_files
97
98   sources += [ "testing/RunAllTests.cpp" ]
99
100   if (is_win) {
101     cflags = [
102       "/wd4068",  # Unknown pragma.
103       "/wd4267",  # Conversion from 'size_t' to 'type',
104     ]
105   }
106
107   configs += [ "//third_party/WebKit/Source:config", ]
108
109   deps = [
110     ":test_support",
111     ":wtf",
112     "//base",
113     "//base/allocator",
114     "//base/test:test_support",
115     "//testing/gmock",
116     "//testing/gtest",
117   ]
118 }
119
120 component("test_support") {
121   output_name = "wtf_test_support"
122   sources = gypi_values.wtf_unittest_helper_files
123   defines = [ "WTF_UNITTEST_HELPERS_IMPLEMENTATION=1" ]
124
125   configs += [
126     ":wtf_config",
127     "//third_party/WebKit/Source:config",
128     "//third_party/WebKit/Source:non_test_config",
129   ]
130
131   deps = [
132     ":wtf",
133   ]
134 }