Upstream version 9.38.198.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   direct_dependent_configs = [
56     ":wtf_config",
57     "//third_party/WebKit/Source:features",
58   ]
59
60   deps = [
61     "//third_party/icu",
62   ]
63
64   forward_dependent_configs_from = [ "//third_party/icu" ]
65
66   if (is_win) {
67     sources -= [
68       "ThreadIdentifierDataPthreads.cpp",
69       "ThreadIdentifierDataPthreads.h",
70       "ThreadingPthreads.cpp",
71     ]
72
73     cflags = [
74       "/wd4068",  # Unknown pragma.
75     ]
76   } else {
77     # Non-Windows.
78     sources -= [
79       "ThreadSpecificWin.cpp",
80       "ThreadingWin.cpp",
81     ]
82   }
83
84   if (is_android) {
85     libs = [ "log" ]
86   }
87
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   }
97 }
98
99 test("wtf_unittests") {
100   sources = gypi_values.wtf_unittest_files
101
102   sources += [ "testing/RunAllTests.cpp" ]
103
104   if (is_win) {
105     cflags = [
106       "/wd4068",  # Unknown pragma.
107       "/wd4267",  # Conversion from 'size_t' to 'type',
108     ]
109   }
110
111   configs += [ "//third_party/WebKit/Source:config", ]
112
113   deps = [
114     ":test_support",
115     ":wtf",
116     "//base",
117     "//base/allocator",
118     "//base/test:test_support",
119     "//testing/gmock",
120     "//testing/gtest",
121   ]
122 }
123
124 component("test_support") {
125   output_name = "wtf_test_support"
126   sources = gypi_values.wtf_unittest_helper_files
127   defines = [ "WTF_UNITTEST_HELPERS_IMPLEMENTATION=1" ]
128
129   configs += [
130     ":wtf_config",
131     "//third_party/WebKit/Source:config",
132     "//third_party/WebKit/Source:non_test_config",
133   ]
134
135   deps = [
136     ":wtf",
137   ]
138 }