# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//mojo/public/tools/bindings/mojom.gni")
import("//third_party/protobuf/proto_library.gni")
component("base") {
output_name = "mojo_base_lib"
sources = [
"big_buffer.cc",
"big_buffer.h",
"shared_memory_utils.cc",
"shared_memory_utils.h",
"shared_memory_version.cc",
"shared_memory_version.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
defines = [ "IS_MOJO_BASE_IMPL" ]
public_deps = [
"//base",
"//mojo/core/embedder",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/system",
]
}
component("protobuf_support") {
output_name = "mojo_base_protobuf_support"
sources = [
"proto_wrapper.cc",
"proto_wrapper.h",
"proto_wrapper_passkeys.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
defines = [ "IS_MOJO_BASE_PROTOBUF_SUPPORT_IMPL" ]
public_deps = [
":base",
"//base",
"//mojo/core/embedder",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/system",
"//third_party/protobuf:protobuf_lite",
]
}
component("typemap_traits") {
output_name = "mojo_base_typemap_traits"
sources = [
"big_string_mojom_traits.cc",
"big_string_mojom_traits.h",
"memory_allocator_dump_cross_process_uid_mojom_traits.cc",
"memory_allocator_dump_cross_process_uid_mojom_traits.h",
"memory_pressure_level_mojom_traits.cc",
"memory_pressure_level_mojom_traits.h",
"message_pump_type_mojom_traits.cc",
"message_pump_type_mojom_traits.h",
"process_id_mojom_traits.cc",
"process_id_mojom_traits.h",
"process_priority_mojom_traits.cc",
"process_priority_mojom_traits.h",
"ref_counted_memory_mojom_traits.cc",
"ref_counted_memory_mojom_traits.h",
"string16_mojom_traits.cc",
"string16_mojom_traits.h",
"text_direction_mojom_traits.cc",
"text_direction_mojom_traits.h",
"thread_type_mojom_traits.cc",
"thread_type_mojom_traits.h",
]
if (is_android) {
sources += [
"application_state_mojom_traits.cc",
"application_state_mojom_traits.h",
]
}
if (is_win) {
sources += [
"logfont_win_mojom_traits.cc",
"logfont_win_mojom_traits.h",
"wstring_mojom_traits.cc",
"wstring_mojom_traits.h",
]
}
configs += [ "//build/config/compiler:wexit_time_destructors" ]
defines = [ "IS_MOJO_BASE_TRAITS_IMPL" ]
public_deps = [
":shared_typemap_traits",
"//base",
"//mojo:buildflags",
"//mojo/public/cpp/base",
"//mojo/public/mojom/base:base_shared",
]
}
# Normally typemap traits sources should be build directly into mojom targets
# via the typemap file. This target is for typemapped mojo_base types whose
# traits are shared between chromium and blink variants.
component("shared_typemap_traits") {
output_name = "mojo_base_shared_typemap_traits"
sources = [
"big_buffer_mojom_traits.cc",
"big_buffer_mojom_traits.h",
"byte_string_mojom_traits.cc",
"byte_string_mojom_traits.h",
"file_info_mojom_traits.cc",
"file_info_mojom_traits.h",
"file_mojom_traits.cc",
"file_mojom_traits.h",
"file_path_mojom_traits.cc",
"file_path_mojom_traits.h",
"generic_pending_associated_receiver_mojom_traits.cc",
"generic_pending_associated_receiver_mojom_traits.h",
"generic_pending_receiver_mojom_traits.cc",
"generic_pending_receiver_mojom_traits.h",
"int128_mojom_traits.cc",
"int128_mojom_traits.h",
"read_only_buffer_mojom_traits.cc",
"read_only_buffer_mojom_traits.h",
"read_only_file_mojom_traits.cc",
"read_only_file_mojom_traits.h",
"safe_base_name_mojom_traits.cc",
"safe_base_name_mojom_traits.h",
"shared_memory_mojom_traits.cc",
"shared_memory_mojom_traits.h",
"time_mojom_traits.cc",
"time_mojom_traits.h",
"token_mojom_traits.cc",
"token_mojom_traits.h",
"unguessable_token_mojom_traits.cc",
"unguessable_token_mojom_traits.h",
"uuid_mojom_traits.cc",
"uuid_mojom_traits.h",
"values_mojom_traits.cc",
"values_mojom_traits.h",
"version_mojom_traits.cc",
"version_mojom_traits.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
defines = [ "IS_MOJO_BASE_SHARED_TRAITS_IMPL" ]
public_deps = [
":base",
"//base:i18n",
"//mojo/public/mojom/base:base_shared",
"//third_party/abseil-cpp:absl",
]
}
component("protobuf_support_traits") {
output_name = "mojo_base_protobuf_support_traits"
sources = [
"proto_wrapper_mojom_traits.cc",
"proto_wrapper_mojom_traits.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
defines = [ "IS_MOJO_BASE_PROTOBUF_SUPPORT_TRAITS_IMPL" ]
public_deps = [
":base",
":protobuf_support",
":shared_typemap_traits",
"//base:i18n",
"//mojo/public/mojom/base:base_shared",
"//mojo/public/mojom/base:protobuf_support_shared",
"//third_party/abseil-cpp:absl",
]
}
proto_library("test_proto") {
testonly = true
sources = [ "test.proto" ]
cc_generator_options = "lite"
}
source_set("tests") {
testonly = true
sources = [
"big_buffer_unittest.cc",
"big_string_unittest.cc",
"byte_string_unittest.cc",
"file_path_unittest.cc",
"file_unittest.cc",
"int128_unittest.cc",
"memory_allocator_dump_cross_process_uid_unittest.cc",
"process_id_unittest.cc",
"proto_wrapper_unittest.cc",
"read_only_buffer_unittest.cc",
"ref_counted_memory_unittest.cc",
"safe_base_name_unittest.cc",
"shared_memory_unittest.cc",
"shared_memory_version_unittest.cc",
"string16_unittest.cc",
"text_direction_unittest.cc",
"thread_type_unittest.cc",
"time_unittest.cc",
"token_unittest.cc",
"unguessable_token_unittest.cc",
"uuid_unittest.cc",
"values_unittest.cc",
"version_unittest.cc",
]
public_deps = [
":base",
":protobuf_support",
":protobuf_support_traits",
":shared_typemap_traits",
":test_proto",
"//base",
"//base/test:test_support",
"//build:blink_buildflags",
"//mojo/public/cpp/test_support:test_utils",
"//mojo/public/mojom/base",
"//mojo/public/mojom/base:protobuf_support",
"//testing/gtest",
"//third_party/abseil-cpp:absl",
]
if (is_fuchsia) {
public_deps += [ "//mojo/public/cpp/base/fuchsia:unittests" ]
}
}