Generates includes for imported flatbuffers schemas.
Because includes are generated without directory, this exports the
directory where generated headers are produced to the include path of
the dependent target.
Change-Id: I8058553f69aadf29cc1a2926fc27664d023e6e1d
diff --git a/flatbuffer.gni b/flatbuffer.gni
index d4164a5..96cd180 100644
--- a/flatbuffer.gni
+++ b/flatbuffer.gni
@@ -53,7 +53,9 @@
set_sources_assignment_filter([])
action_name = "${target_name}_gen"
+ config_name = "${target_name}_config"
source_set_name = target_name
+
compiled_action_foreach(action_name) {
visibility = [ ":$source_set_name" ]
@@ -74,7 +76,6 @@
args = [
"-I",
rebase_path("//"),
- "--no-includes",
"-c",
"-o",
"$out_dir",
@@ -87,6 +88,10 @@
}
}
+ config(config_name) {
+ include_dirs = get_path_info(get_target_outputs(":$action_name"), "dir")
+ }
+
source_set(target_name) {
forward_variables_from(invoker,
[
@@ -104,7 +109,10 @@
testonly = invoker.testonly
}
- public_configs = [ "//third_party/flatbuffers:flatbuffers_config" ]
+ public_configs = [
+ "//third_party/flatbuffers:flatbuffers_config",
+ ":$config_name",
+ ]
public_deps = [
# The generated headers reference headers within flatbuffers, so