blob: 7ffd758126200d301c81268cd264cb57e680f771 [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("//testing/test.gni")
import("//third_party/flatbuffers/flatbuffer.gni")
config("flatbuffers_config") {
include_dirs = [ "src/include" ]
}
# The part of FlatBuffers that Chrome is interested in.
source_set("flatbuffers") {
sources = [
"src/include/flatbuffers/base.h",
"src/include/flatbuffers/flatbuffers.h",
"src/include/flatbuffers/stl_emulation.h",
]
if (is_win) {
data_deps = [
"//build/win:runtime_libs",
]
}
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
public_configs = [ ":flatbuffers_config" ]
}
# The complete FlatBuffers library, as required to build the flatc compiler and
# some of the tests.
source_set("compiler_files") {
include_dirs = [ "src/grpc" ]
sources = [
"src/grpc/src/compiler/config.h",
"src/grpc/src/compiler/cpp_generator.cc",
"src/grpc/src/compiler/cpp_generator.h",
"src/grpc/src/compiler/go_generator.cc",
"src/grpc/src/compiler/go_generator.h",
"src/grpc/src/compiler/java_generator.cc",
"src/grpc/src/compiler/java_generator.h",
"src/grpc/src/compiler/python_generator.cc",
"src/grpc/src/compiler/schema_interface.h",
"src/include/flatbuffers/code_generators.h",
"src/include/flatbuffers/flatbuffers.h",
"src/include/flatbuffers/flatc.h",
"src/include/flatbuffers/flexbuffers.h",
"src/include/flatbuffers/grpc.h",
"src/include/flatbuffers/hash.h",
"src/include/flatbuffers/idl.h",
"src/include/flatbuffers/minireflect.h",
"src/include/flatbuffers/reflection.h",
"src/include/flatbuffers/reflection_generated.h",
"src/include/flatbuffers/registry.h",
"src/include/flatbuffers/util.h",
"src/src/code_generators.cpp",
"src/src/flatc.cpp",
"src/src/idl_gen_cpp.cpp",
"src/src/idl_gen_csharp.cpp",
"src/src/idl_gen_dart.cpp",
"src/src/idl_gen_fbs.cpp",
"src/src/idl_gen_go.cpp",
"src/src/idl_gen_grpc.cpp",
"src/src/idl_gen_java.cpp",
"src/src/idl_gen_js_ts.cpp",
"src/src/idl_gen_json_schema.cpp",
"src/src/idl_gen_kotlin.cpp",
"src/src/idl_gen_lobster.cpp",
"src/src/idl_gen_lua.cpp",
"src/src/idl_gen_php.cpp",
"src/src/idl_gen_python.cpp",
"src/src/idl_gen_rust.cpp",
"src/src/idl_gen_text.cpp",
"src/src/idl_parser.cpp",
"src/src/reflection.cpp",
"src/src/util.cpp",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
visibility = [ ":*" ]
deps = [
":flatbuffers",
]
}
executable("flatc") {
sources = [
"src/src/flatc_main.cpp",
]
deps = [
":compiler_files",
":flatbuffers",
]
}
# The following is just for testing.
flatbuffer("flatbuffers_samplebuffer") {
testonly = true
sources = [
"src/tests/include_test/include_test1.fbs",
"src/tests/include_test/sub/include_test2.fbs",
"src/tests/monster_test.fbs",
"src/tests/namespace_test/namespace_test1.fbs",
"src/tests/namespace_test/namespace_test2.fbs",
]
flatc_include_dirs = [ "src/tests/include_test" ]
}
test("flatbuffers_unittests") {
sources = [
"src/tests/native_type_test_impl.cpp",
"src/tests/test.cpp",
"src/tests/test_assert.cpp",
"src/tests/test_builder.cpp",
]
deps = [
":compiler_files",
":flatbuffers",
":flatbuffers_samplebuffer",
]
data = [
"src/tests/",
"//testing/scripts/common.py",
"//testing/scripts/run_flatbuffers_unittests.py",
"//testing/xvfb.py",
]
defines = [
"FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
# Careful, this test suite needs to be run in the actual out/<build_dir>
# directory.
"FLATBUFFERS_TEST_PATH_PREFIX=" +
rebase_path("//third_party/flatbuffers/src/", root_build_dir),
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}