blob: 2583fa4f7b3d652fe10e1ccec5ee3881a45868bc [file] [log] [blame]
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("../mojo_sdk.gni")
config("c_config") {
include_dirs = [ "include" ]
}
# Catch-all for all public C headers/libraries, except for the bindings.
group("c") {
public_deps = [
":common",
":system",
]
}
# bindings ---------------------------------------------------------------------
# Headers in include/mojo/bindings (to be included as <mojo/bindings/HEADER.h>)
# and library in lib/bindings.
#
# Depends on :common and :system (minimally -- just <mojo/system/handle.h>).
mojo_sdk_source_set("bindings") {
public_configs = [ ":c_config" ]
sources = [
# Public headers.
"include/mojo/bindings/array.h",
"include/mojo/bindings/buffer.h",
"include/mojo/bindings/interface.h",
"include/mojo/bindings/map.h",
"include/mojo/bindings/message.h",
"include/mojo/bindings/string.h",
"include/mojo/bindings/struct.h",
"include/mojo/bindings/union.h",
"include/mojo/bindings/validation.h",
# Internal headers.
"include/mojo/bindings/internal/type_descriptor.h",
"include/mojo/bindings/internal/util.h",
# Implementation library.
# TODO(vtl): Maybe separate this out into a separate source set (or even
# static library?).
"lib/bindings/array.c",
"lib/bindings/buffer.c",
"lib/bindings/map.c",
"lib/bindings/message.c",
"lib/bindings/struct.c",
"lib/bindings/type_descriptor.c",
"lib/bindings/union.c",
]
deps = [
":system",
]
}
# common -----------------------------------------------------------------------
# Headers in include/mojo (to be included as <mojo/HEADER.h>).
#
# Depends on nothing.
mojo_sdk_source_set("common") {
public_configs = [ ":c_config" ]
sources = [
"include/mojo/macros.h",
"include/mojo/result.h",
]
}
mojo_sdk_source_set("common_unittests") {
testonly = true
sources = [
"tests/macros_unittest.cc",
"tests/result_unittest.cc",
]
deps = [
":common",
"//testing/gtest",
]
}
# environment ------------------------------------------------------------------
# Headers in include/mojo/environment (to be included as
# <mojo//environment/HEADER.h>).
#
# Depends on :system (and thus :common).
mojo_sdk_source_set("environment") {
public_configs = [ ":c_config" ]
sources = [
"include/mojo/environment/async_waiter.h",
"include/mojo/environment/logger.h",
]
public_deps = [
":system",
]
}
# system -----------------------------------------------------------------------
# Headers in include/mojo/system (to be included as <mojo/system/HEADER.h>).
#
# Depends on :common.
mojo_sdk_source_set("system") {
public_configs = [ ":c_config" ]
sources = [
"include/mojo/system/buffer.h",
"include/mojo/system/data_pipe.h",
"include/mojo/system/handle.h",
"include/mojo/system/main.h",
"include/mojo/system/message_pipe.h",
"include/mojo/system/time.h",
"include/mojo/system/wait.h",
"include/mojo/system/wait_set.h",
]
public_deps = [
":common",
]
}
mojo_sdk_source_set("system_unittests") {
testonly = true
sources = [
"tests/system/buffer_unittest.cc",
"tests/system/data_pipe_unittest.cc",
"tests/system/handle_unittest.cc",
"tests/system/message_pipe_unittest.cc",
"tests/system/time_unittest.cc",
"tests/system/wait_set_unittest.cc",
"tests/system/wait_unittest.cc",
]
deps = [
":system",
"//testing/gtest",
]
}
mojo_sdk_source_set("system_perftests") {
testonly = true
sources = [
"tests/system/message_pipe_perftest.cc",
"tests/system/perftest_utils.cc",
"tests/system/perftest_utils.h",
"tests/system/reference_perftest.cc",
"tests/system/wait_set_perftest.cc",
]
deps = [
":system",
"//testing/gtest",
]
mojo_sdk_deps = [ "mojo/public/cpp/test_support" ]
}
# Compilation tests ------------------------------------------------------------
# This test ensures that various headers compile and link properly.
mojo_sdk_source_set("compile_unittests") {
testonly = true
sources = [
"tests/compile/compile_unittest.cc",
]
deps = [
":pure_compile_tests",
"//testing/gtest",
]
}
# This source set contains "pure" tests that only depend on the public SDK (and
# the standard library), and in particular not on gtest (whose headers don't
# compile with "-Wundef").
mojo_sdk_source_set("pure_compile_tests") {
testonly = true
visibility = [ ":compile_unittests" ]
cflags = [ "-Wundef" ]
sources = [
"tests/compile/pure_c.c",
"tests/compile/pure_cpp.cc",
]
mojo_sdk_deps = [ "mojo/public/c:environment" ]
}