naiveproxy/third_party/flatbuffers/BUILD.gn
2018-01-28 13:32:06 -05:00

113 lines
2.9 KiB
Plaintext

# 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" ]
if (is_clang) {
cflags = [ "-Wno-exit-time-destructors" ]
}
}
# The part of FlatBuffers that Chrome is interested in.
source_set("flatbuffers") {
sources = [
"src/include/flatbuffers/flatbuffers.h",
]
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/schema_interface.h",
"src/include/flatbuffers/code_generators.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/reflection.h",
"src/include/flatbuffers/reflection_generated.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_fbs.cpp",
"src/src/idl_gen_general.cpp",
"src/src/idl_gen_go.cpp",
"src/src/idl_gen_grpc.cpp",
"src/src/idl_gen_js.cpp",
"src/src/idl_gen_php.cpp",
"src/src/idl_gen_python.cpp",
"src/src/idl_gen_text.cpp",
"src/src/idl_parser.cpp",
"src/src/reflection.cpp",
"src/src/util.cpp",
]
visibility = [ ":*" ]
deps = [
":flatbuffers",
]
}
executable("flatc") {
sources = [
"src/src/flatc_main.cpp",
]
deps = [
":compiler_files",
":flatbuffers",
"//build/config:exe_and_shlib_deps",
]
}
# 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_unittest") {
sources = [
"src/tests/test.cpp",
]
deps = [
":compiler_files",
":flatbuffers",
":flatbuffers_samplebuffer",
]
data = [
"src/tests/",
]
if (is_win) {
# Suppress "object allocated on the heap may not be aligned 16".
cflags = [ "/wd4316" ]
}
defines = [ "FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE" ]
}