1# Copyright 2019 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 5import("//build_overrides/build.gni") 6 7declare_args() { 8 # Enables trace logging in build. This is true by default, unless 9 # we are built against Chrome--we have no way to link their platform 10 # implementation into our binaries so trace logging is not possible. 11 enable_trace_logging = !build_with_chromium 12} 13 14config("trace_logging_config") { 15 if (enable_trace_logging) { 16 defines = [ "ENABLE_TRACE_LOGGING" ] 17 } 18} 19 20# The set of util classes which have no dependency on platform:api. 21source_set("base") { 22 sources = [ 23 "base64.cc", 24 "base64.h", 25 "big_endian.cc", 26 "big_endian.h", 27 "chrono_helpers.h", 28 "enum_name_table.h", 29 "flat_map.h", 30 "hashing.h", 31 "integer_division.h", 32 "json/json_helpers.h", 33 "json/json_serialization.cc", 34 "json/json_serialization.h", 35 "json/json_value.cc", 36 "json/json_value.h", 37 "osp_logging.h", 38 "saturate_cast.h", 39 "simple_fraction.cc", 40 "simple_fraction.h", 41 "std_util.cc", 42 "std_util.h", 43 "stringprintf.cc", 44 "stringprintf.h", 45 "url.cc", 46 "url.h", 47 "weak_ptr.h", 48 "yet_another_bit_vector.cc", 49 "yet_another_bit_vector.h", 50 ] 51 52 public_deps = [ 53 "../platform:base", 54 "../platform:logging", 55 "../third_party/abseil", 56 "../third_party/jsoncpp", 57 ] 58 59 deps = [ 60 "../third_party/mozilla", 61 62 # We do a clone of Chrome's modp_b64 in order to share their BUILD.gn 63 # and license files, so this should always be an absolute reference. 64 "//third_party/modp_b64", 65 ] 66 67 public_configs = [ "../build:openscreen_include_dirs" ] 68} 69 70source_set("util") { 71 sources = [ 72 "alarm.cc", 73 "alarm.h", 74 "crypto/certificate_utils.cc", 75 "crypto/certificate_utils.h", 76 "crypto/digest_sign.cc", 77 "crypto/digest_sign.h", 78 "crypto/openssl_util.cc", 79 "crypto/openssl_util.h", 80 "crypto/pem_helpers.cc", 81 "crypto/pem_helpers.h", 82 "crypto/random_bytes.cc", 83 "crypto/random_bytes.h", 84 "crypto/rsa_private_key.cc", 85 "crypto/rsa_private_key.h", 86 "crypto/secure_hash.cc", 87 "crypto/secure_hash.h", 88 "crypto/sha2.cc", 89 "crypto/sha2.h", 90 "trace_logging.h", 91 "trace_logging/macro_support.h", 92 "trace_logging/scoped_trace_operations.cc", 93 "trace_logging/scoped_trace_operations.h", 94 ] 95 96 public_deps = [ 97 ":base", 98 "../platform:api", 99 "../platform:base", 100 "../third_party/abseil", 101 "../third_party/jsoncpp", 102 ] 103 104 deps = [ "../third_party/boringssl" ] 105 106 public_configs = [ 107 "../build:openscreen_include_dirs", 108 ":trace_logging_config", 109 ] 110} 111 112source_set("unittests") { 113 testonly = true 114 115 sources = [ 116 "alarm_unittest.cc", 117 "base64_unittest.cc", 118 "big_endian_unittest.cc", 119 "crypto/certificate_utils_unittest.cc", 120 "crypto/random_bytes_unittest.cc", 121 "crypto/rsa_private_key_unittest.cc", 122 "crypto/secure_hash_unittest.cc", 123 "crypto/sha2_unittest.cc", 124 "enum_name_table_unittest.cc", 125 "flat_map_unittest.cc", 126 "integer_division_unittest.cc", 127 "json/json_helpers_unittest.cc", 128 "json/json_serialization_unittest.cc", 129 "json/json_value_unittest.cc", 130 "saturate_cast_unittest.cc", 131 "simple_fraction_unittest.cc", 132 "stringprintf_unittest.cc", 133 "trace_logging/scoped_trace_operations_unittest.cc", 134 "url_unittest.cc", 135 "weak_ptr_unittest.cc", 136 "yet_another_bit_vector_unittest.cc", 137 ] 138 139 # The trace logging unittests depend on macros only defined 140 # when trace logging is enabled. 141 if (enable_trace_logging) { 142 sources += [ "trace_logging_unittest.cc" ] 143 } 144 145 deps = [ 146 ":util", 147 "../platform:test", 148 "../third_party/abseil", 149 "../third_party/boringssl", 150 "../third_party/googletest:gmock", 151 "../third_party/googletest:gtest", 152 "../third_party/jsoncpp", 153 ] 154} 155