Home | History | Annotate | Download | only in wtf
      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     ]
     32 
     33     if (component_mode == "shared_library") {
     34       # Chromium windows multi-dll build enables C++ exceptions and this causes
     35       # wtf to generate 4291 warning due to operator new/delete
     36       # implementations. Disable the warning for chromium windows multi-dll
     37       # build.
     38       cflags += [ "/wd4291" ]
     39     }
     40   }
     41 }
     42 
     43 component("wtf") {
     44   sources = gypi_values.wtf_files
     45 
     46   configs += [
     47     "//third_party/WebKit/Source:config",
     48     "//third_party/WebKit/Source:non_test_config",
     49   ]
     50 
     51   defines = [ "WTF_IMPLEMENTATION=1" ]
     52 
     53   direct_dependent_configs = [
     54     ":wtf_config",
     55     "//third_party/WebKit/Source:features",
     56   ]
     57 
     58   deps = [
     59     "//third_party/icu",
     60   ]
     61 
     62   forward_dependent_configs_from = [ "//third_party/icu" ]
     63 
     64   if (is_win) {
     65     sources -= [
     66       "ThreadIdentifierDataPthreads.cpp",
     67       "ThreadIdentifierDataPthreads.h",
     68       "ThreadingPthreads.cpp",
     69     ]
     70 
     71     cflags = [
     72       "/wd4068",  # Unknown pragma.
     73     ]
     74   } else {
     75     # Non-Windows.
     76     sources -= [
     77       "ThreadSpecificWin.cpp",
     78       "ThreadingWin.cpp",
     79     ]
     80   }
     81 
     82   if (is_android) {
     83     libs = [ "log" ]
     84   }
     85 
     86   if (is_mac) {
     87     libs = [ "CoreFoundation.framework", "Foundation.framework" ]
     88   } else {
     89     sources -= [
     90       "text/StringImplCF.cpp",
     91       "text/AtomicStringCF.cpp",
     92       "text/StringCF.cpp",
     93     ]
     94   }
     95 }
     96 
     97 test("wtf_unittests") {
     98   sources = gypi_values.wtf_unittest_files
     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     ":run_all_tests",
    111     ":unittest_helpers",
    112     ":wtf",
    113     "//base",
    114     "//base/allocator",
    115     "//testing/gmock",
    116     "//testing/gtest",
    117   ]
    118 }
    119 
    120 source_set("run_all_tests") {
    121   sources = [
    122     "testing/RunAllTests.cpp",
    123   ]
    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     "//base/test:test_support",
    133     "//testing/gmock",
    134     "//testing/gtest",
    135   ]
    136 }
    137 
    138 component("unittest_helpers") {
    139   sources = gypi_values.wtf_unittest_helper_files
    140   defines = [ "WTF_UNITTEST_HELPERS_IMPLEMENTATION=1" ]
    141 
    142   configs += [
    143     ":wtf_config",
    144     "//third_party/WebKit/Source:config",
    145     "//third_party/WebKit/Source:non_test_config",
    146   ]
    147 
    148   deps = [
    149     ":wtf",
    150   ]
    151 }
    152